[compiler-rt] f66b9fe - [crt] Remove __USER_LABEL_PREFIX__

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 28 18:21:21 PDT 2023


Author: Fangrui Song
Date: 2023-03-28T18:21:15-07:00
New Revision: f66b9fe5876d670b38351c9a7efd90e793f35a30

URL: https://github.com/llvm/llvm-project/commit/f66b9fe5876d670b38351c9a7efd90e793f35a30
DIFF: https://github.com/llvm/llvm-project/commit/f66b9fe5876d670b38351c9a7efd90e793f35a30.diff

LOG: [crt] Remove __USER_LABEL_PREFIX__

The .init_array code is ELF specific. For ELF platforms,
`__USER_LABEL_PREFIX__` is defined as "". Make the simplification
so that downstream ELF targets can build this file even if
`__USER_LABEL_PREFIX__` is undefined.

Reviewed By: barannikov88

Differential Revision: https://reviews.llvm.org/D147093

Added: 
    

Modified: 
    compiler-rt/lib/crt/crtbegin.c

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/crt/crtbegin.c b/compiler-rt/lib/crt/crtbegin.c
index 7b041ff00b6b6..ab273b145f58e 100644
--- a/compiler-rt/lib/crt/crtbegin.c
+++ b/compiler-rt/lib/crt/crtbegin.c
@@ -50,25 +50,25 @@ __attribute__((section(".init_array"),
                used)) static void (*__init)(void) = __do_init;
 #elif defined(__i386__) || defined(__x86_64__)
 __asm__(".pushsection .init,\"ax\", at progbits\n\t"
-    "call " __USER_LABEL_PREFIX__ "__do_init\n\t"
-    ".popsection");
+        "call __do_init\n\t"
+        ".popsection");
 #elif defined(__riscv)
 __asm__(".pushsection .init,\"ax\",%progbits\n\t"
-        "call " __USER_LABEL_PREFIX__ "__do_init\n\t"
+        "call __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 __do_init\n\t"
+        ".popsection");
 #elif defined(__powerpc__) || defined(__powerpc64__)
 __asm__(".pushsection .init,\"ax\", at progbits\n\t"
-    "bl " __USER_LABEL_PREFIX__ "__do_init\n\t"
-    "nop\n\t"
-    ".popsection");
+        "bl __do_init\n\t"
+        "nop\n\t"
+        ".popsection");
 #elif defined(__sparc__)
 __asm__(".pushsection .init,\"ax\", at progbits\n\t"
-    "call " __USER_LABEL_PREFIX__ "__do_init\n\t"
-    ".popsection");
+        "call __do_init\n\t"
+        ".popsection");
 #else
 #error "crtbegin without .init_fini array unimplemented for this architecture"
 #endif // CRT_HAS_INITFINI_ARRAY
@@ -103,25 +103,25 @@ __attribute__((section(".fini_array"),
                used)) static void (*__fini)(void) = __do_fini;
 #elif defined(__i386__) || defined(__x86_64__)
 __asm__(".pushsection .fini,\"ax\", at progbits\n\t"
-    "call " __USER_LABEL_PREFIX__ "__do_fini\n\t"
-    ".popsection");
+        "call __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 __do_fini\n\t"
+        ".popsection");
 #elif defined(__powerpc__) || defined(__powerpc64__)
 __asm__(".pushsection .fini,\"ax\", at progbits\n\t"
-    "bl " __USER_LABEL_PREFIX__ "__do_fini\n\t"
-    "nop\n\t"
-    ".popsection");
+        "bl __do_fini\n\t"
+        "nop\n\t"
+        ".popsection");
 #elif defined(__riscv)
 __asm__(".pushsection .fini,\"ax\", at progbits\n\t"
-        "call " __USER_LABEL_PREFIX__ "__do_fini\n\t"
+        "call __do_fini\n\t"
         ".popsection");
 #elif defined(__sparc__)
 __asm__(".pushsection .fini,\"ax\", at progbits\n\t"
-    "call " __USER_LABEL_PREFIX__ "__do_fini\n\t"
-    ".popsection");
+        "call __do_fini\n\t"
+        ".popsection");
 #else
 #error "crtbegin without .init_fini array unimplemented for this architecture"
 #endif  // CRT_HAS_INIT_FINI_ARRAY


        


More information about the llvm-commits mailing list