* objcopy.c (filter_symbols): Explicitly stripping a symbol used in relocations is an error.

Retype 'keep' to bfd_boolean.
* binutils-all/objcopy.exp: Add test for stripping a symbol used in a relocation.
* binutils-all/needed-by-reloc.s: New file.
This commit is contained in:
Nick Clifton
2007-04-24 10:56:58 +00:00
parent 98f17e6e1c
commit 312aaa3cfe
5 changed files with 68 additions and 11 deletions

View File

@ -0,0 +1,7 @@
.globl foo
.data
.4byte foo
.text
foo:
.long 1

View File

@ -1,5 +1,5 @@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
# 2004, 2006
# 2004, 2006, 2007
# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
@ -774,3 +774,22 @@ if [is_elf_format] {
run_dump_test "strip-3"
}
run_dump_test "localize-hidden-2"
if { [istarget "i*86-*"] || [istarget "x86_64-*-*"] } {
# Check to make sure we don't strip a symbol named in relocations.
set test "objcopy doesn't strip needed symbols"
set srcfile $srcdir/$subdir/needed-by-reloc.s
if {![binutils_assemble $srcfile tmpdir/bintest.o]} then {
unresolved $test
} else {
set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS --strip-symbol=foo tmpdir/bintest.o ${copyfile}.o"]
if [regexp "not stripping symbol `foo' because it is named in a relocation" $got] {
pass $test
} else {
fail $test
}
}
}