Fix ARM __cxa_end_cleanup() and gc-sections.
This commit adds SHF_ALLOC and SHF_EXECINSTR section flags to
`.text.__cxa_end_cleanup` section. This fixes a link error when we are
using integrated-as and `ld.gold` (with `-Wl,--gc-sections` and
`-Wl,--fatal-warnings`.)
Detailed Explanation:
1. There might be some problem with LLVM integrated-as. It is not
emitting any section flags for text sections. (This will be fixed in
an independent commit.)
2. `ld.gold` will skip the external symbols in the section without
SHF_ALLOC. This is the reason why `.text.__cxa_end_cleanup_impl`
section is discarded even though it is referenced by
`__cxa_end_cleanup()`.
This commit workaround the problem by specifying the section flags
explicitly.
Fix http://llvm.org/PR21292
git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@256241 91177308-0d34-0410-b5e6-96231b3b80d8
(cherry picked from commit f67395cccae6049982ad67530f406624cc0445ac)
Change-Id: Id477f4d8aa159ee8cfe6640ecc66aa27afe574c6
diff --git a/src/cxa_exception.cpp b/src/cxa_exception.cpp
index ae2b39c..00faa1b 100644
--- a/src/cxa_exception.cpp
+++ b/src/cxa_exception.cpp
@@ -338,7 +338,7 @@
}
asm (
- " .pushsection .text.__cxa_end_cleanup\n"
+ " .pushsection .text.__cxa_end_cleanup,\"ax\",%progbits\n"
" .globl __cxa_end_cleanup\n"
" .type __cxa_end_cleanup,%function\n"
"__cxa_end_cleanup:\n"