[Bug ld/29994] ld fails to generate NOTE segment (with Build ID) on aarch64 if -z execstack or -z noexecstack

2023-01-13 Thread tom.saeger at oracle dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=29994

--- Comment #2 from Tom Saeger  ---
(In reply to Andreas Schwab from comment #1)
> This is a bug in the linker script, see
> https://lore.kernel.org/all/20221226184537.744960-1-masahi...@kernel.org/

Thank you!  Indeed applying this patch to stable v5.15.86 also fixes Build ID.

This bug should be closed.

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


[Bug ld/29994] ld fails to generate NOTE segment (with Build ID) on aarch64 if -z execstack or -z noexecstack

2023-01-13 Thread tom.saeger at oracle dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=29994

Tom Saeger  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |NOTABUG

--- Comment #3 from Tom Saeger  ---
The problem in fact was resolved by the linker script change linked above.

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


[Bug ld/29994] New: ld fails to generate NOTE segment (with Build ID) on aarch64 if -z execstack or -z noexecstack

2023-01-12 Thread tom.saeger at oracle dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=29994

Bug ID: 29994
   Summary: ld fails to generate NOTE segment (with Build ID) on
aarch64 if -z execstack or -z noexecstack
   Product: binutils
   Version: 2.39
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: tom.saeger at oracle dot com
  Target Milestone: ---

This issue was discovered while building linux-stable 5.15.y on aarch64.
Introduced into 5.15.y by 
4c7ee827da2c ("Makefile: link with -z noexecstack --no-warn-rwx-segments")
which is a backport of
0d362be5b142 ("Makefile: link with -z noexecstack --no-warn-rwx-segments")

Discussions for context:
- https://lore.kernel.org/all/cover.1670358255.git.tom.sae...@oracle.com/#r
-
https://lore.kernel.org/all/3df32572ec7016e783d37e185f88495831671f5d.1671143628.git.tom.sae...@oracle.com/


The tool-flow within 5.15.y linux kernels, when configured with
CONFIG_MODVERSIONS is roughly:

1. gcc head.S -> head.o
2. ld -z noexecstack head.o -> .tmp_head.o
3. mv -f .tmp_head.o head.o
4. ld -o vmlinux --whole-archive arch/arm64/kernel/head.o ...

After 4c7ee827da2c, on aarch64 the resulting vmlinux does not have a NOTE
segment which contains the Build ID.
This seems unique to aarch64 and ld.
x86_64 works.
aarch64 llvm works.

If step 2 above uses -z execstack - it still fails.

However, removing -z noexecstack from step 2. in my testing works-around this
issue. 


Reproduction steps (on aarch64 system):

git clone -b v5.15.61 --depth=1
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
make ARCH=arm64 defconfig
scripts/config -e MODVERSIONS
make ARCH=arm64 olddefconfig
make ARCH=arm64 V=1 -j16 vmlinux
readelf -n vmlinux

ld versions 2.36, 2.37, 2.38, and 2.39 all exhibited this same behavior.

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