patches/binutils/2.13.90.0.2/rh62-binutils-2.13.90.0.2-gotpc.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue May 01 16:49:15 2007 +0000 (2007-05-01)
changeset 56 07a6a48962b7
permissions -rw-r--r--
Merge patches sent by Robert P. J. Day <rpjday@mindspring.com>.
Warning: the buildroot folks purposedly removed the skip-comment patch but didn't really said why. Keeping it for the sake of having it in svn just in case (removing it will be easier thant not having it at all).
yann@1
     1
2002-08-03  Jakub Jelinek  <jakub@redhat.com>
yann@1
     2
yann@1
     3
	* config/tc-i386.c (output_insn): Save frag_now and frag_now_fix ()
yann@1
     4
	at start of insn, pass it to output_disp and output_imm.
yann@1
     5
	(output_disp): Added arguments.  If _GLOBAL_OFFSET_TABLE_ is seen
yann@1
     6
	in displacement for R_386_32 reloc, use R_386_GOTPC and compute
yann@1
     7
	properly addend.
yann@1
     8
	(output_imm): Added arguments.  Compute properly addend for
yann@1
     9
	R_386_GOTPC.
yann@1
    10
	(md_apply_fix3): Remove R_386_GOTPC handling.
yann@1
    11
	* testsuite/gas/i386/gotpc.s: New.
yann@1
    12
	* testsuite/gas/i386/gotpc.d: New.
yann@1
    13
	* testsuite/gas/i386/i386.exp: Add gotpc test.
yann@1
    14
yann@1
    15
--- binutils/gas/config/tc-i386.c.jj	2002-07-18 11:35:39.000000000 +0200
yann@1
    16
+++ binutils/gas/config/tc-i386.c	2002-08-02 21:13:18.000000000 +0200
yann@1
    17
@@ -104,8 +104,10 @@ static void output_insn PARAMS ((void));
yann@1
    18
 static void output_branch PARAMS ((void));
yann@1
    19
 static void output_jump PARAMS ((void));
yann@1
    20
 static void output_interseg_jump PARAMS ((void));
yann@1
    21
-static void output_imm PARAMS ((void));
yann@1
    22
-static void output_disp PARAMS ((void));
yann@1
    23
+static void output_imm PARAMS ((fragS *insn_start_frag,
yann@1
    24
+				offsetT insn_start_off));
yann@1
    25
+static void output_disp PARAMS ((fragS *insn_start_frag,
yann@1
    26
+				 offsetT insn_start_off));
yann@1
    27
 #ifndef I386COFF
yann@1
    28
 static void s_bss PARAMS ((int));
yann@1
    29
 #endif
yann@1
    30
@@ -3101,14 +3103,21 @@ output_interseg_jump ()
yann@1
    31
   md_number_to_chars (p + size, (valueT) i.op[0].imms->X_add_number, 2);
yann@1
    32
 }
yann@1
    33
 
yann@1
    34
+
yann@1
    35
 static void
yann@1
    36
 output_insn ()
yann@1
    37
 {
yann@1
    38
+  fragS *insn_start_frag;
yann@1
    39
+  offsetT insn_start_off;
yann@1
    40
+
yann@1
    41
   /* Tie dwarf2 debug info to the address at the start of the insn.
yann@1
    42
      We can't do this after the insn has been output as the current
yann@1
    43
      frag may have been closed off.  eg. by frag_var.  */
yann@1
    44
   dwarf2_emit_insn (0);
yann@1
    45
 
yann@1
    46
+  insn_start_frag = frag_now;
yann@1
    47
+  insn_start_off = frag_now_fix ();
yann@1
    48
+
yann@1
    49
   /* Output jumps.  */
yann@1
    50
   if (i.tm.opcode_modifier & Jump)
yann@1
    51
     output_branch ();
yann@1
    52
@@ -3179,10 +3188,10 @@ output_insn ()
yann@1
    53
 	}
yann@1
    54
 
yann@1
    55
       if (i.disp_operands)
yann@1
    56
-	output_disp ();
yann@1
    57
