Bug 17942 - -z text should provide more info
Summary: -z text should provide more info
Status: NEW
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.26
: P2 normal
Target Milestone: ---
Assignee: Cary Coutant
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-07 13:35 UTC by H.J. Lu
Modified: 2015-02-07 13:35 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2015-02-07 13:35:43 UTC
gold should provide more info to help user identify the issue:

[hjl@gnu-tools-1 pr17935]$ cat foo.s
	.text
	.globl foo
foo:
	.byte 0
	.globl	bar
bar:
	.dc.a	foo
[hjl@gnu-tools-1 pr17935]$ make
gcc -m32 -c  -o foo.o foo.s
ld.gold -m elf_i386 -z text -shared -o libfoo.so foo.o
ld.gold: error: read-only segment has dynamic relocations
Makefile:19: recipe for target 'libfoo.so' failed
make: *** [libfoo.so] Error 1

ld issue a warning:

[hjl@gnu-tools-1 pr17935]$ ./ld -m elf_i386 -z text -shared -o libfoo.so foo.o
./ld: foo.o: warning: relocation against `foo' in readonly section `.text'
./ld: read-only segment has dynamic relocations.
[hjl@gnu-tools-1 pr17935]$ 

It is very useful to identify which input causes the error.