summaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2015-02-18 17:02:39 +1030
committerAlan Modra <amodra@gmail.com>2015-02-19 13:36:34 +1030
commitd983c8c5503d680c6d4955ceb610a9beebc64460 (patch)
tree328f5687e73b6db52f604b3596c0b1cc03fd515a /ld
parent8545136955641adbf35e121fbbfc8cd5fd06e4a7 (diff)
downloadbinutils-gdb-d983c8c5503d680c6d4955ceb610a9beebc64460.tar.gz
Strip undefined symbols from .symtab
bfd/ PR ld/4317 * elflink.c (elf_link_input_bfd): Drop undefined local syms. (elf_link_output_extsym): Drop local and global undefined syms. Tidy. Expand comment. ld/testsuite/ PR ld/4317 * ld-aarch64/gc-tls-relocs.d, * ld-cris/locref2.d, * ld-elf/ehdr_start-weak.d, * ld-elf/group1.d, * ld-i386/compressed1.d, * ld-ia64/error1.d, * ld-ia64/error2.d, * ld-ia64/error3.d, * ld-mips-elf/pic-and-nonpic-1.nd, * ld-mmix/undef-3.d, * ld-powerpc/tlsexe.r, * ld-powerpc/tlsexetoc.r, * ld-powerpc/tlsso.r, * ld-powerpc/tlstocso.r, * ld-x86-64/compressed1.d, * ld-x86-64/pie1.d: Update.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog11
-rw-r--r--ld/testsuite/ld-aarch64/gc-tls-relocs.d1
-rw-r--r--ld/testsuite/ld-cris/locref2.d2
-rw-r--r--ld/testsuite/ld-elf/ehdr_start-weak.d5
-rw-r--r--ld/testsuite/ld-elf/group1.d2
-rw-r--r--ld/testsuite/ld-i386/compressed1.d5
-rw-r--r--ld/testsuite/ld-ia64/error1.d2
-rw-r--r--ld/testsuite/ld-ia64/error2.d2
-rw-r--r--ld/testsuite/ld-ia64/error3.d2
-rw-r--r--ld/testsuite/ld-mips-elf/pic-and-nonpic-1.nd1
-rw-r--r--ld/testsuite/ld-mmix/undef-3.d17
-rw-r--r--ld/testsuite/ld-powerpc/tlsexe.r5
-rw-r--r--ld/testsuite/ld-powerpc/tlsexetoc.r5
-rw-r--r--ld/testsuite/ld-powerpc/tlsso.r1
-rw-r--r--ld/testsuite/ld-powerpc/tlstocso.r1
-rw-r--r--ld/testsuite/ld-x86-64/compressed1.d5
-rw-r--r--ld/testsuite/ld-x86-64/pie1.d5
17 files changed, 26 insertions, 46 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 64f08714a2d..7619bc5d96d 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2015-02-19 Alan Modra <amodra@gmail.com>
+
+ PR ld/4317
+ * ld-aarch64/gc-tls-relocs.d, * ld-cris/locref2.d,
+ * ld-elf/ehdr_start-weak.d, * ld-elf/group1.d,
+ * ld-i386/compressed1.d, * ld-ia64/error1.d, * ld-ia64/error2.d,
+ * ld-ia64/error3.d, * ld-mips-elf/pic-and-nonpic-1.nd,
+ * ld-mmix/undef-3.d, * ld-powerpc/tlsexe.r, * ld-powerpc/tlsexetoc.r,
+ * ld-powerpc/tlsso.r, * ld-powerpc/tlstocso.r,
+ * ld-x86-64/compressed1.d, * ld-x86-64/pie1.d: Update.
+
2015-02-17 Alan Modra <amodra@gmail.com>
PR ld/17975
diff --git a/ld/testsuite/ld-aarch64/gc-tls-relocs.d b/ld/testsuite/ld-aarch64/gc-tls-relocs.d
index 191647ca310..480d869917e 100644
--- a/ld/testsuite/ld-aarch64/gc-tls-relocs.d
+++ b/ld/testsuite/ld-aarch64/gc-tls-relocs.d
@@ -17,7 +17,6 @@ SYMBOL TABLE:
0+9000 l d \.got 0+ \.got
0+0000 l df \*ABS\* 0+ .*
0+0000 l df \*ABS\* 0+
-0+0000 l \*UND\* 0+ __tls_get_addr
0+9000 l O \.got 0+ _GLOBAL_OFFSET_TABLE_
0+8000 g \.text 0+ _start
diff --git a/ld/testsuite/ld-cris/locref2.d b/ld/testsuite/ld-cris/locref2.d
index 735b10ec4ff..0cf53946cb5 100644
--- a/ld/testsuite/ld-cris/locref2.d
+++ b/ld/testsuite/ld-cris/locref2.d
@@ -12,8 +12,6 @@
SYMBOL TABLE:
#...
0+82088 l O \.got 0+ _GLOBAL_OFFSET_TABLE_
-0+ w \*UND\* 0+ expfn
-0+ w \*UND\* 0+ expobj
#...
Disassembly of section \.text:
#...
diff --git a/ld/testsuite/ld-elf/ehdr_start-weak.d b/ld/testsuite/ld-elf/ehdr_start-weak.d
index 24ae34cda71..5644d0537dc 100644
--- a/ld/testsuite/ld-elf/ehdr_start-weak.d
+++ b/ld/testsuite/ld-elf/ehdr_start-weak.d
@@ -4,6 +4,7 @@
#target: *-*-linux* *-*-gnu* *-*-nacl*
#xfail: frv-*-*
+#failif
+#...
+.* __ehdr_start
#...
-\s+[wU] __ehdr_start
-#pass
diff --git a/ld/testsuite/ld-elf/group1.d b/ld/testsuite/ld-elf/group1.d
index ff675352675..257be11fac4 100644
--- a/ld/testsuite/ld-elf/group1.d
+++ b/ld/testsuite/ld-elf/group1.d
@@ -8,5 +8,3 @@
Symbol table '.symtab' contains .* entries:
#...
.*: 0+1000 +0 +(NOTYPE|OBJECT) +WEAK +DEFAULT +. foo
-.*: 0+0000 +0 +(NOTYPE|OBJECT) +GLOBAL +DEFAULT +UND bar
-#...
diff --git a/ld/testsuite/ld-i386/compressed1.d b/ld/testsuite/ld-i386/compressed1.d
index 3a57c815a9a..c17d3c7fce6 100644
--- a/ld/testsuite/ld-i386/compressed1.d
+++ b/ld/testsuite/ld-i386/compressed1.d
@@ -2,8 +2,3 @@
#as: --32
#ld: -e foo -melf_i386 --noinhibit-exec
#warning: .*/compressed1.c:13: undefined reference to .bar.
-#nm: -n
-
-#...
-[ \t]+U bar
-#pass
diff --git a/ld/testsuite/ld-ia64/error1.d b/ld/testsuite/ld-ia64/error1.d
index 82142b6a11e..7b2476f95e5 100644
--- a/ld/testsuite/ld-ia64/error1.d
+++ b/ld/testsuite/ld-ia64/error1.d
@@ -2,6 +2,4 @@
#ld: -unresolved-symbols=ignore-all
#readelf: -s
-#...
-[ ]+[0-9]+:[ ]+[0]+[ ]+0[ ]+NOTYPE[ ]+GLOBAL DEFAULT[ ]+UND[ ]+foo
#pass
diff --git a/ld/testsuite/ld-ia64/error2.d b/ld/testsuite/ld-ia64/error2.d
index 764ba66d279..ae74eaa464b 100644
--- a/ld/testsuite/ld-ia64/error2.d
+++ b/ld/testsuite/ld-ia64/error2.d
@@ -2,6 +2,4 @@
#ld: -pie -unresolved-symbols=ignore-all
#readelf: -s
-#...
-[ ]+[0-9]+:[ ]+[0]+[ ]+0[ ]+NOTYPE[ ]+GLOBAL DEFAULT[ ]+UND[ ]+foo
#pass
diff --git a/ld/testsuite/ld-ia64/error3.d b/ld/testsuite/ld-ia64/error3.d
index e14d451bbae..256a6fdc17b 100644
--- a/ld/testsuite/ld-ia64/error3.d
+++ b/ld/testsuite/ld-ia64/error3.d
@@ -2,6 +2,4 @@
#ld: -pie -shared
#readelf: -s
-#...
-[ ]+[0-9]+:[ ]+[0]+[ ]+0[ ]+NOTYPE[ ]+GLOBAL DEFAULT[ ]+UND[ ]+foo
#pass
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-1.nd b/ld/testsuite/ld-mips-elf/pic-and-nonpic-1.nd
index 78a1c605797..3c449fbcb7a 100644
--- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-1.nd
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-1.nd
@@ -2,7 +2,6 @@
.*: 00068000 +0 +NOTYPE +LOCAL +DEFAULT +ABS _gp
.*: 00041018 +8 +FUNC +LOCAL +DEFAULT .* .pic.f1
.*: 00041000 +16 +FUNC +LOCAL +DEFAULT .* .pic.f2
-.*: 00000000 +0 +OBJECT +GLOBAL +DEFAULT +UND _gp_disp
.*: 00041050 +14 +FUNC +GLOBAL +DEFAULT +\[MIPS16\] .* f3
.*: 00041060 +24 +FUNC +GLOBAL +DEFAULT .* __start
.*: 0004103c +20 +FUNC +GLOBAL +DEFAULT .* f2
diff --git a/ld/testsuite/ld-mmix/undef-3.d b/ld/testsuite/ld-mmix/undef-3.d
index 2f551b9f71f..8fbf304d40e 100644
--- a/ld/testsuite/ld-mmix/undef-3.d
+++ b/ld/testsuite/ld-mmix/undef-3.d
@@ -14,19 +14,18 @@ Section Headers:
+\[ 2\] \.shstrtab +STRTAB +0+ +0+7c
+0+21 +0+ +0 +0 +1
+\[ 3\] \.symtab +SYMTAB +0+ .*
- +0+c0 +0+18 +4 +2 +8
+ +0+a8 +0+18 +4 +2 +8
+\[ 4\] \.strtab +STRTAB +0+ .*
- +0+2f +0+ +0 +0 +1
+ +0+28 +0+ +0 +0 +1
Key to Flags:
#...
-Symbol table '\.symtab' contains 8 entries:
+Symbol table '\.symtab' contains 7 entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND
+1: 0+ +0 +SECTION +LOCAL +DEFAULT +1
- +2: 0+ +0 +NOTYPE +GLOBAL +DEFAULT +UND undefd
- +3: 0+ +0 +NOTYPE +GLOBAL +DEFAULT +1 _start
- +4: 2000000000000000 +0 +NOTYPE +GLOBAL +DEFAULT +1 __bss_start
- +5: 2000000000000000 +0 +NOTYPE +GLOBAL +DEFAULT +1 _edata
- +6: 2000000000000000 +0 +NOTYPE +GLOBAL +DEFAULT +1 _end
- +7: 0+ +0 +NOTYPE +GLOBAL +DEFAULT +1 _start\.
+ +2: 0+ +0 +NOTYPE +GLOBAL +DEFAULT +1 _start
+ +3: 2000000000000000 +0 +NOTYPE +GLOBAL +DEFAULT +1 __bss_start
+ +4: 2000000000000000 +0 +NOTYPE +GLOBAL +DEFAULT +1 _edata
+ +5: 2000000000000000 +0 +NOTYPE +GLOBAL +DEFAULT +1 _end
+ +6: 0+ +0 +NOTYPE +GLOBAL +DEFAULT +1 _start\.
diff --git a/ld/testsuite/ld-powerpc/tlsexe.r b/ld/testsuite/ld-powerpc/tlsexe.r
index 443bae872b6..94e5272b9ca 100644
--- a/ld/testsuite/ld-powerpc/tlsexe.r
+++ b/ld/testsuite/ld-powerpc/tlsexe.r
@@ -98,9 +98,8 @@ Symbol table '\.symtab' contains [0-9]+ entries:
.* TLS +LOCAL +DEFAULT +8 le5
.* FILE +LOCAL +DEFAULT +ABS
.* OBJECT +LOCAL +DEFAULT +10 _DYNAMIC
-.* (NOTYPE +LOCAL +DEFAULT +7 __glink_PLTresolve|(FUNC|NOTYPE) +LOCAL +DEFAULT +UND \.__tls_get_addr(|_opt))
-.* (NOTYPE +LOCAL +DEFAULT +7 .*\.plt_call\.__tls_get_addr(|_opt)|NOTYPE +LOCAL +DEFAULT +7 __glink_PLTresolve)
-.* ((FUNC|NOTYPE) +LOCAL +DEFAULT +UND \.__tls_get_addr(|_opt)|NOTYPE +LOCAL +DEFAULT +7 .*\.plt_call\.__tls_get_addr(|_opt))
+.* NOTYPE +LOCAL +DEFAULT +7 __glink_PLTresolve
+.* NOTYPE +LOCAL +DEFAULT +7 .*\.plt_call\.__tls_get_addr(|_opt)
.* GLOBAL +DEFAULT +UND gd
.* GLOBAL +DEFAULT +9 le0
.* GLOBAL +DEFAULT +9 ld0
diff --git a/ld/testsuite/ld-powerpc/tlsexetoc.r b/ld/testsuite/ld-powerpc/tlsexetoc.r
index bb6462f6b34..7b55281a7a5 100644
--- a/ld/testsuite/ld-powerpc/tlsexetoc.r
+++ b/ld/testsuite/ld-powerpc/tlsexetoc.r
@@ -98,9 +98,8 @@ Symbol table '\.symtab' contains [0-9]+ entries:
.* NOTYPE +LOCAL +DEFAULT +12 \.Lie0
.* FILE +LOCAL +DEFAULT +ABS
.* OBJECT +LOCAL +DEFAULT +10 _DYNAMIC
-.* (NOTYPE +LOCAL +DEFAULT +7 __glink_PLTresolve|(FUNC|NOTYPE) +LOCAL +DEFAULT +UND \.__tls_get_addr(|_opt))
-.* (NOTYPE +LOCAL +DEFAULT +7 .*\.plt_call\.__tls_get_addr(|_opt)|NOTYPE +LOCAL +DEFAULT +7 __glink_PLTresolve)
-.* ((FUNC|NOTYPE) +LOCAL +DEFAULT +UND \.__tls_get_addr(|_opt)|NOTYPE +LOCAL +DEFAULT +7 .*\.plt_call\.__tls_get_addr(|_opt))
+.* NOTYPE +LOCAL +DEFAULT +7 __glink_PLTresolve
+.* NOTYPE +LOCAL +DEFAULT +7 .*\.plt_call\.__tls_get_addr(|_opt)
.* TLS +GLOBAL +DEFAULT +UND gd
.* TLS +GLOBAL +DEFAULT +9 le0
.* TLS +GLOBAL +DEFAULT +9 ld0
diff --git a/ld/testsuite/ld-powerpc/tlsso.r b/ld/testsuite/ld-powerpc/tlsso.r
index 3a5b8089233..e0a3a754993 100644
--- a/ld/testsuite/ld-powerpc/tlsso.r
+++ b/ld/testsuite/ld-powerpc/tlsso.r
@@ -116,7 +116,6 @@ Symbol table '\.symtab' contains [0-9]+ entries:
.* OBJECT +LOCAL +DEFAULT +9 _DYNAMIC
.* NOTYPE +LOCAL +DEFAULT +6 .*\.plt_call\.__tls_get_addr
.* NOTYPE +LOCAL +DEFAULT +6 __glink_PLTresolve
-.* NOTYPE +LOCAL +DEFAULT +UND \.__tls_get_addr
.* TLS +GLOBAL +DEFAULT +UND gd
.* TLS +GLOBAL +DEFAULT +8 le0
.* NOTYPE +GLOBAL +DEFAULT +UND __tls_get_addr
diff --git a/ld/testsuite/ld-powerpc/tlstocso.r b/ld/testsuite/ld-powerpc/tlstocso.r
index 075e3037585..0006db9a364 100644
--- a/ld/testsuite/ld-powerpc/tlstocso.r
+++ b/ld/testsuite/ld-powerpc/tlstocso.r
@@ -112,7 +112,6 @@ Symbol table '\.symtab' contains [0-9]+ entries:
.* OBJECT +LOCAL +DEFAULT +9 _DYNAMIC
.* NOTYPE +LOCAL +DEFAULT +6 .*\.plt_call\.__tls_get_addr
.* NOTYPE +LOCAL +DEFAULT +6 __glink_PLTresolve
-.* NOTYPE +LOCAL +DEFAULT +UND \.__tls_get_addr
.* TLS +GLOBAL +DEFAULT +UND gd
.* TLS +GLOBAL +DEFAULT +8 le0
.* NOTYPE +GLOBAL +DEFAULT +UND __tls_get_addr
diff --git a/ld/testsuite/ld-x86-64/compressed1.d b/ld/testsuite/ld-x86-64/compressed1.d
index 1dd0f4cf6c7..9e9d92cea2c 100644
--- a/ld/testsuite/ld-x86-64/compressed1.d
+++ b/ld/testsuite/ld-x86-64/compressed1.d
@@ -2,8 +2,3 @@
#as: --64
#ld: -e foo -melf_x86_64 --noinhibit-exec
#warning: .*/compressed1.c:13: undefined reference to .bar.
-#nm: -n
-
-#...
-[ \t]+U bar
-#pass
diff --git a/ld/testsuite/ld-x86-64/pie1.d b/ld/testsuite/ld-x86-64/pie1.d
index 06d2562b804..368d1538f41 100644
--- a/ld/testsuite/ld-x86-64/pie1.d
+++ b/ld/testsuite/ld-x86-64/pie1.d
@@ -1,9 +1,4 @@
#name: PIE with undefined symbol
#as: --64
#ld: -pie -melf_x86_64 --noinhibit-exec
-#readelf: -s --wide
#warning: \A[^\n]*\.o[^\n]*In function `_start':\n[^\n]*: undefined reference to `foo'\Z
-
-#...
- +[0-9]+: +[0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +UND foo
-#pass