[libcxxabi] r256241 - Fix ARM __cxa_end_cleanup() and gc-sections.

Logan Chien via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 22 06:38:31 PST 2015


Author: logan
Date: Tue Dec 22 08:38:30 2015
New Revision: 256241

URL: http://llvm.org/viewvc/llvm-project?rev=256241&view=rev
Log:
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

Modified:
    libcxxabi/trunk/src/cxa_exception.cpp

Modified: libcxxabi/trunk/src/cxa_exception.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_exception.cpp?rev=256241&r1=256240&r2=256241&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_exception.cpp (original)
+++ libcxxabi/trunk/src/cxa_exception.cpp Tue Dec 22 08:38:30 2015
@@ -334,7 +334,7 @@ __cxa_end_cleanup_impl()
 }
 
 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"




More information about the cfe-commits mailing list