+	output_disp (insn_start_frag, insn_start_off);
yann@1
    58
 
yann@1
    59
       if (i.imm_operands)
yann@1
    60
-	output_imm ();
yann@1
    61
+	output_imm (insn_start_frag, insn_start_off);
yann@1
    62
     }
yann@1
    63
 
yann@1
    64
 #ifdef DEBUG386
yann@1
    65
@@ -3194,7 +3203,9 @@ output_insn ()
yann@1
    66
 }
yann@1
    67
 
yann@1
    68
 static void
yann@1
    69
-output_disp ()
yann@1
    70
+output_disp (insn_start_frag, insn_start_off)
yann@1
    71
+    fragS *insn_start_frag;
yann@1
    72
+    offsetT insn_start_off;
yann@1
    73
 {
yann@1
    74
   char *p;
yann@1
    75
   unsigned int n;
yann@1
    76
@@ -3224,6 +3235,7 @@ output_disp ()
yann@1
    77
 	    }
yann@1
    78
 	  else
yann@1
    79
 	    {
yann@1
    80
+	      RELOC_ENUM reloc_type;
yann@1
    81
 	      int size = 4;
yann@1
    82
 	      int sign = 0;
yann@1
    83
 	      int pcrel = (i.flags[n] & Operand_PCrel) != 0;
yann@1
    84
@@ -3266,16 +3278,50 @@ output_disp ()
yann@1
    85
 		}
yann@1
    86
 
yann@1
    87
 	      p = frag_more (size);
yann@1
    88
+	      reloc_type = reloc (size, pcrel, sign, i.reloc[n]);
yann@1
    89
+#ifdef BFD_ASSEMBLER
yann@1
    90
+	      if (reloc_type == BFD_RELOC_32
yann@1
    91
+		  && GOT_symbol
yann@1
    92
+		  && GOT_symbol == i.op[n].disps->X_add_symbol
yann@1
    93
+		  && (i.op[n].disps->X_op == O_symbol
yann@1
    94
+		      || (i.op[n].disps->X_op == O_add
yann@1
    95
+			  && ((symbol_get_value_expression
yann@1
    96
+			       (i.op[n].disps->X_op_symbol)->X_op)
yann@1
    97
+			      == O_subtract))))
yann@1
    98
+		{
yann@1
    99
+		  offsetT add;
yann@1
   100
+
yann@1
   101
+		  if (insn_start_frag == frag_now)
yann@1
   102
+		    add = (p - frag_now->fr_literal) - insn_start_off;
yann@1
   103
+		  else
yann@1
   104
+		    {
yann@1
   105
+		      fragS *fr;
yann@1
   106
+
yann@1
   107
+		      add = insn_start_frag->fr_fix - insn_start_off;
yann@1
   108
+		      for (fr = insn_start_frag->fr_next;
yann@1
   109
+			   fr && fr != frag_now; fr = fr->fr_next)
yann@1
   110
+			add += fr->fr_fix;
yann@1
   111
+		      add += p - frag_now->fr_literal;
yann@1
   112
+		    }
yann@1
   113
+
yann@1
   114
+		  /* We don't support dynamic linking on x86-64 yet.  */
yann@1
   115
+		  if (flag_code == CODE_64BIT)
yann@1
   116
+		    abort ();
yann@1
   117
+		  reloc_type = BFD_RELOC_386_GOTPC;
yann@1
   118
+		  i.op[n].disps->X_add_number += add;
yann@1
   119
+		}
yann@1
   120
+#endif
yann@1
   121
 	      fix_new_exp (frag_now, p - frag_now->fr_literal, size,
yann@1
   122
-			   i.op[n].disps, pcrel,
yann@1
   123
-			   reloc (size, pcrel, sign, i.reloc[n]));
yann@1
   124
+			   i.op[n].disps, pcrel, reloc_type);
yann@1
   125
 	    }
yann@1
   126
 	}
yann@1
   127
     }
yann@1
   128
 }
yann@1
   129
 
yann@1
   130
 static void
yann@1
   131
-output_imm ()
yann@1
   132
+output_imm (insn_start_frag, insn_start_off)
yann@1
   133
