[committed] exec-stack warning for test which wants executable stacks

Martin Liška mliska@suse.cz
Mon Apr 25 12:56:29 GMT 2022


On 4/24/22 19:42, Jeff Law via Gcc wrote:
> About a week ago many targets started failing pr94157_0.c test like this (bfin-elf, but many other targets are also affected):
> 
>> spawn -ignore SIGHUP /home/jlaw/test/obj/bfin-elf/obj/gcc/gcc/xgcc -B/home/jlaw/test/obj/bfin-elf/obj/gcc/gcc/ c_lto_pr94157_0.o -fdiagnostics-plain-output -dumpbase  -O0 -fipa-vrp -flto -Wa,--noexecstack -Wa,--noexecstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -msim -Wl,-wrap,exit -Wl,-wrap,_exit -Wl,-wrap,main -Wl,-wrap,abort -Wl,gcc_tg.o -o gcc-dg-lto-pr94157-01.exe^M
>> /home/jlaw/test/obj/bfin-elf/installed/bfin-elf/bin/ld: warning: /tmp/ccfJUEvZ.ltrans0.ltrans.o: requires executable stack (because the .note.GNU-stack section is executable)^M
>> FAIL: gcc.dg/lto/pr94157 c_lto_pr94157_0.o-c_lto_pr94157_0.o link,  -O0 -fipa-vrp -flto -Wa,--noexecstack -Wa,--noexecstack -Wa,--execstack  -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack
> 
> This is due to a new binutils warning.  This patch just suppresses the warning for the one test where we explicitly wanted an executable stack.
> 
> I'm guessing the repeated -Wa,--noexecstack options in this test are supposed to trigger a  buffer overflow or something similar, so I left those alone and just appended to the argument list.

Yes.

> 
> I used -z execstack rather than --no-warn-execstack as the former is recognized by older versions of ld, but the latter is a new option.

Thanks for it.

Martin

> 
> The other approach would have been to prune the warning, but this seemed better since we'd like most tests to fail if somehow their stacks were executable.
> 
> 
> Committed to the trunk.
> 
> Jeff
> 



More information about the Gcc mailing list