bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/19615] New: [2.26 Regression] We can't no longer export a symbol


From: hjl.tools at gmail dot com
Subject: [Bug ld/19615] New: [2.26 Regression] We can't no longer export a symbol in PIE with local binding
Date: Thu, 11 Feb 2016 15:47:39 +0000

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: ---

address@hidden 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
address@hidden 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.

address@hidden 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   
address@hidden 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.


reply via email to

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