+    fragS *insn_start_frag;
yann@1
   134
+    offsetT insn_start_off;
yann@1
   135
 {
yann@1
   136
   char *p;
yann@1
   137
   unsigned int n;
yann@1
   138
@@ -3328,6 +3374,48 @@ output_imm ()
yann@1
   139
 	      p = frag_more (size);
yann@1
   140
 	      reloc_type = reloc (size, 0, sign, i.reloc[n]);
yann@1
   141
 #ifdef BFD_ASSEMBLER
yann@1
   142
+	      /*   This is tough to explain.  We end up with this one if we
yann@1
   143
+	       * have operands that look like
yann@1
   144
+	       * "_GLOBAL_OFFSET_TABLE_+[.-.L284]".  The goal here is to
yann@1
   145
+	       * obtain the absolute address of the GOT, and it is strongly
yann@1
   146
+	       * preferable from a performance point of view to avoid using
yann@1
   147
+	       * a runtime relocation for this.  The actual sequence of
yann@1
   148
+	       * instructions often look something like:
yann@1
   149
+	       *
yann@1
   150
+	       *	call	.L66
yann@1
   151
+	       * .L66:
yann@1
   152
+	       *	popl	%ebx
yann@1
   153
+	       *	addl	$_GLOBAL_OFFSET_TABLE_+[.-.L66],%ebx
yann@1
   154
+	       *
yann@1
   155
+	       *   The call and pop essentially return the absolute address
yann@1
   156
+	       * of the label .L66 and store it in %ebx.  The linker itself
yann@1
   157
+	       * will ultimately change the first operand of the addl so
yann@1
   158
+	       * that %ebx points to the GOT, but to keep things simple, the
yann@1
   159
+	       * .o file must have this operand set so that it generates not
yann@1
   160
+	       * the absolute address of .L66, but the absolute address of
yann@1
   161
+	       * itself.  This allows the linker itself simply treat a GOTPC
yann@1
   162
+	       * relocation as asking for a pcrel offset to the GOT to be
yann@1
   163
+	       * added in, and the addend of the relocation is stored in the
yann@1
   164
+	       * operand field for the instruction itself.
yann@1
   165
+	       *
yann@1
   166
+	       *   Our job here is to fix the operand so that it would add
yann@1
   167
+	       * the correct offset so that %ebx would point to itself.  The
yann@1
   168
+	       * thing that is tricky is that .-.L66 will point to the
yann@1
   169
+	       * beginning of the instruction, so we need to further modify
yann@1
   170
+	       * the operand so that it will point to itself.  There are
yann@1
   171
+	       * other cases where you have something like:
yann@1
   172
+	       *
yann@1
   173
+	       *	.long	$_GLOBAL_OFFSET_TABLE_+[.-.L66]
yann@1
   174
+	       *
yann@1
   175
+	       * and here no correction would be required.  Internally in
yann@1
   176
+	       * the assembler we treat operands of this form as not being
yann@1
   177
+	       * pcrel since the '.' is explicitly mentioned, and I wonder
yann@1
   178
+	       * whether it would simplify matters to do it this way.  Who
yann@1
   179
+	       * knows.  In earlier versions of the PIC patches, the
yann@1
   180
+	       * pcrel_adjust field was used to store the correction, but
yann@1
   181
+	       * since the expression is not pcrel, I felt it would be
yann@1
   182
+	       * confusing to do it this way.  */
yann@1
   183
+
yann@1
   184
 	      if (reloc_type == BFD_RELOC_32
yann@1
   185
 		  && GOT_symbol
yann@1
   186
 		  && GOT_symbol == i.op[n].imms->X_add_symbol
yann@1
   187
@@ -3337,11 +3425,26 @@ output_imm ()
yann@1
   188
 			       (i.op[n].imms->X_op_symbol)->X_op)
yann@1
   189
 			      == O_subtract))))
