[Bug ld/31895] New: LD segfault in libbfd

2024-06-14 Thread corentin.silvapere...@4d-virtualiz.com
https://sourceware.org/bugzilla/show_bug.cgi?id=31895

Bug ID: 31895
   Summary: LD segfault in libbfd
   Product: binutils
   Version: 2.34
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: corentin.silvapere...@4d-virtualiz.com
  Target Milestone: ---

Hi,

Recently i have some problems while compiling softwares. I'm on Ubuntu 20.04
but i had the same problem on Ubuntu 24.04. I often have this message
"collect2: fatal error: ld terminated with signal 11 [Erreur de segmentation],
core dumped" when compiling, and i've looked in dmesg to find an explanation.
Here's what dmesg gave me :

[27357.364350] ld[516146]: segfault at 1fb79 ip 7f108e72b0f6 sp
7ffc282a3030 error 4 in libbfd-2.34-system.so[7f108e6dc000+b1000]
[27357.364357] Code: ed 75 27 e9 6a d3 ff ff 0f 1f 40 00 0f b6 42 19 83 e3 01
01 db 83 e0 fd 09 c3 88 5a 19 48 8b 6d 00 48 85 ed 0f 84 48 d3 ff ff <0f> b6 55
18 48 89 e8 80 fa 07 75 08 48 8b 45 28 0f b6 50 18 45 31

[27599.972532] ld[543684]: segfault at 0 ip 7f65d770fac4 sp
7ffccb357fe8 error 4 in libbfd-2.34-system.so[7f65d76de000+b1000]
[27599.972541] Code: 48 21 f0 48 83 c1 01 48 31 d0 0f b6 51 ff 84 d2 75 d8 89
c0 c3 90 31 c0 c3 66 66 2e 0f 1f 84 00 00 00 00 00 66 90 f3 0f 1e fa <0f> b6 17
48 8d 77 01 b8 05 15 00 00 84 d2 74 2c 0f 1f 40 00 48 89

[28912.103007] ld[712964]: segfault at 0 ip 7f9baddfbac4 sp
7ffdcea71148 error 4 in libbfd-2.34-system.so[7f9baddca000+b1000]
[28912.103016] Code: 48 21 f0 48 83 c1 01 48 31 d0 0f b6 51 ff 84 d2 75 d8 89
c0 c3 90 31 c0 c3 66 66 2e 0f 1f 84 00 00 00 00 00 66 90 f3 0f 1e fa <0f> b6 17
48 8d 77 01 b8 05 15 00 00 84 d2 74 2c 0f 1f 40 00 48 89

[29086.396713] ld[716997]: segfault at c9 ip 7f330b1b4133 sp
7ffc8ea24e90 error 4 in libbfd-2.34-system.so[7f330b165000+b1000]
[29086.396719] Code: 18 45 31 e4 45 31 ed 80 fa 05 75 0b 48 8b 50 28 4c 8b 68
30 44 8b 22 41 8b 56 20 0f b6 58 19 4c 89 fe 48 89 ef e8 8d 3d fb ff <45> 8b 46
20 0f b6 45 18 d0 eb 83 e3 01 48 89 ea 4d 01 c7 3c 07 74



I've already tried to re-install binutils, gcc, installed a superior version of
gcc (was on 9.4.0 and tried 10.5.0), and did some research about those errors
but i can't find anything useful. Maybe you have an idea ?

Best regards

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


[Bug ld/30907] ELF segment add extra 2 LOAD segments in aarch64, making binary bigger 128KiB than before

2024-06-14 Thread nickc at redhat dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30907

Nick Clifton  changed:

   What|Removed |Added

   Last reconfirmed||2024-06-14
 Status|UNCONFIRMED |WAITING
 Ever confirmed|0   |1

--- Comment #8 from Nick Clifton  ---
Hi Nilus, Hi Fanguri,

I have checked in e8e10743f7b to add a --rosegment option the linker.  This
should address the size increase when -z separate-code is used.

I am setting the state of this PR to 'waiting' as the patch is still brand new
and there may well be problems with it that I have not anticipated.

Cheers
  Nick

PS. I have also committed 54904469f71 to fix some test case issues when the new
option is enabled by default.

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


Re: PE section extension

2024-06-14 Thread Joachim Schiele

On 2024-06-05 15:15, Nick Clifton wrote:

Hi Joachim,

