https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117739
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|gcc -fhardened -Wl,-z,lazy |`-fhardened -Wl,-z,lazy` |unexpectadly links binary |still passes `-z now` to |with immediate binding (-z |the linker |now) | --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- There is code in the driver to disable adding `-z now -z relro` but it looks like it is not working for some reason: if (!any_link_options_p && !static_p) { #if defined HAVE_LD_PIE && defined LD_PIE_SPEC save_switch (LD_PIE_SPEC, 0, NULL, /*validated=*/true, /*known=*/false); #endif /* These are passed straight down to collect2 so we have to break it up like this. */ if (HAVE_LD_NOW_SUPPORT) { add_infile ("-z", "*"); add_infile ("now", "*"); } if (HAVE_LD_RELRO_SUPPORT) { add_infile ("-z", "*"); add_infile ("relro", "*"); } } Oh any_link_options_p just means -r, -shared, -no-pie, -pie was passed. It does not include -Wl, options.