public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: gcc@gcc.gnu.org, binutils@sourceware.org
Subject: [committed] exec-stack warning for test which wants executable stacks
Date: Sun, 24 Apr 2022 11:42:29 -0600	[thread overview]
Message-ID: <baa3a570-e405-5305-5c23-e2ed39cfff41@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1942 bytes --]

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.

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.

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


[-- Attachment #2: P --]
[-- Type: text/plain, Size: 1286 bytes --]

commit 6b7441a46c771aa6ecdc0c8ed96197417d036b9a
Author: Jeff Law <jeffreyalaw@gmail.com>
Date:   Sun Apr 24 13:38:14 2022 -0400

    [committed] exec-stack warning for test which wants executable stacks
    
    gcc/testsuite
            * gcc.dg/lto/pr94157_0.c: Also request executable stack from
            the linker.

diff --git a/gcc/testsuite/gcc.dg/lto/pr94157_0.c b/gcc/testsuite/gcc.dg/lto/pr94157_0.c
index a6e308b855b..a76141b1809 100644
--- a/gcc/testsuite/gcc.dg/lto/pr94157_0.c
+++ b/gcc/testsuite/gcc.dg/lto/pr94157_0.c
@@ -1,6 +1,6 @@
 /* { dg-lto-do link } */
 /* { dg-require-effective-target gas } */
-/* { dg-lto-options { { -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 } } } */
+/* { dg-lto-options { { -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 -Wl,-z,execstack} } } */
 
 int main() {
 

             reply	other threads:[~2022-04-24 17:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-24 17:42 Jeff Law [this message]
2022-04-25 12:56 ` Martin Liška
2022-04-25 14:37   ` Jeff Law
2022-04-25 14:42     ` Nick Clifton
2022-04-25 14:59       ` Jeff Law
2022-04-25 15:26         ` Nick Clifton
2022-04-25 15:30           ` Jeff Law
2022-05-26  1:17             ` Hans-Peter Nilsson
2022-05-26 23:17               ` Hans-Peter Nilsson
2022-04-26 13:54     ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=baa3a570-e405-5305-5c23-e2ed39cfff41@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).