summaryrefslogtreecommitdiffstats
path: root/compiler-rt
diff options
context:
space:
mode:
authorSterling Augustine <saugustine@google.com>2019-12-18 11:15:32 -0800
committerSterling Augustine <saugustine@google.com>2019-12-18 13:37:08 -0800
commit5789e83dedb97588ad75cca36d01ba6c5142d6d3 (patch)
tree154e1709b43b0dcac53fe3109cb2c9e8169007bb /compiler-rt
parent4121399c12292ef445cc3be6ea15c5316ac17d16 (diff)
downloadbcm5719-llvm-5789e83dedb97588ad75cca36d01ba6c5142d6d3.tar.gz
bcm5719-llvm-5789e83dedb97588ad75cca36d01ba6c5142d6d3.zip
Support powerpc when builing without init_array.
Summary: Also add an error case when targetting an unimplement architecture. Subscribers: nemanjai, jsji, shchenz, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D71670
Diffstat (limited to 'compiler-rt')
-rw-r--r--compiler-rt/lib/crt/crtbegin.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/compiler-rt/lib/crt/crtbegin.c b/compiler-rt/lib/crt/crtbegin.c
index 5b56ea3df75..812cea4143f 100644
--- a/compiler-rt/lib/crt/crtbegin.c
+++ b/compiler-rt/lib/crt/crtbegin.c
@@ -57,8 +57,15 @@ __asm__(".pushsection .init,\"ax\",@progbits\n\t"
__asm__(".pushsection .init,\"ax\",%progbits\n\t"
"bl " __USER_LABEL_PREFIX__ "__do_init\n\t"
".popsection");
-#endif // CRT_HAS_INITFINI_ARRAY
-#endif
+#elif defined(__powerpc__) || defined(__powerpc64__)
+__asm__(".pushsection .init,\"ax\",@progbits\n\t"
+ "bl " __USER_LABEL_PREFIX__ "__do_init\n\t"
+ "nop\n\t"
+ ".popsection");
+#else
+#error "crtbegin without .init_fini array unimplemented for this architecture"
+#endif // defined(various architectures)
+#endif // CRT_HAS_INITFINI_ARRAY
#ifndef CRT_HAS_INITFINI_ARRAY
static fp __DTOR_LIST__[]
@@ -97,5 +104,12 @@ __asm__(".pushsection .fini,\"ax\",@progbits\n\t"
__asm__(".pushsection .fini,\"ax\",%progbits\n\t"
"bl " __USER_LABEL_PREFIX__ "__do_fini\n\t"
".popsection");
-#endif
+#elif defined(__powerpc__) || defined(__powerpc64__)
+__asm__(".pushsection .fini,\"ax\",@progbits\n\t"
+ "bl " __USER_LABEL_PREFIX__ "__do_fini\n\t"
+ "nop\n\t"
+ ".popsection");
+#else
+#error "crtbegin without .init_fini array unimplemented for this architecture"
+#endif // defined(various architectures)
#endif // CRT_HAS_INIT_FINI_ARRAY
OpenPOWER on IntegriCloud