[Bug ld/29072] ld silently make the program stack area executable if nested function is used

2022-04-25 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=29072

--- Comment #11 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Nick Clifton :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0d38576a34ec64a1b4500c9277a8e9d0f07e6774

commit 0d38576a34ec64a1b4500c9277a8e9d0f07e6774
Author: Nick Clifton 
Date:   Mon Apr 25 12:51:31 2022 +0100

Emit a note warning the user that creating an executable stack because of a
missing .note.GNU-stack section is deprecated.

PR 29072
bfd * elflink.c (bfd_elf_size_dynamic_sections): Display a note to the
user that the current ehaviour of creating an executable stack
because of a missing .note.GNU-stack section is deprecated and
will be changed in a future release.

binutils* testsuite/lib/binutils-common.exp (prune_warnings_extra): Filter
out notes about the executable stacjk behaviour beign deprecated.

ld  * testsuite/ld-elf/pr29072.b.warn: Update to include the note
about the linker's behaviour being depreccated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/29072] ld silently make the program stack area executable if nested function is used

2022-04-25 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=29072

H.J. Lu  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

--- Comment #12 from H.J. Lu  ---
I don't think we should issue a warning in this case:

[hjl@gnu-cfl-1 ld]$ cat /tmp/x.s 
.text
.globl  main
main:
.nops 1
.section.note.GNU-stack,"x",@progbits
[hjl@gnu-cfl-1 ld]$ gcc -c /tmp/x.s
[hjl@gnu-cfl-1 ld]$ ./ld-new -e main x.o
./ld-new: warning: x.o: requires executable stack (because the .note.GNU-stack
section is executable)
[hjl@gnu-cfl-1 ld]$

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/29072] ld silently make the program stack area executable if nested function is used

2022-04-25 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=29072

H.J. Lu  changed:

   What|Removed |Added

 Status|REOPENED|NEW

--- Comment #13 from H.J. Lu  ---
(In reply to H.J. Lu from comment #12)
> I don't think we should issue a warning in this case:
> 
> [hjl@gnu-cfl-1 ld]$ cat /tmp/x.s 
>   .text
>   .globl  main
> main:
>   .nops 1
>   .section.note.GNU-stack,"x",@progbits
> [hjl@gnu-cfl-1 ld]$ gcc -c /tmp/x.s
> [hjl@gnu-cfl-1 ld]$ ./ld-new -e main x.o
> ./ld-new: warning: x.o: requires executable stack (because the
> .note.GNU-stack section is executable)
> [hjl@gnu-cfl-1 ld]$

Shouldn't compiler issue the warning instead?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/29072] ld silently make the program stack area executable if nested function is used

2022-04-25 Thread nickc at redhat dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=29072

--- Comment #14 from Nick Clifton  ---

(In reply to H.J. Lu from comment #12)
> I don't think we should issue a warning in this case:

Why not ?  The original point of this PR was that an application can
gain an executable stack without the programmer being aware of it, simply
because an object file in the link requests one.  Providing a warning,
along with the name of the object file to blame, will allow the builder
to decide if they are OK with this, possibly unexpected, behaviour.


> Shouldn't compiler issue the warning instead?

Maybe - that is up to the compiler designers.  But the purpose of this
warning is to let application builders know that their app now has a
major security risk, and it may be because of an object file in a library
and nothing at all to do with files that they themselves maintain.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/29086] -Wl,--wrap=foo with LTO leads to undefined symbol

2022-04-25 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=29086

--- Comment #2 from H.J. Lu  ---
[hjl@gnu-tgl-3 pr29086]$ cat foo.S
.text
foo:
.nops 1

.data
.dc.a __real_foo
[hjl@gnu-tgl-3 pr29086]$ gcc -c foo.S
[hjl@gnu-tgl-3 pr29086]$ ld --wrap=foo foo.o
ld: warning: cannot find entry symbol _start; defaulting to 00401000
ld: foo.o:(.data+0x0): undefined reference to `foo'
[hjl@gnu-tgl-3 pr29086]$

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/29072] ld silently make the program stack area executable if nested function is used

2022-04-25 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=29072

--- Comment #15 from H.J. Lu  ---
Is the goal to remove nested functions?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/29087] "non-canonical reference to canonical protected function" with protected visibility, -mno-direct-extern-access and virtual functions

2022-04-25 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=29087

--- Comment #1 from H.J. Lu  ---
Created attachment 14079
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14079&action=edit
Please try this

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/29087] "non-canonical reference to canonical protected function" with protected visibility, -mno-direct-extern-access and virtual functions

2022-04-25 Thread thiago at kde dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=29087

--- Comment #2 from Thiago Macieira  ---
(In reply to H.J. Lu from comment #1)
> Created attachment 14079 [details]
> Please try this

Works on the testcase. Testing now the original content.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/29087] "non-canonical reference to canonical protected function" with protected visibility, -mno-direct-extern-access and virtual functions

2022-04-25 Thread thiago at kde dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=29087

--- Comment #3 from Thiago Macieira  ---
Build successful (Qt 6.4 + GCC 12 + Binutils 2.38 with this patch)

-- 
You are receiving this mail because:
You are on the CC list for the bug.