[PATCH] D15613: Fix ARM __cxa_end_cleanup() and gc-sections.

Logan Chien via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 17 07:42:31 PST 2015


logan created this revision.
logan added reviewers: rengolin, danalbert, kevin.qin, echristo, srhines.
logan added a subscriber: cfe-commits.
Herald added subscribers: rengolin, aemerson.

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 issue with LLVM integrated-as, so that there is
   no default 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 flag
explicitly.

Fix http://llvm.org/PR21292

http://reviews.llvm.org/D15613

Files:
  src/cxa_exception.cpp

Index: src/cxa_exception.cpp
===================================================================
--- src/cxa_exception.cpp
+++ src/cxa_exception.cpp
@@ -334,7 +334,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"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15613.43144.patch
Type: text/x-patch
Size: 399 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151217/45bdfc63/attachment.bin>


More information about the cfe-commits mailing list