https://sourceware.org/bugzilla/show_bug.cgi?id=22269
Bug ID: 22269
Summary: Undefined weak symbols isn't resolved to 0 in static
PIE
Product: binutils
Version: 2.30 (HEAD)
Status: NEW
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: hjl.tools at gmail dot com
Depends on: 19636
Target Milestone: ---
Target: aarch64
On aarch64:
[hjl@gnu-efi-2 glibc]$ cat x.s
.text
.globl _start
_start:
.byte 0
.section .data.rel.ro.local,"aw",%progbits
.weak func
.dc.a func
[hjl@gnu-efi-2 glibc]$
/export/gnu/import/git/toolchain/install/compilers/aarch64-linux-gnu/bin/aarch64-glibc-linux-gnu-gcc
-c x.s
[hjl@gnu-efi-2 glibc]$
/export/gnu/import/git/toolchain/install/compilers/aarch64-linux-gnu/bin/aarch64-glibc-linux-gnu-ld
-pie --no-dynamic-linker x.o
[hjl@gnu-efi-2 glibc]$ readelf -r a.out
Relocation section '.rela.dyn' at offset 0x1a8 contains 1 entries:
Offset Info Type Sym. Value Sym. Name +
Addend
000000010ec8 000200000101 R_AARCH64_ABS64 0000000000000000 func + 0
[hjl@gnu-efi-2 glibc]$ readelf -l a.out
Elf file type is DYN (Shared object file)
Entry point 0x1c0
There are 4 program headers, starting at offset 64
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x00000000000001c1 0x00000000000001c1 R E 0x10000
LOAD 0x0000000000000ec8 0x0000000000010ec8 0x0000000000010ec8
0x0000000000000138 0x0000000000000138 RW 0x10000
DYNAMIC 0x0000000000000ed0 0x0000000000010ed0 0x0000000000010ed0
0x0000000000000110 0x0000000000000110 RW 0x8
GNU_RELRO 0x0000000000000ec8 0x0000000000010ec8 0x0000000000010ec8
0x0000000000000138 0x0000000000000138 R 0x1
Section to Segment mapping:
Segment Sections...
00 .hash .gnu.hash .dynsym .dynstr .rela.dyn .text
01 .data.rel.ro .dynamic .got .got.plt
02 .dynamic
03 .data.rel.ro .dynamic .got .got.plt
[hjl@gnu-efi-2 glibc]$
func should be resolved to 0 by ld.
Referenced Bugs:
https://sourceware.org/bugzilla/show_bug.cgi?id=19636
[Bug 19636] -pie changes program behavior and generate unnecessary dynamic
symbols.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-binutils