[Bug ld/30437] aarch64: RELA relocations don't ignore section content as they should

2023-05-23 Thread matz at suse dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=30437

Michael Matz  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Michael Matz  ---
Fixed in master.

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


[Bug ld/30437] aarch64: RELA relocations don't ignore section content as they should

2023-05-23 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=30437

--- Comment #3 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Michael Matz :

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

commit 13a3cad698b3a757b1fcc938cc33e09a364ea47a
Author: Michael Matz 
Date:   Tue May 9 17:48:01 2023 +0200

PR30437 aarch64: make RELA relocs idempotent

normally RELA relocs in BFD should not consider the contents of the
relocated place.  The aarch64 psABI is even stricter, it specifies
(section 5.7.16) that all RELA relocs _must_ be idempotent.

Since the inception of the aarch64 BFD backend all the relocs have a
non-zero src_mask, and hence break this invariant.  It's normally not
a very visible problem as one can see it only when the relocated place
already contains a non-zero value, which usually only happens sometimes
when using 'ld -r' (or as in the testcase when jumping through hoops to
generate the relocations).  Or with alternative toolchains that do encode
stuff in the relocated places with the assumption that a relocation
to that place ignores whatever is there (as they can according to
the psABI).

Golang is such a toolchain and https://github.com/golang/go/issues/39927
is ultimately caused by this problem: the testcase testGCData failing
is caused by the garbage collection data-structure to describe a type
containing pointers to be wrong.  It's wrong because a field that's
supposed to contain a file-relative offset (to some gcbits) has a
relocation applied and that relocation has an addend which also is
already part of the go-produced object file (so the addend is
implicitely applied twice).

bfd/
PR ld/30437
* elfnn-aarch64.c (elfNN_aarch64_howto_table): Clear src_mask
if all relocation descriptors.

ld/
* testsuite/ld-aarch64/rela-idempotent.s: New testcase.
* testsuite/ld-aarch64/rela-idempotent.d: New.
* testsuite/ld-aarch64/aarch64-elf.exp: Run it.

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


[Bug ld/25694] R_RISCV_TPREL_HI20 relocations cause riscv64 to add TEXTREL bit on executables

2023-05-23 Thread sch...@linux-m68k.org
https://sourceware.org/bugzilla/show_bug.cgi?id=25694

--- Comment #5 from Andreas Schwab  ---
This still generates a spurious R_RISCV_NONE relocation for the pr22263-1 test.

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


[Bug ld/22263] -fpie -pie generates dynamic relocations in text section

2023-05-23 Thread sch...@linux-m68k.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22263

Andreas Schwab  changed:

   What|Removed |Added

   See Also||https://sourceware.org/bugz
   ||illa/show_bug.cgi?id=25694

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


[Bug ld/25694] R_RISCV_TPREL_HI20 relocations cause riscv64 to add TEXTREL bit on executables

2023-05-23 Thread sch...@linux-m68k.org
https://sourceware.org/bugzilla/show_bug.cgi?id=25694

Andreas Schwab  changed:

   What|Removed |Added

   See Also||https://sourceware.org/bugz
   ||illa/show_bug.cgi?id=22263

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


[Bug ld/22263] -fpie -pie generates dynamic relocations in text section

2023-05-23 Thread sch...@linux-m68k.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22263

Andreas Schwab  changed:

   What|Removed |Added

 Target|tilegx,tilepro,sparc,alpha  |tilegx,tilepro,sparc,alpha,
   ||riscv

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