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

            Bug ID: 23201
           Summary: Unnecessary dynamic relocations for
                    HIDDEN/PROVIDE_HIDDEN symbols
           Product: binutils
           Version: 2.31 (HEAD)
            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-cfl-1 hidden-6]$ cat x.t
EXTERN(_start)
ENTRY(_start)

SECTIONS
{
  .text :
  {
    HIDDEN (__hidden_sym = .);
    *(.text*)
  }
}
[hjl@gnu-cfl-1 hidden-6]$ cat x.c
extern int __hidden_sym;
int *foo(void)
{
  return &__hidden_sym;
}
[hjl@gnu-cfl-1 hidden-6]$ make LD=ld
gcc -B./ -O2 -g -fpic   -c -o x.o x.c
ld  -shared -o libx.so x.o -Tx.t
readelf -r libx.so

Relocation section '.rela.dyn' at offset 0x10b0 contains 1 entry:
  Offset          Info           Type           Sym. Value    Sym. Name +
Addend
0000000001b8  000000000008 R_X86_64_RELATIVE                    0
[hjl@gnu-cfl-1 hidden-6]$ 

We should get

[hjl@gnu-cfl-1 hidden-6]$ readelf -r libx.so

There are no relocations in this file.
[hjl@gnu-cfl-1 hidden-6]$

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to