[Bug ld/31608] collect2: fatal error: ld terminated with signal 11 [Segmentation fault]

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

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

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

commit 37eac4810b66f165ed5bb837ac36c0eb9baba727
Author: H.J. Lu 
Date:   Thu Apr 4 18:05:57 2024 -0700

bfd: Munmap readonly memory after bfd_free_cached_info

Munmap readonly memory after bfd_free_cached_info which may use munmapped
readonly memory.

PR ld/31608
* opncls.c (_bfd_delete_bfd): Munmap readonly memory after
bfd_free_cached_info.

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


[Bug binutils/31605] [readelf, -wL] Highlight empty address range

2024-04-04 Thread sam at gentoo dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=31605

Sam James  changed:

   What|Removed |Added

 CC||sam at gentoo dot org

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


[Bug ld/31608] collect2: fatal error: ld terminated with signal 11 [Segmentation fault]

2024-04-04 Thread sam at gentoo dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=31608

--- Comment #5 from Sam James  ---
It's a shame I didn't hit this and the other bits. I did test it quite heavily
on amd64 but I didn't try other arches. In future, I can do that.

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


[Bug ld/31608] collect2: fatal error: ld terminated with signal 11 [Segmentation fault]

2024-04-04 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=31608

--- Comment #4 from Alan Modra  ---
Like this.  I don't see this problem myself, so kind of untested.  You probably
need a libstdc++.so that has been built with -ffunction-sections and thus a
large enough .shstrtab to be mmaped.

diff --git a/bfd/opncls.c b/bfd/opncls.c
index 5efec37175e..dda3f1ef300 100644
--- a/bfd/opncls.c
+++ b/bfd/opncls.c
@@ -172,7 +172,13 @@ _bfd_delete_bfd (bfd *abfd)
  munmap (elf_section_data (sec)->contents_addr,
  elf_section_data (sec)->contents_size);
 }
+#endif
+
+  /* Give the target _bfd_free_cached_info a chance to free memory.  */
+  if (abfd->memory && abfd->xvec)
+bfd_free_cached_info (abfd);

+#ifdef USE_MMAP
   struct bfd_mmapped *mmapped, *next;
   for (mmapped = abfd->mmapped; mmapped != NULL; mmapped = next)
 {
@@ -184,10 +190,6 @@ _bfd_delete_bfd (bfd *abfd)
 }
 #endif

