diff options
author | Alan Modra <amodra@gmail.com> | 2009-10-28 08:21:45 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2009-10-28 08:21:45 +0000 |
commit | 14610ad10e3d4b84565d3590eaa9582f9793f743 (patch) | |
tree | 84257b7c5d61853f7ffe9838e493a02e228315cb /gas | |
parent | c92e840bf638679c637dd319de240d90264a7e9c (diff) | |
download | gdb-14610ad10e3d4b84565d3590eaa9582f9793f743.zip gdb-14610ad10e3d4b84565d3590eaa9582f9793f743.tar.gz gdb-14610ad10e3d4b84565d3590eaa9582f9793f743.tar.bz2 |
PR gas/10856
* expr.c (resolve_expression): Only add "left" value to O_symbol
expression when the symbol is undefined and different from the
original symbol. Simplify negative logic.
* gas/i386/intelpic.d: Correct.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 7 | ||||
-rw-r--r-- | gas/expr.c | 21 | ||||
-rw-r--r-- | gas/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/intelpic.d | 2 |
4 files changed, 25 insertions, 9 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 62c8f8f..6e216b1 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2009-10-28 Alan Modra <amodra@bigpond.net.au> + + PR gas/10856 + * expr.c (resolve_expression): Only add "left" value to O_symbol + expression when the symbol is undefined and different from the + original symbol. Simplify negative logic. + 2009-10-27 Tristan Gingold <gingold@adacore.com> * config/tc-avr.c (md_pseudo_table): Add dwarf2 debug pseudo. @@ -1997,6 +1997,7 @@ resolve_expression (expressionS *expressionP) /* Help out with CSE. */ valueT final_val = expressionP->X_add_number; symbolS *add_symbol = expressionP->X_add_symbol; + symbolS *orig_add_symbol = add_symbol; symbolS *op_symbol = expressionP->X_op_symbol; operatorT op = expressionP->X_op; valueT left, right; @@ -2078,6 +2079,7 @@ resolve_expression (expressionS *expressionP) left = right; seg_left = seg_right; add_symbol = op_symbol; + orig_add_symbol = expressionP->X_op_symbol; op = O_symbol; break; } @@ -2122,18 +2124,19 @@ resolve_expression (expressionS *expressionP) { if (op == O_bit_exclusive_or || op == O_bit_inclusive_or) { - if (seg_right != absolute_section || right != 0) + if (!(seg_right == absolute_section && right == 0)) { seg_left = seg_right; left = right; add_symbol = op_symbol; + orig_add_symbol = expressionP->X_op_symbol; } op = O_symbol; break; } else if (op == O_left_shift || op == O_right_shift) { - if (seg_left != absolute_section || left != 0) + if (!(seg_left == absolute_section && left == 0)) { op = O_symbol; break; @@ -2149,6 +2152,7 @@ resolve_expression (expressionS *expressionP) seg_left = seg_right; left = right; add_symbol = op_symbol; + orig_add_symbol = expressionP->X_op_symbol; op = O_symbol; break; } @@ -2158,11 +2162,11 @@ resolve_expression (expressionS *expressionP) op = O_symbol; break; } - else if (left != right - || ((seg_left != reg_section || seg_right != reg_section) - && (seg_left != undefined_section - || seg_right != undefined_section - || add_symbol != op_symbol))) + else if (!(left == right + && ((seg_left == reg_section && seg_right == reg_section) + || (seg_left == undefined_section + && seg_right == undefined_section + && add_symbol == op_symbol)))) return 0; else if (op == O_bit_and || op == O_bit_inclusive_or) { @@ -2233,7 +2237,8 @@ resolve_expression (expressionS *expressionP) op = O_constant; else if (seg_left == reg_section && final_val == 0) op = O_register; - else if (add_symbol != expressionP->X_add_symbol) + else if (seg_left == undefined_section + && add_symbol != orig_add_symbol) final_val += left; expressionP->X_add_symbol = add_symbol; } diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index e0008a2..a101c5f 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2009-10-28 Alan Modra <amodra@bigpond.net.au> + + * gas/i386/intelpic.d: Correct. + 2009-10-25 Arnold Metselaar <arnold.metselaar@planet.nl> * gas/z80/equ.d, gas/z80/equ.s: Added test of parsing equ directives. diff --git a/gas/testsuite/gas/i386/intelpic.d b/gas/testsuite/gas/i386/intelpic.d index e1eea01..5af7389 100644 --- a/gas/testsuite/gas/i386/intelpic.d +++ b/gas/testsuite/gas/i386/intelpic.d @@ -12,6 +12,6 @@ Disassembly of section .text: 0+1 <bar>: [ ]*[a-f0-9]+: 8d 83 14 00 00 00 lea 0x14\(%ebx\),%eax [ ]*[a-f0-9]+: 8b 83 00 00 00 00 mov 0x0\(%ebx\),%eax -[ ]*[a-f0-9]+: ff 24 85 1a 00 00 00 jmp \*0x1a\(,%eax,4\) +[ ]*[a-f0-9]+: ff 24 85 0d 00 00 00 jmp \*0xd\(,%eax,4\) [ ]*[a-f0-9]+: 8d 83 14 00 00 00 lea 0x14\(%ebx\),%eax #pass |