diff options
author | Ian Lance Taylor <ian@airs.com> | 1996-12-19 17:07:14 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1996-12-19 17:07:14 +0000 |
commit | 9c199842e54a91b59b2d319c1d53dc94464fa9f7 (patch) | |
tree | db42d0d7a7d7370e643845ff39c633a7ade7aceb /gas | |
parent | cb07aaeb2bc4b1c658907306026dc6d55633b266 (diff) | |
download | gdb-9c199842e54a91b59b2d319c1d53dc94464fa9f7.zip gdb-9c199842e54a91b59b2d319c1d53dc94464fa9f7.tar.gz gdb-9c199842e54a91b59b2d319c1d53dc94464fa9f7.tar.bz2 |
* write.c (adjust_reloc_syms): If the fixup symbol has been
equated to an undefined symbol, convert the fixup to being against
the target symbol. Remove obsolete code handling a special case
for i386 PIC.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 7 | ||||
-rw-r--r-- | gas/write.c | 34 |
2 files changed, 19 insertions, 22 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 79133f0..85776a0 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +Thu Dec 19 12:06:08 1996 Ian Lance Taylor <ian@cygnus.com> + + * write.c (adjust_reloc_syms): If the fixup symbol has been + equated to an undefined symbol, convert the fixup to being against + the target symbol. Remove obsolete code handling a special case + for i386 PIC. + start-sanitize-d10v Wed Dec 18 16:00:42 1996 Martin M. Hunt <hunt@pizza.cygnus.com> diff --git a/gas/write.c b/gas/write.c index ab026f1..18ebc49 100644 --- a/gas/write.c +++ b/gas/write.c @@ -667,7 +667,6 @@ adjust_reloc_syms (abfd, sec, xxx) #endif sym = fixp->fx_addsy; - symsec = sym->bsym->section; /* All symbols should have already been resolved at this point. It is possible to see unresolved expression @@ -678,6 +677,18 @@ adjust_reloc_syms (abfd, sec, xxx) if (fixp->fx_subsy != NULL && ! fixp->fx_subsy->sy_resolved) resolve_symbol_value (fixp->fx_subsy); + /* If this symbol is equated to an undefined symbol, convert + the fixup to being against that symbol. */ + if (sym->sy_value.X_op == O_symbol + && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym))) + { + fixp->fx_offset += sym->sy_value.X_add_number; + sym = sym->sy_value.X_add_symbol; + fixp->fx_addsy = sym; + } + + symsec = S_GET_SEGMENT (sym); + if (sym != NULL && sym->sy_mri_common) { /* These symbols are handled specially in fixup_segment. */ @@ -781,27 +792,6 @@ adjust_reloc_syms (abfd, sec, xxx) } #endif - /* For PIC support: We may get expressions like - "_GLOBAL_OFFSET_TABLE_+(.-L5)" where "." and "L5" may not - necessarily have had a fixed difference initially. But now - it should be a known constant, so we can reduce it. Since - we can't easily handle a symbol value that looks like - someUndefinedSymbol+const, though, we convert the fixup to - access the undefined symbol directly, and discard the - intermediate symbol. */ - if (S_GET_SEGMENT (sym) == expr_section - && sym->sy_value.X_op == O_add - && (resolve_symbol_value (sym->sy_value.X_add_symbol), - S_GET_SEGMENT (sym->sy_value.X_add_symbol) == undefined_section) - && (resolve_symbol_value (sym->sy_value.X_op_symbol), - S_GET_SEGMENT (sym->sy_value.X_op_symbol) == absolute_section)) - { - fixp->fx_offset += S_GET_VALUE (sym->sy_value.X_op_symbol); - fixp->fx_offset += sym->sy_value.X_add_number; - fixp->fx_addsy = sym->sy_value.X_add_symbol; - goto reduce_fixup; - } - /* If the section symbol isn't going to be output, the relocs at least should still work. If not, figure out what to do when we run into that case. |