This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: Add the "ld -r" test for ELF visibility.


On Wed, Oct 31, 2001 at 08:51:36AM -0800, cgd@broadcom.com wrote:
> nickc@cambridge.redhat.com ("Nick Clifton") writes:
> > > 2001-10-30  H.J. Lu <hjl@gnu.org>
> > > 
> > > 	* elflink.h (elf_link_output_extsym): Don't clear the visibility
> > > 	field for relocateable.
> > 
> > Approved.
> 
> So, shouldn't we even _try_ to add test cases to the ld testsuite to
> handle things like this?
> 

Here is the new test.


H.J.
----
2001-10-31  H.J. Lu  <hjl@gnu.org>

	* ld-elfvsb/elfvsb.exp: Add the "ld -r" test.

	* ld-elfvsb/visibility.s: New.

--- ld-elfvsb/elfvsb.exp.vsb	Wed Jun  6 15:07:50 2001
+++ ld-elfvsb/elfvsb.exp	Wed Oct 31 10:29:04 2001
@@ -42,6 +42,39 @@ if { [istarget *-*-linux*aout*] \
     return
 }
 
+if { ![ld_assemble $as $srcdir/$subdir/visibility.s tmpdir/visibility.o]
+     || ![ld_simple_link $ld tmpdir/relocateable.o "-r tmpdir/visibility.o"] } {
+    unresolved "visibility relocateable"
+} else {
+    global READELF
+
+    catch "exec $READELF -s tmpdir/relocateable.o > tmpdir/relocateable.output" got
+    if ![string match "" $got] then {
+	send_log "$got\n"
+	verbose "$got"
+	fail "visibility relocateable"
+    } else {
+	catch "exec grep protected tmpdir/relocateable.output | grep PROTECTED" got
+	if [regexp "PROTECTED" $got] then {
+	    pass "visibility relocateable (protected)"
+	} else {
+	    fail "visibility relocateable (protected)"
+	}
+	catch "exec grep hidden tmpdir/relocateable.output | grep HIDDEN" got
+	if [regexp "HIDDEN" $got] then {
+	    pass "visibility relocateable (hidden)"
+	} else {
+	    fail "visibility relocateable (hidden)"
+	}
+	catch "exec grep internal tmpdir/relocateable.output | grep INTERNAL" got
+	if [regexp "INTERNAL" $got] then {
+	    pass "visibility relocateable (internal)"
+	} else {
+	    fail "visibility relocateable (internal)"
+	}
+    }
+}
+
 set tmpdir tmpdir
 set SHCFLAG ""
 
--- ld-elfvsb/visibility.s.vsb	Wed Oct 31 09:17:47 2001
+++ ld-elfvsb/visibility.s	Wed Oct 31 09:18:16 2001
@@ -0,0 +1,3 @@
+	.protected protected
+	.hidden hidden
+	.internal internal


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]