mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-26 22:07:58 +08:00
Add a --no-weak option to nm.
PR 29135 * nm.c (non_weak): New variable. (filter_symbols): When non-weak is true, ignore weak symbols. (long_options): Add --no-weak. (usage): Mention --no-weak. (main): Handle -W/--no-weak. * doc/binutils.texi: Document new feature. * NEWS: Mention the new feature. * testsuite/binutils-all/nm.exp: Add test of new feature. * testsuite/binutils-all/no-weak.s: New test source file.
This commit is contained in:
@ -340,7 +340,37 @@ if [is_elf_format] {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
set testname "nm --no-weak"
|
||||
if {![binutils_assemble $srcdir/$subdir/no-weak.s tmpdir/no-weak.o]} then {
|
||||
fail "$testname (assembly)"
|
||||
} else {
|
||||
if [is_remote host] {
|
||||
set tmpfile [remote_download host tmpdir/no-weak.o]
|
||||
} else {
|
||||
set tmpfile tmpdir/no-weak.o
|
||||
}
|
||||
|
||||
set got [binutils_run $NM "$NMFLAGS --no-weak $tmpfile"]
|
||||
|
||||
if [regexp "weak_with_default_value" $got] then {
|
||||
fail "$testname (weak symbol with default value)"
|
||||
} else {
|
||||
pass "$testname (weak symbol with default value)"
|
||||
}
|
||||
|
||||
if [regexp "weak_without_default_value" $got] then {
|
||||
fail "$testname (weak symbol without default value)"
|
||||
} else {
|
||||
pass "$testname (weak symbol without default value)"
|
||||
}
|
||||
|
||||
# FIXME: We should re run this test without the --no-weak option
|
||||
# and verify that the expected symbol names *are* shown...
|
||||
|
||||
if { $verbose < 1 } {
|
||||
remote_file host delete "tmpdir/no0weak.o"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# There are certainly other tests that could be run.
|
||||
|
13
binutils/testsuite/binutils-all/no-weak.s
Normal file
13
binutils/testsuite/binutils-all/no-weak.s
Normal file
@ -0,0 +1,13 @@
|
||||
.file "no-weak.c"
|
||||
.text
|
||||
|
||||
.globl weak_with_default_value
|
||||
.weak weak_with_default_value
|
||||
weak_with_default_value:
|
||||
.nop
|
||||
|
||||
.data
|
||||
.weak weak_without_default_value
|
||||
.dc.a weak_without_default_value
|
||||
|
||||
|
Reference in New Issue
Block a user