diff options
Diffstat (limited to 'binutils/testsuite/binutils-all')
-rw-r--r-- | binutils/testsuite/binutils-all/needed-by-reloc.s | 7 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/objcopy.exp | 21 |
2 files changed, 27 insertions, 1 deletions
diff --git a/binutils/testsuite/binutils-all/needed-by-reloc.s b/binutils/testsuite/binutils-all/needed-by-reloc.s new file mode 100644 index 0000000..8251e8c --- /dev/null +++ b/binutils/testsuite/binutils-all/needed-by-reloc.s @@ -0,0 +1,7 @@ + .globl foo + + .data + .4byte foo + .text +foo: + .long 1 diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp index 510f6ce..0493d86 100644 --- a/binutils/testsuite/binutils-all/objcopy.exp +++ b/binutils/testsuite/binutils-all/objcopy.exp @@ -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 + } + } +} |