[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/19636] New: -pie changes program behavior and generate unnecessa
From: |
hjl.tools at gmail dot com |
Subject: |
[Bug ld/19636] New: -pie changes program behavior and generate unnecessary dynamic symbols. |
Date: |
Sun, 14 Feb 2016 04:01:35 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=19636
Bug ID: 19636
Summary: -pie changes program behavior and generate unnecessary
dynamic symbols.
Product: binutils
Version: unspecified
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 pie-1]$ cat x.s
.text
.globl _start
_start:
.byte 0
.section .data.rel.ro.local,"aw",%progbits
.weak func
.dc.a func
address@hidden pie-1]$ make
as -o x.o x.s
./ld -pie -o x x.o
./ld -o y x.o
readelf -r --dyn-syms x
Relocation section '.rela.dyn' at offset 0x248 contains 1 entries:
Offset Info Type Sym. Value Sym. Name +
Addend
000000200268 000300000001 R_X86_64_64 0000000000000000 func + 0
Symbol table '.dynsym' contains 6 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000260 0 SECTION LOCAL DEFAULT 6
2: 0000000000200370 0 NOTYPE GLOBAL DEFAULT 9 __bss_start
3: 0000000000000000 0 NOTYPE WEAK DEFAULT UND func
4: 0000000000200370 0 NOTYPE GLOBAL DEFAULT 9 _edata
5: 0000000000200370 0 NOTYPE GLOBAL DEFAULT 9 _end
readelf -r --dyn-syms y
There are no relocations in this file.
address@hidden pie-1]$
-pie generates a dynamic relocation for func, which changes program
behavior and makes weak symbol a run-time decision instead of link-time.
Also
2: 0000000000200370 0 NOTYPE GLOBAL DEFAULT 9 __bss_start
4: 0000000000200370 0 NOTYPE GLOBAL DEFAULT 9 _edata
5: 0000000000200370 0 NOTYPE GLOBAL DEFAULT 9 _end
are odd since there are no dynamic relocations for those symbols.
With gold, I got
address@hidden pie-1]$ make LD=ld.gold
as -o x.o x.s
ld.gold -pie -o x x.o
ld.gold -o y x.o
readelf -r --dyn-syms x
There are no relocations in this file.
Symbol table '.dynsym' contains 1 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
readelf -r --dyn-syms y
There are no relocations in this file.
address@hidden pie-1]$
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/19636] New: -pie changes program behavior and generate unnecessary dynamic symbols.,
hjl.tools at gmail dot com <=