yann@1
   190
 		{
yann@1
   191
+		  offsetT add;
yann@1
   192
+
yann@1
   193
+		  if (insn_start_frag == frag_now)
yann@1
   194
+		    add = (p - frag_now->fr_literal) - insn_start_off;
yann@1
   195
+		  else
yann@1
   196
+		    {
yann@1
   197
+		      fragS *fr;
yann@1
   198
+
yann@1
   199
+		      add = insn_start_frag->fr_fix - insn_start_off;
yann@1
   200
+		      for (fr = insn_start_frag->fr_next;
yann@1
   201
+			   fr && fr != frag_now; fr = fr->fr_next)
yann@1
   202
+			add += fr->fr_fix;
yann@1
   203
+		      add += p - frag_now->fr_literal;
yann@1
   204
+		    }
yann@1
   205
+
yann@1
   206
 		  /* We don't support dynamic linking on x86-64 yet.  */
yann@1
   207
 		  if (flag_code == CODE_64BIT)
yann@1
   208
 		    abort ();
yann@1
   209
 		  reloc_type = BFD_RELOC_386_GOTPC;
yann@1
   210
-		  i.op[n].imms->X_add_number += 3;
yann@1
   211
+		  i.op[n].imms->X_add_number += add;
yann@1
   212
 		}
yann@1
   213
 #endif
