This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gold] 2.27 generates GOT where 2.26 did not


I have these two files:

// asm_var.S
.section .rodata
.global asm_var
.protected asm_var
.size asm_var, 8
asm_var:
	.org .+8

// get_addr.c
extern unsigned long asm_var;

void* get_addr() {
	return &asm_var;
}

That I compile with:
gcc -O3 -fuse-ld=gold -fPIC -shared -nostdlib -Wl,-Bsymbolic asm_var.S get_addr.c

With gold 2.26.1 (and most likely older versions as well), this results in:

00000000000002f0 <get_addr>:
 2f0:	48 8d 05 01 00 00 00 	lea    0x1(%rip),%rax    # 2f8 <asm_var>
 2f7:	c3                   	retq

Yet with 2.27 this results in:

0000000000000340 <get_addr>:
 340:	48 8b 05 99 1c 00 00 	mov    0x1c99(%rip),%rax # 1fe0 <_DYNAMIC+0x110>
 347:	c3                   	retq

What's at 1fe0?

000000001fe0  000500000006 R_X86_64_GLOB_DAT 0000000000000348 asm_var + 0

Is this a regression in 2.27? I really don't want to use the GOT. Is there a
flag I can pass to get the old behavior?

Jethro Beekman


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]