Emit a warning when -z relro is unsupported

Joseph Myers joseph@codesourcery.com
Tue Jul 28 23:00:38 GMT 2020


On Fri, 19 Jun 2020, Alan Modra via Binutils wrote:

> ld silently accepts -z relro and -z norelro for targets that lack the
> necessary GNU_RELRO support.  This patch makes those targets emit a
> warning instead, and adds testsuite infrastructure to detect when
> relro is unsupported.

This patch seems to have some effect beyond emitting a warning.

My glibc build bot is showing that building glibc for ia64-linux-gnu fails 
with GCC 9 and binutils 2.35 branch, when it succeeded with GCC 9 and 
binutils 2.34 branch.  The failure is an interal linker error linking 
libc.so:

/scratch/jmyers/glibc-bot/install/compilers/ia64-linux-gnu/lib/gcc/ia64-glibc-linux-gnu/9.3.1/../../../../ia64-glibc-linux-gnu/bin/ld: warning: -z relro ignored
/scratch/jmyers/glibc-bot/install/compilers/ia64-linux-gnu/lib/gcc/ia64-glibc-linux-gnu/9.3.1/../../../../ia64-glibc-linux-gnu/bin/ld: internal error /scratch/jmyers/glibc-bot/src/binutils/ld/ldwrite.c 212

That line is "ASSERT (output_section->owner == link_info.output_bfd);".  
Bisecting shows that this commit introduced the glibc build failure.

(I'm guessing the reason this appears with GCC 9 but not with GCC 10 is 
most likely to be the GCC 10 change to default to -fno-common perturbing 
the linking inputs sufficiently to avoid this internal error.  The only 
glibc bot I have using binutils master also uses GCC master, so I didn't 
see this error until the default for my bots using GCC release branches 
switched from binutils 2.34 branch to binutils 2.35 branch.)

-- 
Joseph S. Myers
joseph@codesourcery.com


More information about the Binutils mailing list