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

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sat Mar 2 21:48:09 UTC 2019


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236165

Alex Richardson <arichardson at FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |arichardson at FreeBSD.org

--- Comment #2 from Alex Richardson <arichardson at FreeBSD.org> ---
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.


More information about the freebsd-toolchain mailing list