Properly fold _GLOBAL_OFFSET_TABLE_ in Intel syntax.
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 3 Nov 2010 14:18:43 +0000 (14:18 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 3 Nov 2010 14:18:43 +0000 (14:18 +0000)
gas/

2010-11-03  H.J. Lu  <hongjiu.lu@intel.com>

PR gas/12186
* config/tc-i386-intel.c (i386_intel_fold): Properly fold
_GLOBAL_OFFSET_TABLE_.

gas/testsuite/

2010-11-03  H.J. Lu  <hongjiu.lu@intel.com>

PR gas/12186
* gas/i386/gotpc.s: Add more _GLOBAL_OFFSET_TABLE_ test.
* gas/i386/gotpc.d: Updated.

gas/ChangeLog
gas/config/tc-i386-intel.c
gas/testsuite/ChangeLog
gas/testsuite/gas/i386/gotpc.d
gas/testsuite/gas/i386/gotpc.s

index 17ce85a1da520b99e165635e420a040f4a0ecf0e..5cb95f85ec7bbeed1add0ff7616ddbaa1bff86d6 100644 (file)
@@ -1,3 +1,9 @@
+2010-11-03  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR gas/12186
+       * config/tc-i386-intel.c (i386_intel_fold): Properly fold
+       _GLOBAL_OFFSET_TABLE_.
+
 2010-11-02  Joseph Myers  <joseph@codesourcery.com>
 
        * config/tc-tic6x.c (OPTION_MPID, OPTION_MPIC, OPTION_MNO_PIC):
index 64d6824da26bc5a216c8ad4625e5499a9e11785f..1e563b2d81c59a18282c95ae79ac9b0dbf7261e4 100644 (file)
@@ -227,15 +227,20 @@ static INLINE int i386_intel_check (const reg_entry *rreg,
 
 static INLINE void i386_intel_fold (expressionS *e, symbolS *sym)
 {
+  expressionS *exp = symbol_get_value_expression (sym);
   if (S_GET_SEGMENT (sym) == absolute_section)
     {
       offsetT val = e->X_add_number;
 
-      *e = *symbol_get_value_expression (sym);
+      *e = *exp;
       e->X_add_number += val;
     }
   else
     {
+      if (exp->X_op == O_symbol
+         && strcmp (S_GET_NAME (exp->X_add_symbol),
+                    GLOBAL_OFFSET_TABLE_NAME) == 0)
+       sym = exp->X_add_symbol;
       e->X_add_symbol = sym;
       e->X_op_symbol = NULL;
       e->X_op = O_symbol;
index e7936f6c990b3b44bb3c1ff95bf39684e0b79557..07689b6eb598d8f81721ebed058833162d1d553e 100644 (file)
@@ -1,3 +1,9 @@
+2010-11-03  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR gas/12186
+       * gas/i386/gotpc.s: Add more _GLOBAL_OFFSET_TABLE_ test.
+       * gas/i386/gotpc.d: Updated.
+
 2010-11-02  Joseph Myers  <joseph@codesourcery.com>
 
        * gas/tic6x/attr-array-directive-1.d,
index ef79cbd783225832854a60e5a4a9dfe69944a311..30faabd0bf9007167246be7dc4720a3df9ebcd39 100644 (file)
@@ -51,4 +51,5 @@ Disassembly of section .text:
   e4:  00 00 [         ]*add    %al,\(%eax\)   e4: (R_386_)?GOTOFF     _GLOBAL_OFFSET_TABLE_
   e6:  00 00 [         ]*add    %al,\(%eax\)
   e8:  8b 83 00 00 00 00 [     ]*mov    0x0\(%ebx\),%eax       ea: (R_386_)?GOTOFF     _GLOBAL_OFFSET_TABLE_
+  ee:  81 c3 02 00 00 00 [     ]*add    \$0x2,%ebx     f0: (R_386_)GOTPC       _GLOBAL_OFFSET_TABLE_
 #pass
index fc771f6cff55b2e9fcebd3f6ee7c07202e21ca79..150bd1645f5d5f3f814b1214944df25af82ac1a7 100644 (file)
@@ -39,3 +39,6 @@ test:
        .long _GLOBAL_OFFSET_TABLE_+[.-test]
        .long _GLOBAL_OFFSET_TABLE_@GOTOFF
        movl _GLOBAL_OFFSET_TABLE_@GOTOFF (%ebx), %eax
+
+       .intel_syntax noprefix
+       add     ebx, OFFSET FLAT:_GLOBAL_OFFSET_TABLE_
This page took 0.030992 seconds and 4 git commands to generate.