[Bug 236165] crash in malloc with ld.lld and -Wl,--export-dynamic -static

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[Bug 236165] crash in malloc with ld.lld and -Wl,--export-dynamic -static


Alex Richardson <[hidden email]> changed:

           What    |Removed                     |Added
                 CC|                            |[hidden email]

--- Comment #2 from Alex Richardson <[hidden email]> ---
We also ran into this problem in CheriBSD. The binary is actually static (but
file will report it as dynamically linked). However, it has a PT_DYNAMIC header
and the symbol _DYNAMIC does not resolve to zero. This causes these crashes
because there are various checks in libc, csu code, etc. that assume that `if
(&_DYNAMIC == NULL)` is true the binary is statically linked and otherwise it
assumes we are running a dynamic binary.
For our CHERI compilers I just modified ld.lld to not emit _DYNAMIC and the
PT_DYNAMIC header. I also attempted to upstream this fix but haven't got around
to committing it since I'm not 100% sure what the correct behaviour is.

See also https://reviews.llvm.org/D42748

You are receiving this mail because:
You are the assignee for the bug.
[hidden email] mailing list
To unsubscribe, send any mail to "[hidden email]"