yann@1
   214
 	      fix_new_exp (frag_now, p - frag_now->fr_literal, size,
yann@1
   215
@@ -4542,48 +4645,6 @@ md_apply_fix3 (fixP, valP, seg)
yann@1
   216
 	   runtime we merely add the offset to the actual PLT entry.  */
yann@1
   217
 	value = -4;
yann@1
   218
 	break;
yann@1
   219
-      case BFD_RELOC_386_GOTPC:
yann@1
   220
-
yann@1
   221
-/*   This is tough to explain.  We end up with this one if we have
yann@1
   222
- * operands that look like "_GLOBAL_OFFSET_TABLE_+[.-.L284]".  The goal
yann@1
   223
- * here is to obtain the absolute address of the GOT, and it is strongly
yann@1
   224
- * preferable from a performance point of view to avoid using a runtime
yann@1
   225
- * relocation for this.  The actual sequence of instructions often look
yann@1
   226
- * something like:
yann@1
   227
- *
yann@1
   228
- *	call	.L66
yann@1
   229
- * .L66:
yann@1
   230
- *	popl	%ebx
yann@1
   231
- *	addl	$_GLOBAL_OFFSET_TABLE_+[.-.L66],%ebx
yann@1
   232
- *
yann@1
   233
- *   The call and pop essentially return the absolute address of
yann@1
   234
- * the label .L66 and store it in %ebx.  The linker itself will
yann@1
   235
- * ultimately change the first operand of the addl so that %ebx points to
yann@1
   236
- * the GOT, but to keep things simple, the .o file must have this operand
yann@1
   237
- * set so that it generates not the absolute address of .L66, but the
yann@1
   238
- * absolute address of itself.  This allows the linker itself simply
yann@1
   239
- * treat a GOTPC relocation as asking for a pcrel offset to the GOT to be
yann@1
   240
- * added in, and the addend of the relocation is stored in the operand
yann@1
   241
- * field for the instruction itself.
yann@1
   242
- *
yann@1
   243
- *   Our job here is to fix the operand so that it would add the correct
yann@1
   244
- * offset so that %ebx would point to itself.  The thing that is tricky is
yann@1
   245
- * that .-.L66 will point to the beginning of the instruction, so we need
yann@1
   246
- * to further modify the operand so that it will point to itself.
yann@1
   247
- * There are other cases where you have something like:
yann@1
   248
- *
yann@1
   249
- *	.long	$_GLOBAL_OFFSET_TABLE_+[.-.L66]
yann@1
   250
- *
yann@1
   251
- * and here no correction would be required.  Internally in the assembler
yann@1
   252
- * we treat operands of this form as not being pcrel since the '.' is
yann@1
   253
- * explicitly mentioned, and I wonder whether it would simplify matters
yann@1
   254
- * to do it this way.  Who knows.  In earlier versions of the PIC patches,
yann@1
   255
- * the pcrel_adjust field was used to store the correction, but since the
yann@1
   256
- * expression is not pcrel, I felt it would be confusing to do it this
yann@1
   257
- * way.  */
yann@1
   258
-
yann@1
   259
-	value -= 1;
yann@1
   260
-	break;
yann@1
   261
       case BFD_RELOC_386_GOT32:
yann@1
   262
       case BFD_RELOC_386_TLS_GD:
yann@1
   263
       case BFD_RELOC_386_TLS_LDM:
yann@1
   264
--- binutils/gas/testsuite/gas/i386/gotpc.s.jj	2002-08-02 21:17:57.000000000 +0200
yann@1
   265
+++ binutils/gas/testsuite/gas/i386/gotpc.s	2002-08-03 22:55:47.000000000 +0200
yann@1
   266
@@ -0,0 +1,40 @@
yann@1
   267
+	.text
yann@1
   268
+test:
yann@1
   269
+	addl $_GLOBAL_OFFSET_TABLE_+[.-test], %eax
yann@1
   270
+	addl $_GLOBAL_OFFSET_TABLE_+[.-test], %ebx
yann@1
   271
+	addl $_GLOBAL_OFFSET_TABLE_, %eax
yann@1
   272
+	addl $_GLOBAL_OFFSET_TABLE_, %ebx
yann@1
   273
+	leal _GLOBAL_OFFSET_TABLE+[.-test](%eax), %ebx
yann@1
   274
+	leal _GLOBAL_OFFSET_TABLE+[.-test](%ebx), %eax
yann@1
   275
+	leal _GLOBAL_OFFSET_TABLE+[.-test](%eax), %eax
yann@1
   276
+	leal _GLOBAL_OFFSET_TABLE+[.-test](%ebx), %ebx
yann@1
   277
+	subl $_GLOBAL_OFFSET_TABLE_+[.-test], %eax
yann@1
   278
+	subl $_GLOBAL_OFFSET_TABLE_+[.-test], %ebx
yann@1
   279
+	subl $_GLOBAL_OFFSET_TABLE_, %eax
yann@1
   280
+	subl $_GLOBAL_OFFSET_TABLE_, %ebx
yann@1
   281
+	orl $_GLOBAL_OFFSET_TABLE_+[.-test], %eax
yann@1
   282
+	orl $_GLOBAL_OFFSET_TABLE_+[.-test], %ebx
yann@1
   283
+	orl $_GLOBAL_OFFSET_TABLE_, %eax
yann@1
   284
+	orl $_GLOBAL_OFFSET_TABLE_, %ebx
yann@1
   285
+	movl $_GLOBAL_OFFSET_TABLE_+[.-test], %eax
yann@1
   286
+	movl $_GLOBAL_OFFSET_TABLE_+[.-test], %ebx
yann@1
   287
+	movl $_GLOBAL_OFFSET_TABLE_, %eax
yann@1
   288
+	movl $_GLOBAL_OFFSET_TABLE_, %ebx
yann@1
   289
+	movl $_GLOBAL_OFFSET_TABLE_+[.-test], foo
yann@1
   290
+	movl $_GLOBAL_OFFSET_TABLE_+[.-test], %gs:foo
yann@1
   291
+	gs; movl $_GLOBAL_OFFSET_TABLE_+[.-test], foo
yann@1
   292
+	movl $_GLOBAL_OFFSET_TABLE_+[.-test], _GLOBAL_OFFSET_TABLE_
yann@1
   293
+	movl _GLOBAL_OFFSET_TABLE_+[.-test], %eax
yann@1
   294
+	movl _GLOBAL_OFFSET_TABLE_+[.-test], %ebx
yann@1
   295
+	movl %eax, _GLOBAL_OFFSET_TABLE_+[.-test]
yann@1
   296
+	movl %ebx, _GLOBAL_OFFSET_TABLE_+[.-test]
yann@1
   297
+	movl %eax, %gs:_GLOBAL_OFFSET_TABLE_+[.-test]
yann@1
   298
+	movl %ebx, %gs:_GLOBAL_OFFSET_TABLE_+[.-test]
yann@1
   299
+	gs; movl %eax, _GLOBAL_OFFSET_TABLE_+[.-test]
yann@1
   300
+	gs; movl %ebx, _GLOBAL_OFFSET_TABLE_+[.-test]
yann@1
   301
+	leal _GLOBAL_OFFSET_TABLE_@GOTOFF(%ebx), %eax
yann@1
   302
+	leal _GLOBAL_OFFSET_TABLE_@GOTOFF(%ebx), %ebx
yann@1
   303
+	movl _GLOBAL_OFFSET_TABLE_@GOTOFF(%ebx), %eax
yann@1
   304
+	movl _GLOBAL_OFFSET_TABLE_@GOTOFF(%ebx), %ebx
yann@1
   305
+	.long _GLOBAL_OFFSET_TABLE_+[.-test]
yann@1
   306
+	.long _GLOBAL_OFFSET_TABLE_@GOTOFF
yann@1
   307
--- binutils/gas/testsuite/gas/i386/gotpc.d.jj	2002-08-02 21:18:43.000000000 +0200
yann@1
   308
+++ binutils/gas/testsuite/gas/i386/gotpc.d	2002-08-03 23:05:43.000000000 +0200
yann@1
   309
@@ -0,0 +1,52 @@
yann@1
   310
+#objdump: -drw
yann@1
   311
+#name: i386 gotpc
yann@1
   312
+
yann@1
   313
+.*: +file format .*
yann@1
   314
+
yann@1
   315
+Disassembly of section .text:
yann@1
   316
+
yann@1
   317
+0+000 <test>:
yann@1
   318
+   0:	05 01 00 00 00 [ 	]*add    \$0x1,%eax	1: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   319
+   5:	81 c3 07 00 00 00 [ 	]*add    \$0x7,%ebx	7: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   320
+   b:	05 01 00 00 00 [ 	]*add    \$0x1,%eax	c: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   321
+  10:	81 c3 02 00 00 00 [ 	]*add    \$0x2,%ebx	12: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   322
+  16:	8d 98 16 00 00 00 [ 	]*lea    0x16\(%eax\),%ebx	18: (R_386_)?(dir)?32	_GLOBAL_OFFSET_TABLE
yann@1
   323
+  1c:	8d 83 1c 00 00 00 [ 	]*lea    0x1c\(%ebx\),%eax	1e: (R_386_)?(dir)?32	_GLOBAL_OFFSET_TABLE
yann@1
   324
+  22:	8d 80 22 00 00 00 [ 	]*lea    0x22\(%eax\),%eax	24: (R_386_)?(dir)?32	_GLOBAL_OFFSET_TABLE
yann@1
   325
+  28:	8d 9b 28 00 00 00 [ 	]*lea    0x28\(%ebx\),%ebx	2a: (R_386_)?(dir)?32	_GLOBAL_OFFSET_TABLE
yann@1
   326
+  2e:	2d 2f 00 00 00 [ 	]*sub    \$0x2f,%eax	2f: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   327
+  33:	81 eb 35 00 00 00 [ 	]*sub    \$0x35,%ebx	35: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   328
+  39:	2d 01 00 00 00 [ 	]*sub    \$0x1,%eax	3a: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   329
+  3e:	81 eb 02 00 00 00 [ 	]*sub    \$0x2,%ebx	40: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   330
+  44:	0d 45 00 00 00 [ 	]*or     \$0x45,%eax	45: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   331
+  49:	81 cb 4b 00 00 00 [ 	]*or     \$0x4b,%ebx	4b: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   332
+  4f:	0d 01 00 00 00 [ 	]*or     \$0x1,%eax	50: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   333
+  54:	81 cb 02 00 00 00 [ 	]*or     \$0x2,%ebx	56: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   334
+  5a:	b8 5b 00 00 00 [ 	]*mov    \$0x5b,%eax	5b: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   335
+  5f:	bb 60 00 00 00 [ 	]*mov    \$0x60,%ebx	60: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   336
+  64:	b8 01 00 00 00 [ 	]*mov    \$0x1,%eax	65: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   337
+  69:	bb 01 00 00 00 [ 	]*mov    \$0x1,%ebx	6a: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   338
+  6e:	c7 05 00 00 00 00 74 00 00 00 [ 	]*movl   \$0x74,0x0	70: (R_386_)?(dir)?32	foo
yann@1
   339
+[ 	]*74: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   340
+  78:	65 c7 05 00 00 00 00 7f 00 00 00 [ 	]*movl   \$0x7f,%gs:0x0	7b: (R_386_)?(dir)?32	foo
yann@1
   341
+[ 	]*7f: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   342
+  83:	65 c7 05 00 00 00 00 8a 00 00 00 [ 	]*movl   \$0x8a,%gs:0x0	86: (R_386_)?(dir)?32	foo
yann@1
   343
+[ 	]*8a: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   344
+  8e:	c7 05 02 00 00 00 94 00 00 00 [ 	]*movl   \$0x94,0x2	90: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   345
+[ 	]*94: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   346
+  98:	a1 99 00 00 00 [ 	]*mov    0x99,%eax	99: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   347
+  9d:	8b 1d 9f 00 00 00 [ 	]*mov    0x9f,%ebx	9f: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   348
+  a3:	a3 a4 00 00 00 [ 	]*mov    %eax,0xa4	a4: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   349
+  a8:	89 1d aa 00 00 00 [ 	]*mov    %ebx,0xaa	aa: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   350
+  ae:	65 a3 b0 00 00 00 [ 	]*mov    %eax,%gs:0xb0	b0: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   351
+  b4:	65 89 1d b7 00 00 00 [ 	]*mov    %ebx,%gs:0xb7	b7: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   352
+  bb:	65 a3 bd 00 00 00 [ 	]*mov    %eax,%gs:0xbd	bd: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   353
+  c1:	65 89 1d c4 00 00 00 [ 	]*mov    %ebx,%gs:0xc4	c4: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   354
+  c8:	8d 83 00 00 00 00 [ 	]*lea    0x0\(%ebx\),%eax	ca: (R_386_)?GOTOFF	_GLOBAL_OFFSET_TABLE_
yann@1
   355
+  ce:	8d 9b 00 00 00 00 [ 	]*lea    0x0\(%ebx\),%ebx	d0: (R_386_)?GOTOFF	_GLOBAL_OFFSET_TABLE_
yann@1
   356
+  d4:	8b 83 00 00 00 00 [ 	]*mov    0x0\(%ebx\),%eax	d6: (R_386_)?GOTOFF	_GLOBAL_OFFSET_TABLE_
yann@1
   357
+  da:	8b 9b 00 00 00 00 [ 	]*mov    0x0\(%ebx\),%ebx	dc: (R_386_)?GOTOFF	_GLOBAL_OFFSET_TABLE_
yann@1
   358
+  e0:	e0 00 [ 	]*loopne e2 <test\+0xe2>	e0: (R_386_)?GOTPC	_GLOBAL_OFFSET_TABLE_
yann@1
   359
+  e2:	00 00 [ 	]*add    %al,\(%eax\)
yann@1
   360
+  e4:	00 00 [ 	]*add    %al,\(%eax\)	e4: (R_386_)?GOTOFF	_GLOBAL_OFFSET_TABLE_
yann@1
   361
+	...
yann@1
   362
--- binutils/gas/testsuite/gas/i386/i386.exp.jj	2002-07-18 11:35:39.000000000 +0200
yann@1
   363
+++ binutils/gas/testsuite/gas/i386/i386.exp	2002-08-02 21:57:46.000000000 +0200
yann@1
   364
@@ -53,6 +53,7 @@ if [expr ([istarget "i*86-*-*"] ||  [ist
yann@1
   365
     run_dump_test "jump"
yann@1
   366
     run_dump_test "ssemmx2"
yann@1
   367
     run_dump_test "sse2"
yann@1
   368
+    run_dump_test "gotpc"
yann@1
   369
 
yann@1
   370
     # PIC is only supported on ELF targets.
yann@1
   371
     if { ([istarget "*-*-elf*"] || [istarget "*-*-linux*"] )
yann@1
   372