[PATCH] D15767: [lld/ELF] Don't reclaim .ctors/.dtors

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 24 01:27:53 PST 2015

davide added a comment.

hmm, OK, maybe this is a sledgehammer.
rtld expects .ctors containing -1 (0xffffffff), and a .ctors section containing the correct bits is provided to the linker as input (/usr/lib/crtbegin.o)

Contents of section .ctors:
 0000 ffffffff ffffffff                    ........

So, my understading is that this is just a marker and it's never referenced. rtld uses it to stop walking the .ctor section on startup. In an non-broken executable (or similarly, on an lld-generated executable without --gc-sections) these bits are included in the final output, while without this patch, they're not if I pass --gc-sections.

Could it be a bug in the garbage collector?


More information about the llvm-commits mailing list