Skip to content

Commit 17427ec

Browse files
spacemonkeydeliversEccoTheDolphin
authored andcommitted
[RISCV][crt] support building without init_array
Reviewed By: luismarques, phosek, kito-cheng Differential Revision: https://reviews.llvm.org/D87997
1 parent 10b164d commit 17427ec

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

compiler-rt/lib/crt/crtbegin.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ __attribute__((section(".init_array"),
5252
__asm__(".pushsection .init,\"ax\",@progbits\n\t"
5353
"call " __USER_LABEL_PREFIX__ "__do_init\n\t"
5454
".popsection");
55+
#elif defined(__riscv)
56+
__asm__(".pushsection .init,\"ax\",%progbits\n\t"
57+
"call " __USER_LABEL_PREFIX__ "__do_init\n\t"
58+
".popsection");
5559
#elif defined(__arm__) || defined(__aarch64__)
5660
__asm__(".pushsection .init,\"ax\",%progbits\n\t"
5761
"bl " __USER_LABEL_PREFIX__ "__do_init\n\t"
@@ -110,6 +114,10 @@ __asm__(".pushsection .fini,\"ax\",@progbits\n\t"
110114
"bl " __USER_LABEL_PREFIX__ "__do_fini\n\t"
111115
"nop\n\t"
112116
".popsection");
117+
#elif defined(__riscv)
118+
__asm__(".pushsection .fini,\"ax\",@progbits\n\t"
119+
"call " __USER_LABEL_PREFIX__ "__do_fini\n\t"
120+
".popsection");
113121
#elif defined(__sparc__)
114122
__asm__(".pushsection .fini,\"ax\",@progbits\n\t"
115123
"call " __USER_LABEL_PREFIX__ "__do_fini\n\t"

0 commit comments

Comments
 (0)