I'd like to extend the ld generated PE section with a custom section 
called .store in analogy to .idata and I would love a little guidance 
where to make this change.


I would recommend that rather than doing this in the linker, you
perform it as an additional step after the linking has completed,
using objcopy's --add-section command line option.  This means
that the solution will work with the current tools, and it will
give you a chance to post-process the linked binary to extract
any information that you need to store into the new section.

If you do want to use the linker, then the first place to look
is the linker script ld/scripttemp/pep.sc.  This is where you
should place a definition of the new section.


Your idea also sounds interesting. In the meantime i built a lld 
prototype, created a fixPath tool in rust and documented it in my blog:


* 
https://github.com/llvm/llvm-project/compare/release/18.x...qknight:llvm-project:libnix_PE-fixPath

* https://github.com/nixcloud/fixPath
* https://lastlog.de/blog/libnix_fixPath.html

I don't know ld very well, would someone here be interested in 
implementing the change i did for lld in ld? I'd pay for that, please 
give me a quote on how much that would cost to j...@lastlog.de directly.



The new field must be generated after the idata has been generated.


Which as I assume you have discovered is done inside ld/pe-dll.c.


In addition I need to know where the dllname name, foo.dll is 
generated as I need to change this as well to reserve like 300 more 
chars for later changes of said dllname.


I am not sure what you mean here, but probably the code you are
looking for is in ld/emultempl/pe.em and/or ld/emultempl/pep.em.
Either there or bfd/peicode.h.

Cheers
  Nick


Thanks & regards,
Joachim



[Bug ld/31868] Provide diagnostic option for ISA marker notes

2024-06-14 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=31868

--- Comment #4 from Sourceware Commits  ---
The master branch has been updated by H.J. Lu :

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

commit 93548ee191ff95cae0592363b579c6addb0b151d
Author: H.J. Lu 
Date:   Tue Jun 11 20:55:05 2024 -0700

x86: Add -z isa-level-report=[none|all|needed|used]

Add -z isa-level-report=[none|all|needed|used] to the x86 ELF linker to
report needed and used x86-64 ISA levels.

bfd/

PR ld/31868
* elf-linker-x86.h (elf_x86_isa_level_report): New.
(elf_linker_x86_params): Add isa_level_report.
* elfxx-x86.c (report_isa_level): New.
(_bfd_x86_elf_link_setup_gnu_properties): Check
-z isa-level-report=[none|all|needed|used] to report needed and
used x86-64 ISA level.

ld/

PR ld/31868
* NEWS: Mention -z isa-level-report=[none|all|needed|used].
* ld.texi: Document -z isa-level-report=[none|all|needed|used].
* emulparams/elf32_x86_64.sh: Source x86-64-level-report.sh.
* emulparams/elf_i386.sh: Likewise.
* emulparams/elf_x86_64.sh: Likewise.
* emulparams/x86-64-level-report.sh: New file.
* testsuite/ld-i386/pr31868a.d: Likewise.
* testsuite/ld-i386/pr31868b.d: Likewise.
* testsuite/ld-i386/pr31868c.d: Likewise.
* testsuite/ld-x86-64/pr31868a-x32.d: Likewise.
* testsuite/ld-x86-64/pr31868a.d: Likewise.
* testsuite/ld-x86-64/pr31868a.l: Likewise.
* testsuite/ld-x86-64/pr31868a.s: Likewise.
* testsuite/ld-x86-64/pr31868b-x32.d: Likewise.
* testsuite/ld-x86-64/pr31868b.d: Likewise.
* testsuite/ld-x86-64/pr31868b.l: Likewise.
* testsuite/ld-x86-64/pr31868b.s: Likewise.
* testsuite/ld-x86-64/pr31868c-x32.d: Likewise.
* testsuite/ld-x86-64/pr31868c.d: Likewise.
* testsuite/ld-x86-64/pr31868c.l: Likewise.
* testsuite/ld-i386/i386.exp: Run PR ld/31868 tests.
* testsuite/ld-x86-64/x86-64.exp: Likewise.

Signed-off-by: H.J. Lu 

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


[Bug ld/31868] Provide diagnostic option for ISA marker notes

2024-06-14 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=31868

H.J. Lu  changed:

   What|Removed |Added

 Resolution|--- |FIXED
   Target Milestone|--- |2.43
 Status|NEW |RESOLVED

--- Comment #5 from H.J. Lu  ---
Fixed.

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