-  /* Give the target _bfd_free_cached_info a chance to free memory.  */
-  if (abfd->memory && abfd->xvec)
-bfd_free_cached_info (abfd);
-
   /* The target _bfd_free_cached_info may not have done anything..  */
   if (abfd->memory)
 {

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


[Bug ld/31608] collect2: fatal error: ld terminated with signal 11 [Segmentation fault]

2024-04-04 Thread sam at gentoo dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=31608

Sam James  changed:

   What|Removed |Added

 CC||sam at gentoo dot org

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


[Bug ld/31608] collect2: fatal error: ld terminated with signal 11 [Segmentation fault]

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

--- Comment #3 from H.J. Lu  ---
(In reply to Alan Modra from comment #2)
> OK, so bfd_get_section_by_name is accessing unmapped memory.  I think we
> just need to move the call to bfd_free_cached_info in _bfd_delete_bfd before
> you unmap.

I am testing a patch.

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


[Bug ld/31608] collect2: fatal error: ld terminated with signal 11 [Segmentation fault]

2024-04-04 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=31608

--- Comment #2 from Alan Modra  ---
OK, so bfd_get_section_by_name is accessing unmapped memory.  I think we just
need to move the call to bfd_free_cached_info in _bfd_delete_bfd before you
unmap.

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


[Bug ld/31608] collect2: fatal error: ld terminated with signal 11 [Segmentation fault]

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

H.J. Lu  changed:

   What|Removed |Added

   Target Milestone|--- |2.43
   Assignee|unassigned at sourceware dot org   |hjl.tools at gmail dot 
com

--- Comment #1 from H.J. Lu  ---
It is caused by

commit 9ba56acee518492cfe21434b974c807f52ac7950
Author: H.J. Lu 
Date:   Thu Feb 29 11:17:01 2024 -0800

elf: Use mmap to map in read-only sections

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


[Bug ld/31608] New: collect2: fatal error: ld terminated with signal 11 [Segmentation fault]

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

Bug ID: 31608
   Summary: collect2: fatal error: ld terminated with signal 11
[Segmentation fault]
   Product: binutils
   Version: 2.43 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: hjl.tools at gmail dot com
  Target Milestone: ---
Target: powerpc64-linux

Linker segfaults during linking libstdc++ for powerpc64-linux-gnu in glibc
build-many-glibcs.py, when using binutils and GCC mainline:

Program received signal SIGSEGV, Segmentation fault.
0x77e5d1f6 in __strcmp_evex () from /lib64/libc.so.6
Missing separate debuginfos, use: dnf debuginfo-install
glibc-2.38-17.0.fc39.x86_64 libzstd-1.5.6-1.fc39.x86_64
zlib-1.2.13-4.0.fc39.x86_64
(gdb) f 1
#1  0x0045527e in bfd_hash_lookup (table=0x8906e8, 
string=0x700dc2 ".opd", create=false, copy=false)
at /export/gnu/import/git/gitlab/x86-binutils/bfd/hash.c:564
564   && strcmp (hashp->string, string) == 0)
(gdb) p hashp
$1 = (struct bfd_hash_entry *) 0x8da1c0
(gdb) p ashp->string
No symbol "ashp" in current context.
(gdb) p hashp->string
$2 = 0x77fb1b73 
(gdb) bt
#0  0x77e5d1f6 in __strcmp_evex () from /lib64/libc.so.6
#1  0x0045527e in bfd_hash_lookup (table=0x8906e8, 
string=0x700dc2 ".opd", create=false, copy=false)
at /export/gnu/import/git/gitlab/x86-binutils/bfd/hash.c:564
#2  0x0046124c in bfd_get_section_by_name (abfd=0x890680, 
name=0x700dc2 ".opd")
at /export/gnu/import/git/gitlab/x86-binutils/bfd/section.c:908
#3  0x004944fd in ppc64_elf_free_cached_info (abfd=0x890680)
at /export/gnu/import/git/gitlab/x86-binutils/bfd/elf64-ppc.c:18399
#4  0x0045d27b in _bfd_delete_bfd (abfd=0x890680)
at /export/gnu/import/git/gitlab/x86-binutils/bfd/opncls.c:189
#5  0x0045ded1 in bfd_close_all_done (abfd=0x890680)
at /export/gnu/import/git/gitlab/x86-binutils/bfd/opncls.c:957
#6  0x004219c8 in ld_cleanup ()
at /export/gnu/import/git/gitlab/x86-binutils/ld/ldmain.c:220
#7  0x00587102 in xatexit_cleanup ()
at /export/gnu/import/git/gitlab/x86-binutils/libiberty/xatexit.c:98
#8  0x0058713e in xexit (code=0)
at /export/gnu/import/git/gitlab/x86-binutils/libiberty/xexit.c:50
#9  0x0042272a in main (argc=63, argv=0x7fffcd38)
at /export/gnu/import/git/gitlab/x86-binutils/ld/ldmain.c:634
(gdb)

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


[Bug gas/31606] [2.43 Regression] "shld %rsi,%rdx,%rax" no longer works

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

H.J. Lu  changed:

   What|Removed |Added

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

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

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


[Bug gas/31606] [2.43 Regression] "shld %rsi,%rdx,%rax" no longer works

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

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

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

commit c2d698fe03a6092d58a07de96068b87836daced0
Author: H.J. Lu 
Date:   Thu Apr 4 13:12:12 2024 -0700

x86: Restore APX shift-double instructions with omitted shift count

Restore APX shift-double instructions with omitted shift count since
they are generated by GCC as shown in:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114590

gas/

PR gas/31606
* testsuite/gas/i386/x86-64-apx-ndd-wig.d: Updated.
* testsuite/gas/i386/x86-64-apx-ndd.d: Likewise.
* testsuite/gas/i386/x86-64-apx-ndd.s: Add tests for APX
shift-double instructions with omitted shift count.

