[compiler-rt] 17427ec - [RISCV][crt] support building without init_array

via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 1 06:18:19 PST 2020


Author: Alexey Baturo
Date: 2020-12-01T17:17:50+03:00
New Revision: 17427ec3f31c2a95c106dbaa98c43b72a7c06a31

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

LOG: [RISCV][crt] support building without init_array

Reviewed By: luismarques, phosek, kito-cheng

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

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 24bea1a2c3a7..481c158ac777 100644
--- a/compiler-rt/lib/crt/crtbegin.c
+++ b/compiler-rt/lib/crt/crtbegin.c
@@ -52,6 +52,10 @@ __attribute__((section(".init_array"),
 __asm__(".pushsection .init,\"ax\", at progbits\n\t"
     "call " __USER_LABEL_PREFIX__ "__do_init\n\t"
     ".popsection");
+#elif defined(__riscv)
+__asm__(".pushsection .init,\"ax\",%progbits\n\t"
+        "call " __USER_LABEL_PREFIX__ "__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"
@@ -110,6 +114,10 @@ __asm__(".pushsection .fini,\"ax\", at progbits\n\t"
     "bl " __USER_LABEL_PREFIX__ "__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"
+        ".popsection");
 #elif defined(__sparc__)
 __asm__(".pushsection .fini,\"ax\", at progbits\n\t"
     "call " __USER_LABEL_PREFIX__ "__do_fini\n\t"


        


More information about the llvm-commits mailing list