Florian Weimer writes: > * Arsen Arsenović via Libc-alpha: > >> Some toolchains, such as that used on Gentoo Hardened, set -z now -z >> relro out of the box. These flags break tests that rely on fixups in >> underlinked libraries being applied after a dlopen happens. > > I'm surprised that -z norelro is ever required. Why isn't -z lazy > enough? If ld.so crashes because it attempts to apply relocations after > the fact, woudln't that be an ld.so bug (or a linker bug that sets up > the RELRO segment incorrectly)? Hm. Something went awry while I was debugging this. I looked at a test again just now and noticed that the symbols some of these tests were crashing on came from libc (dlopen here) while loading constload2 (which is dlopen'd from constload1). The backtrace contains a PLT trampoline which then fixups dlopen inside the RELRO segment. I take it dlopen@got[plt] is not supposed to be in the RELRO range? I could have sworn this failed when fixing up bar (void) as a result of constload2 dlopening constload3... but maybe that was a different failure. Let's put this patch on hold while I investigate further. FWIW, this should be easy to reproduce by building with CC='gcc -Wl,-z,relro,-z,now' or so, I think. Thanks, sorry about the fuss. -- Arsen Arsenović