diff --git a/compiler-rt/lib/crt/crtbegin.c b/compiler-rt/lib/crt/crtbegin.c --- a/compiler-rt/lib/crt/crtbegin.c +++ b/compiler-rt/lib/crt/crtbegin.c @@ -8,6 +8,10 @@ #include +#define STR(S) #S +#define XSTR(S) STR(S) +#define SYMBOL_NAME(NAME) XSTR(__USER_LABEL_PREFIX__) #NAME + __attribute__((visibility("hidden"))) void *__dso_handle = &__dso_handle; #ifdef EH_USE_FRAME_REGISTRY @@ -50,25 +54,25 @@ used)) static void (*__init)(void) = __do_init; #elif defined(__i386__) || defined(__x86_64__) __asm__(".pushsection .init,\"ax\",@progbits\n\t" - "call " __USER_LABEL_PREFIX__ "__do_init\n\t" - ".popsection"); + "call " SYMBOL_NAME(__do_init) "\n\t" + ".popsection"); #elif defined(__riscv) __asm__(".pushsection .init,\"ax\",%progbits\n\t" - "call " __USER_LABEL_PREFIX__ "__do_init\n\t" + "call " SYMBOL_NAME(__do_init) "\n\t" ".popsection"); #elif defined(__arm__) || defined(__aarch64__) __asm__(".pushsection .init,\"ax\",%progbits\n\t" - "bl " __USER_LABEL_PREFIX__ "__do_init\n\t" - ".popsection"); + "bl " SYMBOL_NAME(__do_init) "\n\t" + ".popsection"); #elif defined(__powerpc__) || defined(__powerpc64__) __asm__(".pushsection .init,\"ax\",@progbits\n\t" - "bl " __USER_LABEL_PREFIX__ "__do_init\n\t" - "nop\n\t" - ".popsection"); + "bl " SYMBOL_NAME(__do_init) "\n\t" + "nop\n\t" + ".popsection"); #elif defined(__sparc__) __asm__(".pushsection .init,\"ax\",@progbits\n\t" - "call " __USER_LABEL_PREFIX__ "__do_init\n\t" - ".popsection"); + "call " SYMBOL_NAME(__do_init) "\n\t" + ".popsection"); #else #error "crtbegin without .init_fini array unimplemented for this architecture" #endif // CRT_HAS_INITFINI_ARRAY @@ -103,25 +107,25 @@ used)) static void (*__fini)(void) = __do_fini; #elif defined(__i386__) || defined(__x86_64__) __asm__(".pushsection .fini,\"ax\",@progbits\n\t" - "call " __USER_LABEL_PREFIX__ "__do_fini\n\t" - ".popsection"); + "call " SYMBOL_NAME(__do_fini) "\n\t" + ".popsection"); #elif defined(__arm__) || defined(__aarch64__) __asm__(".pushsection .fini,\"ax\",%progbits\n\t" - "bl " __USER_LABEL_PREFIX__ "__do_fini\n\t" - ".popsection"); + "bl " SYMBOL_NAME(__do_fini) "\n\t" + ".popsection"); #elif defined(__powerpc__) || defined(__powerpc64__) __asm__(".pushsection .fini,\"ax\",@progbits\n\t" - "bl " __USER_LABEL_PREFIX__ "__do_fini\n\t" - "nop\n\t" - ".popsection"); + "bl " SYMBOL_NAME(__do_fini) "\n\t" + "nop\n\t" + ".popsection"); #elif defined(__riscv) __asm__(".pushsection .fini,\"ax\",@progbits\n\t" - "call " __USER_LABEL_PREFIX__ "__do_fini\n\t" + "call " SYMBOL_NAME(__do_fini) "\n\t" ".popsection"); #elif defined(__sparc__) __asm__(".pushsection .fini,\"ax\",@progbits\n\t" - "call " __USER_LABEL_PREFIX__ "__do_fini\n\t" - ".popsection"); + "call " SYMBOL_NAME(__do_fini) "\n\t" + ".popsection"); #else #error "crtbegin without .init_fini array unimplemented for this architecture" -#endif // CRT_HAS_INIT_FINI_ARRAY +#endif // CRT_HAS_INIT_FINI_ARRAY