This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
weak symbol testcase
- To: binutils at sourceware dot cygnus dot com
- Subject: weak symbol testcase
- From: Ulf Carlsson <ulfc at calypso dot engr dot sgi dot com>
- Date: Thu, 4 May 2000 21:21:59 -0700 (PDT)
Hi,
Here is a simple addition to a testsuite that unfortunately fails with the
current version binutils. The problem is that the current binutils generates
a GOT16/LO16 relocation to the weak symbol although the weak symbol should be
treated as an external symbol and only a GOT16 relocation should be generated.
Ulf
2000-05-04 Ulf Carlsson <ulfc@engr.sgi.com>
* gas/mips/jal-svr4pic.{s,d} gas/mips/jal-xgot.d: Add a jal to a weak
symbol.
Index: jal-svr4pic.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/mips/jal-svr4pic.d,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 jal-svr4pic.d
--- jal-svr4pic.d 1999/05/03 07:28:51 1.1.1.1
+++ jal-svr4pic.d 2000/05/05 04:12:01
@@ -30,10 +30,17 @@ Disassembly of section .text:
0+0040 <[^>]*> lw \$gp,0\(\$sp\)
0+0044 <[^>]*> nop
0+0048 <[^>]*> lw \$t9,0\(\$gp\)
-[ ]*48: R_MIPS_CALL16 external_text_label
+[ ]*48: R_MIPS_CALL16 weak_text_label
0+004c <[^>]*> nop
0+0050 <[^>]*> jalr \$t9
0+0054 <[^>]*> nop
0+0058 <[^>]*> lw \$gp,0\(\$sp\)
-0+005c <[^>]*> b 0+0000 <text_label>
+0+005c <[^>]*> nop
+0+0060 <[^>]*> lw \$t9,0\(\$gp\)
+[ ]*60: R_MIPS_CALL16 external_text_label
+0+0064 <[^>]*> nop
+0+0068 <[^>]*> jalr \$t9
+0+006c <[^>]*> nop
+0+0070 <[^>]*> lw \$gp,0\(\$sp\)
+0+0074 <[^>]*> b 0+0000 <text_label>
...
Index: jal-svr4pic.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/mips/jal-svr4pic.s,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 jal-svr4pic.s
--- jal-svr4pic.s 1999/05/03 07:28:51 1.1.1.1
+++ jal-svr4pic.s 2000/05/05 04:12:01
@@ -1,5 +1,7 @@
# Source file used to test the jal macro with -KPIC code.
+.weak weak_text_label
+
text_label:
.set noreorder
.cpload $25
@@ -8,8 +10,9 @@ text_label:
jal $25
jal $4,$25
jal text_label
+ jal weak_text_label
jal external_text_label
-
+
# Test j as well
j text_label
Index: jal-xgot.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/mips/jal-xgot.d,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 jal-xgot.d
--- jal-xgot.d 1999/05/03 07:28:51 1.1.1.1
+++ jal-xgot.d 2000/05/05 04:12:01
@@ -30,13 +30,22 @@ Disassembly of section .text:
0+003c <[^>]*> nop
0+0040 <[^>]*> lw \$gp,0\(\$sp\)
0+0044 <[^>]*> lui \$t9,0x0
-[ ]*44: R_MIPS_CALL_HI16 external_text_label
+[ ]*44: R_MIPS_CALL_HI16 weak_text_label
0+0048 <[^>]*> addu \$t9,\$t9,\$gp
0+004c <[^>]*> lw \$t9,0\(\$t9\)
-[ ]*4c: R_MIPS_CALL_LO16 external_text_label
+[ ]*4c: R_MIPS_CALL_LO16 weak_text_label
0+0050 <[^>]*> nop
0+0054 <[^>]*> jalr \$t9
0+0058 <[^>]*> nop
0+005c <[^>]*> lw \$gp,0\(\$sp\)
-0+0060 <[^>]*> b 0+0000 <text_label>
+0+0060 <[^>]*> lui \$t9,0x0
+[ ]*60: R_MIPS_CALL_HI16 external_text_label
+0+0064 <[^>]*> addu \$t9,\$t9,\$gp
+0+0068 <[^>]*> lw \$t9,0\(\$t9\)
+[ ]*68: R_MIPS_CALL_LO16 external_text_label
+0+006c <[^>]*> nop
+0+0070 <[^>]*> jalr \$t9
+0+0074 <[^>]*> nop
+0+0078 <[^>]*> lw \$gp,0\(\$sp\)
+0+007c <[^>]*> b 0+0000 <text_label>
...