https://sourceware.org/bugzilla/show_bug.cgi?id=19615
Bug ID: 19615
Summary: [2.26 Regression] We can't no longer export a symbol
in PIE with local binding
Product: binutils
Version: 2.26
Status: NEW
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: hjl.tools at gmail dot com
Target Milestone: ---
[hjl@gnu-6 export-1]$ cat x.s
.text
.globl _start
_start:
ret
.globl xyzzy /* This symbol should be exported */
xyzzy:
ret
.section ".xyzzy_ptr","a"
xyzzy_ptr:
.dc.a xyzzy
[hjl@gnu-6 export-1]$ make LD=ld
as --32 -o x.o x.s
ld -pie -Bsymbolic -E -m elf_i386 -o x x.o
nm -Dn x
0000019c T _start
0000019d T xyzzy <<<<<<<<<<< Must export it.
0000122c D __bss_start
0000122c D _edata
0000122c D _end
readelf -r x
Relocation section '.rel.dyn' at offset 0x194 contains 1 entries:
Offset Info Type Sym.Value Sym. Name
0000019e 00000201 R_386_32 0000019d xyzzy
^^^^^^^^^^ Not bond locally.
[hjl@gnu-6 export-1]$ make LD=./ld-2.25
as --32 -o x.o x.s
./ld-2.25 -pie -Bsymbolic -E -m elf_i386 -o x x.o
nm -Dn x
0000019c T _start
0000019d T xyzzy
0000122c D __bss_start
0000122c D _edata
0000122c D _end
readelf -r x
Relocation section '.rel.dyn' at offset 0x194 contains 1 entries:
Offset Info Type Sym.Value Sym. Name
0000019e 00000008 R_386_RELATIVE
[hjl@gnu-6 export-1]$
Before binutils 2.26, "-pie -Bsymbolic -E" can be used to export
a symbol in PIE with local binding. Linker manual says
'-Bsymbolic'
When creating a shared library, bind references to global symbols
to the definition within the shared library, if any. Normally, it
is possible for a program linked against a shared library to
override the definition within the shared library. This option is
only meaningful on ELF platforms which support shared libraries.
"shared library" should be replaced with shared library or position
independent executable.
--
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