bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/31847] New: aarch64: bfd assert failure for discarded hidden sym


From: nsz at gcc dot gnu.org
Subject: [Bug ld/31847] New: aarch64: bfd assert failure for discarded hidden symbol GOT reference
Date: Wed, 05 Jun 2024 10:46:21 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=31847

            Bug ID: 31847
           Summary: aarch64: bfd assert failure for discarded hidden
                    symbol GOT reference
           Product: binutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: nsz at gcc dot gnu.org
  Target Milestone: ---

$ cat bug.ld
OUTPUT_ARCH(aarch64)
SECTIONS
{
  /DISCARD/ : { *(.discard) }
  . = 0x10000;
  .text : { *(.text) }
  . = 0x20000;
  .got  : { *(.got) }
}
$ cat bug.s
.text
.global foo
.hidden foo
foo:
        nop

.section .discard,"ax"
        adrp    x0, :got:foo
        ldr     x0, [x0, :got_lo12:foo]
$ aarch64-linux-gnu-as -o bug.o bug.s
$ aarch64-linux-gnu-ld -shared -T bug.ld bug.o
aarch64-linux-gnu-ld: BFD (8708c81cd41055b28067d5fe6619f98e128e85cf)
2.42.50.20240529 assertion fail S/bfd/elfnn-aarch64.c:10160

GOT entry accounting logic, GOT entry initialization and emitting the GOT
relocation happens at different places in bfd and they seem to be inconsistent.

In case of local symbol we don't get assert failure, but we get an unused GOT
entry and uninitialized relocation for it (R_AARCH64_NONE):

$ cat bug2.s
.text
foo:
        nop

.section .discard,"ax"
        adrp    x0, :got:foo
        ldr     x0, [x0, :got_lo12:foo]
$ aarch64-linux-gnu-as -o bug2.o bug2.s
$ aarch64-linux-gnu-ld -shared -T bug.ld bug2.o
$ aarch64-linux-gnu-readelf -rW a.out

Relocation section '.rela.dyn' at offset 0x10078 contains 1 entry:
  Offset          Info           Type           Sym. Value    Sym. Name +
Addend
000000000000  000000000000 R_AARCH64_NONE                       0

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]