[PATCH] D13950: ELF2: Implement --gc-sections.

Joerg Sonnenberger via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 21 15:34:45 PDT 2015


joerg added a subscriber: joerg.

================
Comment at: ELF/MarkLive.cpp:67
@@ +66,3 @@
+static bool isReserved(StringRef S) {
+  return S.startswith(".ctors") || S.startswith(".dtors") ||
+         S.startswith(".fini") || S.startswith(".init") ||
----------------
ruiu wrote:
> rafael wrote:
> > Can you check anything other than the name? The section type or flags maybe?
> This list may be limited but I don't know what other sections need to be preserved.
> 
> gold seems to preserve more sections (https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=gold/object.cc;h=76d4630d16a8cfbe445f421250798c3438aa48e4;hb=HEAD#l353). I didn't copy that as I don't know the rational for some sections listed there.
Note sections are rather obvious, you shouldn't be getting a working binary on many platforms otherwise. Exceptions and JCR are similar. Preinit is a variant of the existing init theme.

I'm not sure why personality functions and nptl_version are special cased. The latter sounds like a glibc specific hack and personality functions should normally be referenced from the exception table. ARM issue perhaps?


http://reviews.llvm.org/D13950





More information about the llvm-commits mailing list