Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 02 Mar 2019 21:48:06 +0000
From:      bugzilla-noreply@freebsd.org
To:        toolchain@FreeBSD.org
Subject:   [Bug 236165] crash in malloc with ld.lld and -Wl,--export-dynamic -static
Message-ID:  <bug-236165-29464-dKbbHEVwSK@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-236165-29464@https.bugs.freebsd.org/bugzilla/>
References:  <bug-236165-29464@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D236165

Alex Richardson <arichardson@FreeBSD.org> changed:

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

--- Comment #2 from Alex Richardson <arichardson@FreeBSD.org> ---
We also ran into this problem in CheriBSD. The binary is actually static (b=
ut
file will report it as dynamically linked). However, it has a PT_DYNAMIC he=
ader
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 =3D=3D NULL)` is true the binary is statically linked and otherw=
ise 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 ar=
ound
to committing it since I'm not 100% sure what the correct behaviour is.

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

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-236165-29464-dKbbHEVwSK>