mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-02 19:46:09 +08:00
* 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:
7
binutils/testsuite/binutils-all/needed-by-reloc.s
Normal file
7
binutils/testsuite/binutils-all/needed-by-reloc.s
Normal file
@ -0,0 +1,7 @@
|
||||
.globl foo
|
||||
|
||||
.data
|
||||
.4byte foo
|
||||
.text
|
||||
foo:
|
||||
.long 1
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user