[PATCH] Fix s390 as
Jakub Jelinek
jakub@redhat.com
Tue Jan 21 23:35:00 GMT 2003
Hi!
The following source is assembled incorrectly:
.text
.align 4
.globl f1
.type f1,@function
f1:
lhi %r2,1
br %r14
.Lfe1:
.size f1,.Lfe1-f1
.align 4
.globl f2
.type f2,@function
f2:
stm %r12,%r15,48(%r15)
bras %r13,.LTN1
.LT1:
.LC0:
.long f1@PLT-.LT1
.LC1:
.long _GLOBAL_OFFSET_TABLE_-.LT1
.LTN1:
lr %r14,%r15
l %r12,.LC1-.LT1(%r13)
ahi %r15,-96
l %r1,.LC0-.LT1(%r13)
la %r12,0(%r12,%r13)
st %r14,0(%r15)
bas %r14,0(%r13,%r1)
l %r4,152(%r15)
ahi %r2,1
lm %r12,%r15,144(%r15)
br %r4
.Lfe2:
.size f2,.Lfe2-f2
The problem is that assembler relocates f1@PLT-.LT1 into constant
instead of emitting relocation for the linker (note that f1
is global symbol and as such should be overridable in another shared
library etc.).
The following patch fixes this, though I'm not sure if at least
a S_IS_EXTERNAL (fixp->fx_addsy) check shouldn't be done in write.c
directly. The question is if:
.globl f1
f1:
.long f1-.
should say on IA-32 create a dynamic relocation (PC relative) or not.
2003-01-22 Jakub Jelinek <jakub@redhat.com>
* config/tc-s390.h (TC_FORCE_RELOCATION_SUB_SAME): Define.
--- gas/config/tc-s390.h.jj 2002-09-10 14:51:00.000000000 +0200
+++ gas/config/tc-s390.h 2003-01-22 00:18:24.000000000 +0100
@@ -94,6 +94,11 @@ if (fragP->fr_type == rs_align_code)
#define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section(FIX, SEC)
extern long md_pcrel_from_section PARAMS ((struct fix *, segT));
+/* Ensure that PC relative relocs against global symbols in the same
+ section are resolved by the linker, not assembler. */
+#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG) \
+ (! SEG_NORMAL (SEG) || TC_FORCE_RELOCATION (FIX))
+
#define md_operand(x)
extern void s390_md_end PARAMS ((void));
Jakub
More information about the Binutils
mailing list