Bug ID: 21910
           Summary: Common symbol override test (comm-data.exp):
                    Segmentation fault on x86_64-linux-musl
           Product: binutils
           Version: 2.29
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: awilfox at adelielinux dot org
  Target Milestone: ---

I'm new to hacking on bfd but I'm trying to pick it up.  ld actually fails a
number of tests on x86_64-linux-musl target (52 on 2.28, and 74 on 2.29), and
I'm trying to see what I can do to make them pass.

The first one is in ld-elf/comm-data.exp: the second link causes a segmentation

Executing on host: sh -c
-I/usr/src/aports/main/binutils/src/binutils-2.29/ld/testsuite/ld-elf   -o
tmpdir/comm-data2.o  --defsym ELF64=1
2>&1}  /dev/null ld.tmp (timeout = 300)
Executing on host: sh -c
{/usr/src/aports/main/binutils/src/binutils-2.29/ld/ld-new   -o
tmpdir/comm-data -z norelro
-L/usr/src/aports/main/binutils/src/binutils-2.29/ld/testsuite/ld-elf  -T
comm-data2.ld -Ltmpdir -lcomm-data tmpdir/comm-data2.o  2>&1}  /dev/null ld.tmp
(timeout = 300)
sh: line 1: 11283 Segmentation fault     
/usr/src/aports/main/binutils/src/binutils-2.29/ld/ld-new -o tmpdir/comm-data
-z norelro
-L/usr/src/aports/main/binutils/src/binutils-2.29/ld/testsuite/ld-elf -T
comm-data2.ld -Ltmpdir -lcomm-data tmpdir/comm-data2.o 2>&1
FAIL: Common symbol override test

Changing the ld-new wrapper to exec ld under gdb yielded this backtrace:

Starting program:
/usr/src/aports/main/binutils/src/binutils-2.29/ld/.libs/lt-ld-new -o
tmpdir/comm-data -z norelro
-L/usr/src/aports/main/binutils/src/binutils-2.29/ld/testsuite/ld-elf -T
comm-data2.ld -Ltmpdir -lcomm-data tmpdir/comm-data2.o

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7a9b3a8 in bfd_elf_final_link (abfd=<optimized out>, info=<optimized
out>) at elflink.c:12347
12347                 if (elf_section_data
(o->output_section)->this_hdr.sh_type == SHT_NOTE)
(gdb) bt
#0  0x00007ffff7a9b3a8 in bfd_elf_final_link (abfd=<optimized out>,
info=<optimized out>) at elflink.c:12347
#1  0x0000555555578199 in ldwrite () at ldwrite.c:577
#2  0x0000555555561c9d in main (argc=<optimized out>, argv=<optimized out>) at
(gdb) p o->output_section
$1 = 0x5555558840b0 <_bfd_std_section+560>
(gdb) p (struct bfd_elf_section_data*)(o->output_section)->used_by_bfd
$2 = (struct bfd_elf_section_data *) 0x0

That's no good.  Changing bfd/elflink.c:12341:

-              if (o == NULL)
+              if (o == NULL || elf_section_data (o->output_section) == NULL)

gave me the following output instead:

/usr/src/aports/main/binutils/src/binutils-2.29/ld/.libs/lt-ld-new: could not
find section .gnu.hash
/usr/src/aports/main/binutils/src/binutils-2.29/ld/.libs/lt-ld-new: final link
failed: Nonrepresentable section on output

This is about as far as I could get with my current knowledge in binutils, as I
am unable to determine why exactly that would happen.

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

Reply via email to