opcodes/

PR gas/31606
* i386-opc.tbl: Restore APX shift-double instructions with
omitted shift count.
* i386-tbl.h: Regenerated.

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


[Bug gas/31606] [2.43 Regression] "shld %rsi,%rdx,%rax" no longer works

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

H.J. Lu  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=114590

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


[Bug gas/31606] New: [2.43 Regression] "shld %rsi,%rdx,%rax" no longer works

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

Bug ID: 31606
   Summary: [2.43 Regression] "shld %rsi,%rdx,%rax" no longer
works
   Product: binutils
   Version: 2.43 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: gas
  Assignee: unassigned at sourceware dot org
  Reporter: hjl.tools at gmail dot com
CC: jbeulich at suse dot com
  Target Milestone: ---
Target: x86-64

[hjl@gnu-cfl-3 tmp]$ cat x.s
shld   %rsi,%rdx,%rax
[hjl@gnu-cfl-3 tmp]$ gcc -c x.s
x.s: Assembler messages:
x.s:1: Error: operand type mismatch for `shld'
[hjl@gnu-cfl-3 tmp]$ 

This may be caused by

commit ffa2571063594a58e2e67932d8c742c04292a2ac
Author: Jan Beulich 
Date:   Thu Mar 28 11:49:48 2024 +0100

x86: templatize shift-double insns

With the multitude of new APX templates, it finally becomes desirable to
further remove redundancy by also templatizing basic arithmetic insns.
Continue with the shift-double ones.

While there also drop the APX form with ShiftCount omitted. Other shift
and rotate insns were deliberately left without this form as well. Note
that there's also no testsuite adjustment needed for this, indicating
that the form wasn't tested either.

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


[Bug binutils/31605] New: [readelf, -wL] Highlight empty address range

2024-04-04 Thread vries at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=31605

Bug ID: 31605
   Summary: [readelf, -wL] Highlight empty address range
   Product: binutils
   Version: unspecified
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

Consider gdb test-case gdb.dwarf2/dw2-epilogue-begin.exp.

With readelf -wL , we have:
...
File nameLine numberStarting addressViewStmt

dw2-epilogue-begin.c  440x4101e8   x
dw2-epilogue-begin.c  470x4101ec   x
dw2-epilogue-begin.c   -0x4101ec
...

The entry for line 47 has an empty address range (and consequently gdb ignores
it), but it's not obvious from the readelf output.

I wonder if making this clear somehow using an annotation would be a good idea.

Say:
...
File nameLine numberStarting addressViewStmt

dw2-epilogue-begin.c  440x4101e8   x
dw2-epilogue-begin.c  47   ~0x4101ec   x
dw2-epilogue-begin.c   -0x4101ec
...

Or displaying the address in parentheses.

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


[Bug gas/19977] [mips] gas writes incorrect addendum for %tprel_hi relocation

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

--- Comment #2 from Sourceware Commits  ---
The master branch has been updated by Alan Modra :

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

commit f38e9921479a00b4e7a72a79088106859ec5fabc
Author: Alan Modra 
Date:   Sat Mar 2 08:10:34 2024 +1030

MIPS HI16 and LO16 reloc howtos

All the HI16 reloc howtos should have a rightshift of 16, and all the
LO16 relocs shouldn't complain on overflow.  This was correct for
R_MIPS_LO16 and R_MIPS_LO16 (at least on the howto_table_rel entries),
and corresponding MIPS16, MICROMIPS and MIPS64 relocs, but not on many
other HI16 and LO16 relocs.

While we're at it, fix the HIGHER and HIGHEST rightshift too.

These changes are necessary to support addends outside the range
[0,32767] when those addends are stored in section contents.  Note
that some of the reloc howtos changed here will always have zero
addends (GOT_HI16, CALL_HI16).  Those don't really need changing, but
use what is clearly correct for hi16 relocs anyway.

PR 19977
* elf32-mips.c: Correct rightshift for HI16, HIGHER and HIGHEST
reloc howtos.  Correct complain_on_overflow for LO16 relocs.
* elf64-mips.c: Likewise.
* elfn32-mips.c: Likewise.

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