This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH][GAS/ARM] Better handling of difference between a symbol and an undefined symbol.
Fails on alpha-dec-vms, arm-coff, arm-pe, rs6000-aix*, xscale-coff.
The dec-vma fail is due to objdump disliking -j .text, the others are,
I think, real failures.
gas/
* expr.c (expr): Correct returned segment value.
gas/testsuite/
* gas/all/fwdexp.d, * gas/all/fwdexp.s: New test.
* gas/all/gas.exp: Run it.
Index: gas/expr.c
===================================================================
RCS file: /cvs/src/src/gas/expr.c,v
retrieving revision 1.84
diff -u -p -r1.84 expr.c
--- gas/expr.c 2 Aug 2010 13:19:44 -0000 1.84
+++ gas/expr.c 28 Sep 2010 23:11:49 -0000
@@ -1969,16 +1969,27 @@ expr (int rankarg, /* Larger # is highe
if (retval != rightseg)
{
- if (! SEG_NORMAL (retval))
- {
- if (retval != undefined_section || SEG_NORMAL (rightseg))
- retval = rightseg;
- }
- else if (SEG_NORMAL (rightseg)
+ if (retval == undefined_section)
+ ;
+ else if (rightseg == undefined_section)
+ retval = rightseg;
+ else if (retval == expr_section)
+ ;
+ else if (rightseg == expr_section)
+ retval = rightseg;
+ else if (retval == reg_section)
+ ;
+ else if (rightseg == reg_section)
+ retval = rightseg;
+ else if (rightseg == absolute_section)
+ ;
+ else if (retval == absolute_section)
+ retval = rightseg;
#ifdef DIFF_EXPR_OK
- && op_left != O_subtract
+ else if (op_left == O_subtract)
+ ;
#endif
- )
+ else
as_bad (_("operation combines symbols in different segments"));
}
Index: gas/testsuite/gas/all/gas.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/all/gas.exp,v
retrieving revision 1.65
diff -u -p -r1.65 gas.exp
--- gas/testsuite/gas/all/gas.exp 23 Sep 2010 12:15:55 -0000 1.65
+++ gas/testsuite/gas/all/gas.exp 28 Sep 2010 23:11:53 -0000
@@ -86,6 +86,25 @@ case $target_triplet in {
}
}
+# aout relocs are often weird, so is mep and mips-ecoff. don't bother testing
+# som doesn't use a .text section
+# mmix doesn't like .L1:
+# ti addresses aren't octets.
+if { ![is_aout_format] } {
+ case $target_triplet in {
+ { hppa-*-hpux* } { }
+ { mep-*-* } { }
+ { mips*-*-ecoff* } { }
+ { mmix-*-* } { }
+ { tic30*-*-* } { }
+ { tic4x*-*-* } { }
+ { tic54x*-*-* } { }
+ default {
+ run_dump_test fwdexp
+ }
+ }
+}
+
# .set works differently on some targets.
# most of the tests won't work on targets that set linkrelax.
# 4 octet bytes confuse address matching on ti targets.
Index: gas/testsuite/gas/all/fwdexp.d
===================================================================
RCS file: gas/testsuite/gas/all/fwdexp.d
diff -N gas/testsuite/gas/all/fwdexp.d
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/all/fwdexp.d 29 Sep 2010 06:24:54 -0000
@@ -0,0 +1,11 @@
+#objdump: -rs -j .text
+#name: forward expression
+
+.*: .*
+
+RELOCATION RECORDS FOR .*
+OFFSET +TYPE +VALUE
+0+ .*(\.data|i)(|\+0xf+e|\+0xf+c|\+0xf+8)
+
+Contents of section .*
+ 0+ (0+|feff|fffe|fcffffff|fffffffc|f8ffffff ffffffff|ffffffff fffffff8) .*
Index: gas/testsuite/gas/all/fwdexp.s
===================================================================
RCS file: gas/testsuite/gas/all/fwdexp.s
diff -N gas/testsuite/gas/all/fwdexp.s
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/all/fwdexp.s 29 Sep 2010 06:24:54 -0000
@@ -0,0 +1,6 @@
+ .data
+i:
+
+ .text
+ .dc.a i + (. - .L1)
+.L1:
--
Alan Modra
Australia Development Lab, IBM