Clear HAS_RELOC if there are no relocations
The HAS_RELOC bit should be cleared when relocations are removed from relocatable files. bfd/ PR binutils/19547 * elf.c (assign_section_numbers): Clear HAS_RELOC if there are no relocations in relocatable files. binutils/ PR binutils/19547 * testsuite/binutils-all/objcopy.exp (objcopy_test_without_global_symbol): New proc. Run objcopy_test_without_global_symbol. * testsuite/binutils-all/pr19547.c: New file.
This commit is contained in:
parent
a143b0045c
commit
14f2c699dd
5 changed files with 64 additions and 0 deletions
|
@ -1,3 +1,11 @@
|
|||
2016-02-02 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
PR binutils/19547
|
||||
* testsuite/binutils-all/objcopy.exp
|
||||
(objcopy_test_without_global_symbol): New proc.
|
||||
Run objcopy_test_without_global_symbol.
|
||||
* testsuite/binutils-all/pr19547.c: New file.
|
||||
|
||||
2016-01-28 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
PR binutils/19523
|
||||
|
|
|
@ -1104,3 +1104,43 @@ if [is_elf_format] {
|
|||
run_dump_test "exclude-1b"
|
||||
}
|
||||
run_dump_test "localize-hidden-2"
|
||||
|
||||
# Test objcopying an object file without global symbol
|
||||
|
||||
proc objcopy_test_without_global_symbol { } {
|
||||
global OBJCOPY
|
||||
global OBJCOPYFLAGS
|
||||
global OBJDUMP
|
||||
global OBJDUMPFLAGS
|
||||
global srcdir
|
||||
global subdir
|
||||
|
||||
set test "strip without global symbol "
|
||||
|
||||
if { [target_compile $srcdir/$subdir/pr19547.c tmpdir/pr19547.o object debug] != "" } {
|
||||
untested $test
|
||||
return
|
||||
}
|
||||
|
||||
if [is_remote host] {
|
||||
set objfile [remote_download host tmpdir/pr19547.o]
|
||||
} else {
|
||||
set objfile tmpdir/pr19547.o
|
||||
}
|
||||
|
||||
set exec_output [binutils_run $OBJCOPY "$OBJCOPYFLAGS --strip-unneeded $objfile"]
|
||||
if ![string equal "" $exec_output] {
|
||||
fail $test
|
||||
return
|
||||
}
|
||||
|
||||
set exec_output [binutils_run $OBJDUMP "$OBJDUMPFLAGS -t $objfile"]
|
||||
if {![regexp "no symbols" $exec_output]} {
|
||||
fail $test
|
||||
return
|
||||
}
|
||||
|
||||
pass $test
|
||||
}
|
||||
|
||||
objcopy_test_without_global_symbol
|
||||
|
|
1
binutils/testsuite/binutils-all/pr19547.c
Normal file
1
binutils/testsuite/binutils-all/pr19547.c
Normal file
|
@ -0,0 +1 @@
|
|||
static char foo[]__attribute__ ((used)) = "foo";
|
Loading…
Add table
Add a link
Reference in a new issue