gas/
authorBob Wilson <bob.wilson@acm.org>
Thu, 13 Dec 2007 19:03:45 +0000 (19:03 +0000)
committerBob Wilson <bob.wilson@acm.org>
Thu, 13 Dec 2007 19:03:45 +0000 (19:03 +0000)
* config/tc-xtensa.c (xg_symbolic_immeds_fit): Relax for weak
references but not weak definitions.
gas/testsuite/
* gas/xtensa/all.exp: Run new weak-call test.
* gas/xtensa/weak-call.d: New.
* gas/xtensa/weak-call.s: New.

gas/ChangeLog
gas/config/tc-xtensa.c
gas/testsuite/ChangeLog
gas/testsuite/gas/xtensa/all.exp
gas/testsuite/gas/xtensa/weak-call.d [new file with mode: 0644]
gas/testsuite/gas/xtensa/weak-call.s [new file with mode: 0644]

index 5748053bdabe67faa11b28d17032f8872e00c785..a68a38f0f4a5d6f5a4d5d886ffe14141f0ef1d30 100644 (file)
@@ -1,3 +1,8 @@
+2007-12-13  Bob Wilson  <bob.wilson@acm.org>
+
+       * config/tc-xtensa.c (xg_symbolic_immeds_fit): Relax for weak
+       references but not weak definitions.
+
 2007-12-12  Bob Wilson  <bob.wilson@acm.org>
 
        * config/tc-xtensa.c (xg_symbolic_immeds_fit): Do not relax calls to
index 051f79fd6f893a6060f0a92fd83def1186f65e12..e632ef39e3eba0b42e733e5616f9ebcbc93a2910 100644 (file)
@@ -3241,9 +3241,15 @@ xg_symbolic_immeds_fit (const TInsn *insn,
              || S_GET_SEGMENT (expr->X_add_symbol) != pc_seg)
            {
              /* For a direct call with --no-longcalls, be optimistic and
-                assume it will be in range.  */
+                assume it will be in range.  If the symbol is weak and
+                undefined, it may remain undefined at link-time, in which
+                case it will have a zero value and almost certainly be out
+                of range for a direct call; thus, relax for undefined weak
+                symbols even if longcalls is not enabled.  */
              if (is_direct_call_opcode (insn->opcode)
-                 && ! pc_frag->tc_frag_data.use_longcalls)
+                 && ! pc_frag->tc_frag_data.use_longcalls
+                 && (! S_IS_WEAK (expr->X_add_symbol)
+                     || S_IS_DEFINED (expr->X_add_symbol)))
                return TRUE;
 
              return FALSE;
index 9de18549dd23963410b0e06e4f5bd505c474e489..c95d172634383ccc850f8036a3a9558ede97fbd7 100644 (file)
@@ -1,3 +1,9 @@
+2007-12-13  Bob Wilson  <bob.wilson@acm.org>
+
+       * gas/xtensa/all.exp: Run new weak-call test.
+       * gas/xtensa/weak-call.d: New.
+       * gas/xtensa/weak-call.s: New.
+
 2007-12-11  Catherine Moore  <clm@codesourcery.com>
 
         gas/elf/symtab.s: New test.
index d4b24930fed6cbcab2847edf7e5986ef8f0728fa..85c071608df27e4ff758f22cbcbcd90d98a7f67b 100644 (file)
@@ -80,6 +80,7 @@ if [istarget xtensa*-*-*] then {
 
     run_dump_test "short_branch_offset"
     run_dump_test "pcrel"
+    run_dump_test "weak-call"
 }
 
 if [info exists errorInfo] then {
diff --git a/gas/testsuite/gas/xtensa/weak-call.d b/gas/testsuite/gas/xtensa/weak-call.d
new file mode 100644 (file)
index 0000000..0b8d84b
--- /dev/null
@@ -0,0 +1,11 @@
+#as: 
+#objdump: -r -j .text
+#name: relaxing calls to weak symbols
+
+.*: +file format .*xtensa.*
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET   TYPE              VALUE 
+00000000 R_XTENSA_SLOT0_OP  weakdef
+00000003 R_XTENSA_SLOT0_OP  \.literal
+00000003 R_XTENSA_ASM_EXPAND  weakref
diff --git a/gas/testsuite/gas/xtensa/weak-call.s b/gas/testsuite/gas/xtensa/weak-call.s
new file mode 100644 (file)
index 0000000..d6800c5
--- /dev/null
@@ -0,0 +1,8 @@
+       .text
+       .begin  no-longcalls
+       .weak   weakdef
+       call8   weakdef
+weakdef:
+       .weak   weakref
+       call8   weakref
+       .end    no-longcalls
This page took 0.034846 seconds and 4 git commands to generate.