[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug gold/18975] New: gold: code_fill not executed if linker script is i
From: |
koriakin at 0x04 dot net |
Subject: |
[Bug gold/18975] New: gold: code_fill not executed if linker script is in use |
Date: |
Wed, 16 Sep 2015 21:05:22 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=18975
Bug ID: 18975
Summary: gold: code_fill not executed if linker script is in
use
Product: binutils
Version: 2.26 (HEAD)
Status: NEW
Severity: normal
Priority: P2
Component: gold
Assignee: ccoutant at gmail dot com
Reporter: koriakin at 0x04 dot net
CC: ian at airs dot com
Target Milestone: ---
Consider this test case:
$ cat a.lds
SECTIONS {
.text : { *(.text) }
}
$ cat a.s
nop
$ cat b.s
.balign 16
nop
$ as a.s -o a.o
$ as b.s -o b.o
$ ld.bfd a.o b.o -T a.lds
$ objdump -d a.out
a.out: file format elf64-x86-64
Disassembly of section .text:
0000000000000000 <.text>:
0: 90 nop
1: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
8: 00 00 00
b: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
10: 90 nop
BFD ld properly fills the code section with nops. However:
$ ld.gold a.o b.o -T a.lds
$ objdump -d a.out
a.out: file format elf64-x86-64
Disassembly of section .text:
0000000000000020 <.text>:
20: 90 nop
...
2d: 00 00 add %al,(%rax)
2f: 00 .byte 0x0
30: 90 nop
gold stuffs zero bytes there instead.
This works just fine if no linker script is used.
This bug can cause catastrophic failure if length of a .fini/.init section
chunk is not a multiple of next chunk's alignment - I found it by running gold
testsuite on s390x + RHEL, which has glibc's crt*.o .fini 4-byte aligned, but
gcc's crt*.o 1-byte aligned and with length not divisible by 4.
I'll attempt to make a patch for this issue.
Could be a cause of #15860 by the looks of it.
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug gold/18975] New: gold: code_fill not executed if linker script is in use,
koriakin at 0x04 dot net <=