This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: PATCH: Add the "ld -r" test for ELF visibility.
On Wed, Oct 31, 2001 at 04:31:13PM -0500, Hans-Peter Nilsson wrote:
> On Wed, 31 Oct 2001, H . J . Lu wrote:
> > How about this patch? Tested on Linux/x86 and Linux/alpha.
>
> That's what I was thinking of, except (for both tests)...
>
> > +#target: *-*-*
>
> The target-specifier is optional; you don't need it for *-*-*.
>
> > + .: [0-9a-fA-F]* 0 NOTYPE GLOBAL PROTECTED . protected
> > +#...
>
> Not sure why I think so, but I think the last "#..." should
> better be "#pass". Perhaps it's because things then look a bit
> clearer when the test fails.
>
> Another caveat is that the order of the symbols might change,
> the test fail, but the output still be valid. Perhaps different
> tests, each selecting one line, if it's important.
>
How about this one?
H.J.
----
2001-10-31 H.J. Lu <hjl@gnu.org>
* ld-elfvsb/elfvsb.exp: Add the "ld -r" test.
* ld-elfvsb/hidden0.d: New.
* ld-elfvsb/hidden1.d: New.
* ld-elfvsb/internal0.d: New.
* ld-elfvsb/internal1.d: New.
* ld-elfvsb/protected0.d: New.
* ld-elfvsb/protected1.d: New.
* ld-elfvsb/undef.d: New.
* ld-elfvsb/undef.s: New.
--- ld-elfvsb/define.s.vsb Wed Oct 31 13:45:07 2001
+++ ld-elfvsb/define.s Wed Oct 31 13:40:44 2001
@@ -0,0 +1,6 @@
+ .globl protected
+protected:
+ .globl hidden
+hidden:
+ .globl internal
+internal:
--- ld-elfvsb/elfvsb.exp.vsb Wed Jun 6 15:07:50 2001
+++ ld-elfvsb/elfvsb.exp Wed Oct 31 12:04:59 2001
@@ -42,6 +42,13 @@ if { [istarget *-*-linux*aout*] \
return
}
+set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
+foreach t $test_list {
+ # We need to strip the ".d", but can leave the dirname.
+ verbose [file rootname $t]
+ run_dump_test [file rootname $t]
+}
+
set tmpdir tmpdir
set SHCFLAG ""
--- ld-elfvsb/hidden0.d.vsb Wed Oct 31 13:45:07 2001
+++ ld-elfvsb/hidden0.d Wed Oct 31 13:49:11 2001
@@ -0,0 +1,10 @@
+#source: define.s
+#source: undef.s
+#ld: -r
+#readelf: -s
+
+Symbol table '.symtab' contains .* entries:
+ Num: Value[ ]+Size Type Bind Vis Ndx Name
+#...
+ .: [0-9a-fA-F]* 0 NOTYPE GLOBAL HIDDEN . hidden
+#pass
--- ld-elfvsb/hidden1.d.vsb Wed Oct 31 13:45:07 2001
+++ ld-elfvsb/hidden1.d Wed Oct 31 13:48:26 2001
@@ -0,0 +1,9 @@
+#source: undef.s
+#ld: -r
+#readelf: -s
+
+Symbol table '.symtab' contains .* entries:
+ Num: Value[ ]+Size Type Bind Vis Ndx Name
+#...
+ .: [0-9a-fA-F]* 0 NOTYPE GLOBAL HIDDEN UND hidden
+#pass
--- ld-elfvsb/internal0.d.vsb Wed Oct 31 13:45:07 2001
+++ ld-elfvsb/internal0.d Wed Oct 31 13:48:37 2001
@@ -0,0 +1,10 @@
+#source: define.s
+#source: undef.s
+#ld: -r
+#readelf: -s
+
+Symbol table '.symtab' contains .* entries:
+ Num: Value[ ]+Size Type Bind Vis Ndx Name
+#...
+ .: [0-9a-fA-F]* 0 NOTYPE GLOBAL INTERNAL . internal
+#pass
--- ld-elfvsb/internal1.d.vsb Wed Oct 31 13:45:07 2001
+++ ld-elfvsb/internal1.d Wed Oct 31 13:48:46 2001
@@ -0,0 +1,9 @@
+#source: undef.s
+#ld: -r
+#readelf: -s
+
+Symbol table '.symtab' contains .* entries:
+ Num: Value[ ]+Size Type Bind Vis Ndx Name
+#...
+ .: [0-9a-fA-F]* 0 NOTYPE GLOBAL INTERNAL UND internal
+#pass
--- ld-elfvsb/protected0.d.vsb Wed Oct 31 13:45:07 2001
+++ ld-elfvsb/protected0.d Wed Oct 31 13:48:57 2001
@@ -0,0 +1,10 @@
+#source: define.s
+#source: undef.s
+#ld: -r
+#readelf: -s
+
+Symbol table '.symtab' contains .* entries:
+ Num: Value[ ]+Size Type Bind Vis Ndx Name
+#...
+ .: [0-9a-fA-F]* 0 NOTYPE GLOBAL PROTECTED . protected
+#pass
--- ld-elfvsb/protected1.d.vsb Wed Oct 31 13:45:07 2001
+++ ld-elfvsb/protected1.d Wed Oct 31 13:49:04 2001
@@ -0,0 +1,9 @@
+#source: undef.s
+#ld: -r
+#readelf: -s
+
+Symbol table '.symtab' contains .* entries:
+ Num: Value[ ]+Size Type Bind Vis Ndx Name
+#...
+ .: [0-9a-fA-F]* 0 NOTYPE GLOBAL PROTECTED UND protected
+#pass
--- ld-elfvsb/undef.s.vsb Wed Oct 31 13:45:07 2001
+++ ld-elfvsb/undef.s Wed Oct 31 13:40:44 2001
@@ -0,0 +1,3 @@
+ .protected protected
+ .hidden hidden
+ .internal internal