diff options
author | Catherine Moore <clm@redhat.com> | 1998-05-19 13:03:09 +0000 |
---|---|---|
committer | Catherine Moore <clm@redhat.com> | 1998-05-19 13:03:09 +0000 |
commit | a5002978e02876e17539e69308713ddbd6d91d91 (patch) | |
tree | 834266a5cb36b45c23a7c19d08498140e96f0ffe /gas | |
parent | 59bb547b06a7e9375c6a5715fbb8c0dcae5dfdca (diff) | |
download | gdb-a5002978e02876e17539e69308713ddbd6d91d91.zip gdb-a5002978e02876e17539e69308713ddbd6d91d91.tar.gz gdb-a5002978e02876e17539e69308713ddbd6d91d91.tar.bz2 |
Use number_to_chars_bigendian and number_to_chars_littleendian to
write data in sparc_handle_align.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/config/tc-sparc.c | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c index 48864be..a7df86c 100644 --- a/gas/config/tc-sparc.c +++ b/gas/config/tc-sparc.c @@ -2517,6 +2517,21 @@ md_apply_fix3 (fixP, value, segment) && ! S_IS_COMMON (fixP->fx_addsy) && (fixP->fx_addsy->bsym->flags & BSF_SECTION_SYM) == 0) fixP->fx_addnumber -= 2 * S_GET_VALUE (fixP->fx_addsy); + + /* When generating PIC code, we need to fiddle to get + bfd_install_relocation to do the right thing for a PC relative + reloc against a local symbol which we are going to keep. */ + if (sparc_pic_code + && fixP->fx_r_type == BFD_RELOC_32_PCREL_S2 + && fixP->fx_addsy != NULL + && (S_IS_EXTERNAL (fixP->fx_addsy) + || S_IS_WEAK (fixP->fx_addsy)) + && S_IS_DEFINED (fixP->fx_addsy) + && ! S_IS_COMMON (fixP->fx_addsy)) + { + val = 0; + fixP->fx_addnumber -= 2 * S_GET_VALUE (fixP->fx_addsy); + } #endif /* If this is a data relocation, just output VAL. */ @@ -2830,6 +2845,14 @@ tc_gen_reloc (section, fixp) || code == BFD_RELOC_SPARC_PC10 || code == BFD_RELOC_SPARC_PC22) reloc->addend = fixp->fx_addnumber; + else if (sparc_pic_code + && fixp->fx_r_type == BFD_RELOC_32_PCREL_S2 + && fixp->fx_addsy != NULL + && (S_IS_EXTERNAL (fixp->fx_addsy) + || S_IS_WEAK (fixp->fx_addsy)) + && S_IS_DEFINED (fixp->fx_addsy) + && ! S_IS_COMMON (fixp->fx_addsy)) + reloc->addend = fixp->fx_addnumber; else reloc->addend = fixp->fx_offset - reloc->address; @@ -3353,11 +3376,21 @@ sparc_handle_align (fragp) unsigned *p = (unsigned *)(fragp->fr_literal + fragp->fr_fix); int i; - for (i = 0; i < count; i += 4) - *p++ = 0x01000000; /* nop */ + for (i = 0; i < count; i += 4, p++) + if (INSN_BIG_ENDIAN) + number_to_chars_bigendian ((char *)p, 0x01000000, 4); /* emit nops */ + else + number_to_chars_littleendian ((char *)p, 0x10000000, 4); + if (SPARC_OPCODE_ARCH_V9_P (max_architecture) && count > 8) - *(unsigned *)(fragp->fr_literal + fragp->fr_fix) = - 0x30680000 | (count >> 2); /* ba,a,pt %xcc, 1f */ + { + char *waddr = &fragp->fr_literal + fragp->fr_fix; + unsigned wval = (0x30680000 | count >> 2); /* ba,a,pt %xcc, 1f */ + if (INSN_BIG_ENDIAN) + number_to_chars_bigendian (waddr, wval, 4); + else + number_to_chars_littleendian (waddr, wval, 4); + } fragp->fr_var = count; } } |