[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/28393] New: aarch64 ld: assertion fail at elfnn-aarch64.c:5084 w
From: |
acoplan at gcc dot gnu.org |
Subject: |
[Bug ld/28393] New: aarch64 ld: assertion fail at elfnn-aarch64.c:5084 with weak undef tlsdesc symbol |
Date: |
Tue, 28 Sep 2021 15:12:46 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=28393
Bug ID: 28393
Summary: aarch64 ld: assertion fail at elfnn-aarch64.c:5084
with weak undef tlsdesc symbol
Product: binutils
Version: 2.38 (HEAD)
Status: NEW
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: acoplan at gcc dot gnu.org
Target Milestone: ---
The following assembly causes the linker to hit an assertion failure and then
segfault:
$ cat t.s
.global _start
.weak x
_start:
adrp x0, :tlsdesc:x
$ gas/as-new t.s -o t.o
$ ld/ld-new t.o
ld/ld-new: BFD (GNU Binutils) 2.37.50.20210928 assertion fail
elfnn-aarch64.c:5084
Segmentation fault (core dumped)
The backtrace is:
(gdb) bt
#0 bfd_assert (file=0x55555584a3cb "elfnn-aarch64.c", line=5084) at
/home/alecop01/toolchain/src/binutils-gdb/bfd/bfd.c:1649
#1 0x0000555555600006 in dtpoff_base (info=0x555555aa9040 <link_info>) at
elfnn-aarch64.c:5084
#2 0x0000555555604cf6 in elf64_aarch64_relocate_section
(output_bfd=0x555555ac14b0, info=0x555555aa9040 <link_info>,
input_bfd=0x555555addd10, input_section=0x555555ae0258, contents=0x555555ad97a0
"\200", relocs=0x555555ae16e0, local_syms=0x555555ad9810,
local_sections=0x555555adfcd0) at elfnn-aarch64.c:7064
#3 0x000055555564c5ef in elf_link_input_bfd (flinfo=0x7fffffffd700,
input_bfd=0x555555addd10) at
/home/alecop01/toolchain/src/binutils-gdb/bfd/elflink.c:11427
#4 0x000055555564f745 in bfd_elf_final_link (abfd=0x555555ac14b0,
info=0x555555aa9040 <link_info>) at
/home/alecop01/toolchain/src/binutils-gdb/bfd/elflink.c:12617
#5 0x00005555555ae503 in ldwrite () at
/home/alecop01/toolchain/src/binutils-gdb/ld/ldwrite.c:545
#6 0x00005555555aadfc in main (argc=2, argv=0x7fffffffd968) at
/home/alecop01/toolchain/src/binutils-gdb/ld/ldmain.c:513
The assembly here is motivated by GCC's output for the following C testcase:
$ cat t.c
extern __attribute((weak)) __thread int x;
void _start(void) { x = 1; }
$ ./aarch64-linux-gnu-gcc t.c -fpic -nostdlib
/home/alecop01/toolchain/build-aarch64-linux-gnu/install/bin/../lib/gcc/aarch64-linux-gnu/12.0.0/../../../../aarch64-linux-gnu/bin/ld:
BFD (7f92ed6b41c441ab2111c9f1212cbbc13222edcc) 2.37.50.20210927 assertion fail
elfnn-aarch64.c:5084
collect2: fatal error: ld terminated with signal 11 [Segmentation fault], core
dumped
compilation terminated.
$ ./aarch64-linux-gnu-gcc t.c -fpic -nostdlib -c -S -o -
.arch armv8-a
.file "t.c"
.text
.align 2
.global _start
.type _start, %function
_start:
.LFB0:
.cfi_startproc
stp x29, x30, [sp, -16]!
.cfi_def_cfa_offset 16
.cfi_offset 29, -16
.cfi_offset 30, -8
mov x29, sp
adrp x0, :tlsdesc:x
ldr x1, [x0, #:tlsdesc_lo12:x]
add x0, x0, :tlsdesc_lo12:x
.tlsdesccall x
blr x1
mrs x1, tpidr_el0
add x0, x1, x0
mov w1, 1
str w1, [x0]
nop
ldp x29, x30, [sp], 16
.cfi_restore 30
.cfi_restore 29
.cfi_def_cfa_offset 0
ret
.cfi_endproc
.LFE0:
.size _start, .-_start
.weak x
.ident "GCC: (d06dc8a2c73735e9496f434787ba4c93ceee5eea) 12.0.0
20210927 (experimental)"
.section .note.GNU-stack,"",@progbits
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/28393] New: aarch64 ld: assertion fail at elfnn-aarch64.c:5084 with weak undef tlsdesc symbol,
acoplan at gcc dot gnu.org <=