X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gas%2Fsymbols.c;h=160b0f74021e92e8858d331a1988b9927a34a0b2;hb=6a3ab9239ae6184c8a3558ce9628f6d12a7f1bbd;hp=cff24059e6c7b9b125c0ffb21e7525b510b43d0f;hpb=e2b9a97eda81ff2565aa5c783088215fab12fc9b;p=deliverable%2Fbinutils-gdb.git diff --git a/gas/symbols.c b/gas/symbols.c index cff24059e6..160b0f7402 100644 --- a/gas/symbols.c +++ b/gas/symbols.c @@ -1,5 +1,5 @@ /* symbols.c -symbol table- - Copyright (C) 1987-2019 Free Software Foundation, Inc. + Copyright (C) 1987-2020 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -1217,7 +1217,13 @@ resolve_symbol_value (symbolS *symp) if (local_symbol_resolved_p (locsym)) return final_val; - final_val += local_symbol_get_frag (locsym)->fr_address / OCTETS_PER_BYTE; + /* Symbols whose section has SEC_ELF_OCTETS set, + resolve to octets instead of target bytes. */ + if (locsym->lsy_section->flags & SEC_OCTETS) + final_val += local_symbol_get_frag (locsym)->fr_address; + else + final_val += (local_symbol_get_frag (locsym)->fr_address + / OCTETS_PER_BYTE); if (finalize_syms) { @@ -1330,7 +1336,12 @@ resolve_symbol_value (symbolS *symp) /* Fall through. */ case O_constant: - final_val += symp->sy_frag->fr_address / OCTETS_PER_BYTE; + /* Symbols whose section has SEC_ELF_OCTETS set, + resolve to octets instead of target bytes. */ + if (symp->bsym->section->flags & SEC_OCTETS) + final_val += symp->sy_frag->fr_address; + else + final_val += symp->sy_frag->fr_address / OCTETS_PER_BYTE; if (final_seg == expr_section) final_seg = absolute_section; /* Fall through. */ @@ -1627,7 +1638,7 @@ resolve_symbol_value (symbolS *symp) if (finalize_syms) S_SET_VALUE (symp, final_val); -exit_dont_set_value: + exit_dont_set_value: /* Always set the segment, even if not finalizing the value. The segment is used to determine whether a symbol is defined. */ S_SET_SEGMENT (symp, final_seg);