diff options
| author | pk <pk@NetBSD.org> | 1993-10-27 00:14:14 +0000 |
|---|---|---|
| committer | pk <pk@NetBSD.org> | 1993-10-27 00:14:14 +0000 |
| commit | 08bf09ac865086a0082ce950a3e7e59c8bfb4ffe (patch) | |
| tree | d8631b329a0d67f092bb787ad515122797895dd4 /gnu | |
| parent | 0f124204b9fc5b26f9186163baaa067c7e7ca941 (diff) | |
Handling of defined global data in initializers is dependent on -k flag.
Diffstat (limited to 'gnu')
| -rw-r--r-- | gnu/usr.bin/gas/config/tc-i386.c | 25 | ||||
| -rw-r--r-- | gnu/usr.bin/gas/config/tc-sparc.c | 11 | ||||
| -rw-r--r-- | gnu/usr.bin/gas/write.c | 13 |
3 files changed, 29 insertions, 20 deletions
diff --git a/gnu/usr.bin/gas/config/tc-i386.c b/gnu/usr.bin/gas/config/tc-i386.c index 419387d323e..9a6e1644eb7 100644 --- a/gnu/usr.bin/gas/config/tc-i386.c +++ b/gnu/usr.bin/gas/config/tc-i386.c @@ -25,7 +25,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: tc-i386.c,v 1.2 1993/10/25 21:57:06 pk Exp $"; +static char rcsid[] = "$Id: tc-i386.c,v 1.3 1993/10/27 00:14:50 pk Exp $"; #endif #include "as.h" @@ -2033,18 +2033,22 @@ relax_addressT segment_address_in_file; #ifdef PIC { int extra_bits = 0; + int extrn_bit = !S_IS_DEFINED(fixP->fx_addsy); switch (fixP->fx_r_type) { case NO_RELOC: break; case RELOC_32: - if (!S_IS_EXTERNAL(fixP->fx_addsy)) + if (!flagseen['k'] || !S_IS_EXTERNAL(fixP->fx_addsy)) break; r_symbolnum = fixP->fx_addsy->sy_number; + extrn_bit = 1; break; case RELOC_GLOB_DAT: extra_bits = (1 << 4) & 0x10; /* r_baserel */ r_symbolnum = fixP->fx_addsy->sy_number; + if (S_IS_EXTERNAL(fixP->fx_addsy)) + extrn_bit = 1; break; case RELOC_JMP_TBL: extra_bits = (1 << 5) & 0x20; /* r_jmptable */ @@ -2060,18 +2064,11 @@ relax_addressT segment_address_in_file; where[6] = (r_symbolnum >> 16) & 0x0ff; where[5] = (r_symbolnum >> 8) & 0x0ff; where[4] = r_symbolnum & 0x0ff; - where[7] = (((( - (!S_IS_DEFINED(fixP->fx_addsy) || - (S_IS_EXTERNAL(fixP->fx_addsy) && - (fixP->fx_r_type == RELOC_GLOB_DAT || - fixP->fx_r_type == RELOC_32) - ) - ) - ) << 3) & 0x08) - | ((nbytes_r_length[fixP->fx_size] << 1) & 0x06) - | ((fixP->fx_pcrel << 0) & 0x01) - | (extra_bits) - ); + where[7] = ( ((extrn_bit << 3) & 0x08) + | ((nbytes_r_length[fixP->fx_size] << 1) & 0x06) + | ((fixP->fx_pcrel << 0) & 0x01) + | (extra_bits) + ); } #else where[6] = (r_symbolnum >> 16) & 0x0ff; diff --git a/gnu/usr.bin/gas/config/tc-sparc.c b/gnu/usr.bin/gas/config/tc-sparc.c index 3a3a7f3ddf7..93f6bdde194 100644 --- a/gnu/usr.bin/gas/config/tc-sparc.c +++ b/gnu/usr.bin/gas/config/tc-sparc.c @@ -18,7 +18,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef lint -static char rcsid[] = "$Id: tc-sparc.c,v 1.1 1993/10/02 20:59:40 pk Exp $"; +static char rcsid[] = "$Id: tc-sparc.c,v 1.2 1993/10/27 00:14:52 pk Exp $"; #endif #define cypress 1234 @@ -1099,7 +1099,7 @@ char *str; case RELOC_BASE13: case RELOC_BASE22: if (the_insn.exp.X_add_symbol) - the_insn.exp.X_add_symbol->forceout = 1; + the_insn.exp.X_add_symbol->sy_forceout = 1; break; default: break; @@ -1430,6 +1430,13 @@ relax_addressT segment_address_in_file; kflag = 1; break; + case RELOC_32: + if (!S_IS_EXTERNAL(fixP->fx_addsy)) + break; + r_index = fixP->fx_addsy->sy_number; + /*kflag = 1;*/ + break; + default: break; } diff --git a/gnu/usr.bin/gas/write.c b/gnu/usr.bin/gas/write.c index 6b591d373e2..7cb18089cef 100644 --- a/gnu/usr.bin/gas/write.c +++ b/gnu/usr.bin/gas/write.c @@ -21,7 +21,7 @@ /* This thing should be set up to do byteordering correctly. But... */ #ifndef lint -static char rcsid[] = "$Id: write.c,v 1.5 1993/10/25 21:54:37 pk Exp $"; +static char rcsid[] = "$Id: write.c,v 1.6 1993/10/27 00:14:14 pk Exp $"; #endif #include "as.h" @@ -724,7 +724,7 @@ segT segment; /* SEG_DATA or SEG_TEXT */ offset = lie->add->sy_frag->fr_address+ S_GET_VALUE(lie->add) + lie->addnum - (lie->sub->sy_frag->fr_address+ S_GET_VALUE(lie->sub)); if (offset <= -32768 || offset >= 32767) { - if (flagseen['k']) + if (flagseen['K']) as_warn(".word %s-%s+%ld didn't fit", S_GET_NAME(lie->add), S_GET_NAME(lie->sub), @@ -1059,9 +1059,14 @@ segT this_segment_type; /* N_TYPE bits for segment. */ default: seg_reloc_count ++; #ifdef PIC - if (fixP->fx_r_type != RELOC_GLOB_DAT && + /* + * Do not fixup refs to global data + * even if defined here. + */ + if (!flagseen['k'] || + (fixP->fx_r_type != RELOC_GLOB_DAT && (fixP->fx_r_type != RELOC_32 || - !S_IS_EXTERNAL(add_symbolP))) + !S_IS_EXTERNAL(add_symbolP)))) #endif add_number += S_GET_VALUE(add_symbolP); break; |
