[PATCH] D28791: [compiler-rt][crt] Simple crtbegin and crtend implementation
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 6 18:04:38 PST 2019
MaskRay accepted this revision.
MaskRay added a comment.
The current division (`crtbegin_shared.o` (`-shared` or `-pie`) `crtbegin.o` (others)) resembles what NetBSD and OpenBSD do. They don't have a separate `crtbeginT.o`. I don't understand why in a 2012 change FreeBSD added `crtbeginT.o`...
I casually asked dalias to confirm my thoughts. He thinks `crtbegin.o` belongs to the compiler runtime side rather than libc ("its purely a mechanism for weird language runtimes the compiler supports; libc has no use for it or relation to it").
He also agrees that unifying all 3 `crtbegin{,S,T}.o` should be possible ("there is no reason for any version but the pic-compatible (S) one to exist. others just make logic of which to link complex for no reason").
(((That could expose some bugs in existing bug-behevior depending applications, though: I believe glibc still has the bug (or at least an unexpected behavior) that for a `-pie -fPIE` executable, `__cxa_finalizer(main's __dso_handle)` is called before `__cxa_finalizer(a depending DSO's __dso_handle)`. Making `void *__dso_handle = &__dso_handle` for non `-pie` non `-shared` builds may reveal some bugs..)))
Now I more firmly believe that this patch moves towards the correct direction to make compiler-rt a better replacement of libgcc while also paying back some tech debt. Still LG!
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D28791/new/
https://reviews.llvm.org/D28791
More information about the llvm-commits
mailing list