I noticed that building this: ``` int x; int f (void) { return x; } ``` with: gcc `rpm --eval "%build_cflags %build_ldflags"` -m32 -fno-pic t.c -shared still produces an executable. There is a warning: /usr/bin/ld: warning: creating DT_TEXTREL in a shared object But exit status is zero, and there is an output file. I think we should ban text relocations in the same way we banned RWX segments. This is probably an item for after the mass rebuild. Reproducible: Always
Fixed in binutils-2.45.50-15.fc44 More specifically I have added a definable option to the binutils.spec file: # Enable the creation of relocations against the contents of read-only # sections (such as .text). This is a security vulnerability, so it is # disabled here by default. # Note - the upstream GNU Binutils sources enable the generation of this # kind of relocation by default, so this is a difference between Fedora # and upstream. %define enable_textrel 0
Just noting this broke ghc on i686. Though I have a new patch in hand to remove a hack that causes it (see bug 2430571). It may also have affected fpc.
FYI - for any future readers of this ticket: The simplest way to stop the linker from issuing this error message is to add "-Wl,-z,notext" to the command line.