mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-24 04:00:07 +08:00
* elflink.c: Formatting.
This commit is contained in:
@ -1,3 +1,7 @@
|
||||
2007-09-30 Alan Modra <amodra@bigpond.net.au>
|
||||
|
||||
* elflink.c: Formatting.
|
||||
|
||||
2007-09-29 Alan Modra <amodra@bigpond.net.au>
|
||||
|
||||
* elflink.c (resolve_symbol): Handle symbols in SEC_MERGE
|
||||
|
172
bfd/elflink.c
172
bfd/elflink.c
@ -501,7 +501,7 @@ bfd_elf_record_link_assignment (bfd *output_bfd,
|
||||
break;
|
||||
case bfd_link_hash_indirect:
|
||||
/* We had a versioned symbol in a dynamic library. We make the
|
||||
the versioned symbol point to this one. */
|
||||
the versioned symbol point to this one. */
|
||||
bed = get_elf_backend_data (output_bfd);
|
||||
hv = h;
|
||||
while (hv->root.type == bfd_link_hash_indirect
|
||||
@ -7229,11 +7229,11 @@ struct elf_outext_info
|
||||
<unary-operator> := as in C, plus "0-" for unambiguous negation. */
|
||||
|
||||
static void
|
||||
set_symbol_value (bfd * bfd_with_globals,
|
||||
Elf_Internal_Sym * isymbuf,
|
||||
size_t locsymcount,
|
||||
size_t symidx,
|
||||
bfd_vma val)
|
||||
set_symbol_value (bfd *bfd_with_globals,
|
||||
Elf_Internal_Sym *isymbuf,
|
||||
size_t locsymcount,
|
||||
size_t symidx,
|
||||
bfd_vma val)
|
||||
{
|
||||
struct elf_link_hash_entry **sym_hashes;
|
||||
struct elf_link_hash_entry *h;
|
||||
@ -7270,18 +7270,18 @@ set_symbol_value (bfd * bfd_with_globals,
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
resolve_symbol (const char * name,
|
||||
bfd * input_bfd,
|
||||
struct elf_final_link_info * finfo,
|
||||
bfd_vma * result,
|
||||
Elf_Internal_Sym * isymbuf,
|
||||
size_t locsymcount)
|
||||
resolve_symbol (const char *name,
|
||||
bfd *input_bfd,
|
||||
struct elf_final_link_info *finfo,
|
||||
bfd_vma *result,
|
||||
Elf_Internal_Sym *isymbuf,
|
||||
size_t locsymcount)
|
||||
{
|
||||
Elf_Internal_Sym * sym;
|
||||
struct bfd_link_hash_entry * global_entry;
|
||||
const char * candidate = NULL;
|
||||
Elf_Internal_Shdr * symtab_hdr;
|
||||
size_t i;
|
||||
Elf_Internal_Sym *sym;
|
||||
struct bfd_link_hash_entry *global_entry;
|
||||
const char *candidate = NULL;
|
||||
Elf_Internal_Shdr *symtab_hdr;
|
||||
size_t i;
|
||||
|
||||
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
|
||||
|
||||
@ -7314,16 +7314,17 @@ resolve_symbol (const char * name,
|
||||
}
|
||||
|
||||
/* Hmm, haven't found it yet. perhaps it is a global. */
|
||||
global_entry = bfd_link_hash_lookup (finfo->info->hash, name, FALSE, FALSE, TRUE);
|
||||
global_entry = bfd_link_hash_lookup (finfo->info->hash, name,
|
||||
FALSE, FALSE, TRUE);
|
||||
if (!global_entry)
|
||||
return FALSE;
|
||||
|
||||
if (global_entry->type == bfd_link_hash_defined
|
||||
|| global_entry->type == bfd_link_hash_defweak)
|
||||
{
|
||||
* result = global_entry->u.def.value
|
||||
+ global_entry->u.def.section->output_section->vma
|
||||
+ global_entry->u.def.section->output_offset;
|
||||
*result = (global_entry->u.def.value
|
||||
+ global_entry->u.def.section->output_section->vma
|
||||
+ global_entry->u.def.section->output_offset);
|
||||
#ifdef DEBUG
|
||||
printf ("Found GLOBAL symbol '%s' with value %8.8lx\n",
|
||||
global_entry->root.string, (unsigned long) *result);
|
||||
@ -7335,12 +7336,12 @@ resolve_symbol (const char * name,
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
resolve_section (const char * name,
|
||||
asection * sections,
|
||||
bfd_vma * result)
|
||||
resolve_section (const char *name,
|
||||
asection *sections,
|
||||
bfd_vma *result)
|
||||
{
|
||||
asection * curr;
|
||||
unsigned int len;
|
||||
asection *curr;
|
||||
unsigned int len;
|
||||
|
||||
for (curr = sections; curr; curr = curr->next)
|
||||
if (strcmp (curr->name, name) == 0)
|
||||
@ -7372,31 +7373,31 @@ resolve_section (const char * name,
|
||||
}
|
||||
|
||||
static void
|
||||
undefined_reference (const char * reftype,
|
||||
const char * name)
|
||||
undefined_reference (const char *reftype, const char *name)
|
||||
{
|
||||
_bfd_error_handler (_("undefined %s reference in complex symbol: %s"), reftype, name);
|
||||
_bfd_error_handler (_("undefined %s reference in complex symbol: %s"),
|
||||
reftype, name);
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
eval_symbol (bfd_vma * result,
|
||||
const char ** symp,
|
||||
bfd * input_bfd,
|
||||
struct elf_final_link_info * finfo,
|
||||
bfd_vma dot,
|
||||
Elf_Internal_Sym * isymbuf,
|
||||
size_t locsymcount,
|
||||
int signed_p)
|
||||
eval_symbol (bfd_vma *result,
|
||||
const char **symp,
|
||||
bfd *input_bfd,
|
||||
struct elf_final_link_info *finfo,
|
||||
bfd_vma dot,
|
||||
Elf_Internal_Sym *isymbuf,
|
||||
size_t locsymcount,
|
||||
int signed_p)
|
||||
{
|
||||
int len;
|
||||
int symlen;
|
||||
bfd_vma a;
|
||||
bfd_vma b;
|
||||
const int bufsz = 4096;
|
||||
char symbuf [bufsz];
|
||||
int len;
|
||||
int symlen;
|
||||
bfd_vma a;
|
||||
bfd_vma b;
|
||||
const int bufsz = 4096;
|
||||
char symbuf[bufsz];
|
||||
const char *sym = *symp;
|
||||
const char * symend;
|
||||
bfd_boolean symbol_is_section = FALSE;
|
||||
const char *symend;
|
||||
bfd_boolean symbol_is_section = FALSE;
|
||||
|
||||
len = strlen (sym);
|
||||
symend = sym + len;
|
||||
@ -7426,14 +7427,14 @@ eval_symbol (bfd_vma * result,
|
||||
symlen = strtol (sym, (char **) symp, 10);
|
||||
sym = *symp + 1; /* Skip the trailing ':'. */
|
||||
|
||||
if ((symend < sym) || ((symlen + 1) > bufsz))
|
||||
if (symend < sym || symlen + 1 > bufsz)
|
||||
{
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
memcpy (symbuf, sym, symlen);
|
||||
symbuf [symlen] = '\0';
|
||||
symbuf[symlen] = '\0';
|
||||
*symp = sym + symlen;
|
||||
|
||||
/* Is it always possible, with complex symbols, that gas "mis-guessed"
|
||||
@ -7471,16 +7472,16 @@ eval_symbol (bfd_vma * result,
|
||||
if (strncmp (sym, #op, strlen (#op)) == 0) \
|
||||
{ \
|
||||
sym += strlen (#op); \
|
||||
if (* sym == ':') \
|
||||
++ sym; \
|
||||
if (*sym == ':') \
|
||||
++sym; \
|
||||
*symp = sym; \
|
||||
if (!eval_symbol (&a, symp, input_bfd, finfo, dot, \
|
||||
isymbuf, locsymcount, signed_p)) \
|
||||
return FALSE; \
|
||||
if (signed_p) \
|
||||
return FALSE; \
|
||||
if (signed_p) \
|
||||
*result = op ((bfd_signed_vma) a); \
|
||||
else \
|
||||
* result = op a; \
|
||||
else \
|
||||
*result = op a; \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
@ -7488,20 +7489,20 @@ eval_symbol (bfd_vma * result,
|
||||
if (strncmp (sym, #op, strlen (#op)) == 0) \
|
||||
{ \
|
||||
sym += strlen (#op); \
|
||||
if (* sym == ':') \
|
||||
++ sym; \
|
||||
if (*sym == ':') \
|
||||
++sym; \
|
||||
*symp = sym; \
|
||||
if (!eval_symbol (&a, symp, input_bfd, finfo, dot, \
|
||||
isymbuf, locsymcount, signed_p)) \
|
||||
return FALSE; \
|
||||
return FALSE; \
|
||||
++*symp; \
|
||||
if (!eval_symbol (&b, symp, input_bfd, finfo, dot, \
|
||||
isymbuf, locsymcount, signed_p)) \
|
||||
return FALSE; \
|
||||
if (signed_p) \
|
||||
return FALSE; \
|
||||
if (signed_p) \
|
||||
*result = ((bfd_signed_vma) a) op ((bfd_signed_vma) b); \
|
||||
else \
|
||||
* result = a op b; \
|
||||
else \
|
||||
*result = a op b; \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
@ -7536,11 +7537,11 @@ eval_symbol (bfd_vma * result,
|
||||
}
|
||||
|
||||
static void
|
||||
put_value (bfd_vma size,
|
||||
unsigned long chunksz,
|
||||
bfd * input_bfd,
|
||||
bfd_vma x,
|
||||
bfd_byte * location)
|
||||
put_value (bfd_vma size,
|
||||
unsigned long chunksz,
|
||||
bfd *input_bfd,
|
||||
bfd_vma x,
|
||||
bfd_byte *location)
|
||||
{
|
||||
location += (size - chunksz);
|
||||
|
||||
@ -7572,10 +7573,10 @@ put_value (bfd_vma size,
|
||||
}
|
||||
|
||||
static bfd_vma
|
||||
get_value (bfd_vma size,
|
||||
unsigned long chunksz,
|
||||
bfd * input_bfd,
|
||||
bfd_byte * location)
|
||||
get_value (bfd_vma size,
|
||||
unsigned long chunksz,
|
||||
bfd *input_bfd,
|
||||
bfd_byte *location)
|
||||
{
|
||||
bfd_vma x = 0;
|
||||
|
||||
@ -7608,16 +7609,15 @@ get_value (bfd_vma size,
|
||||
}
|
||||
|
||||
static void
|
||||
decode_complex_addend
|
||||
(unsigned long * start, /* in bits */
|
||||
unsigned long * oplen, /* in bits */
|
||||
unsigned long * len, /* in bits */
|
||||
unsigned long * wordsz, /* in bytes */
|
||||
unsigned long * chunksz, /* in bytes */
|
||||
unsigned long * lsb0_p,
|
||||
unsigned long * signed_p,
|
||||
unsigned long * trunc_p,
|
||||
unsigned long encoded)
|
||||
decode_complex_addend (unsigned long *start, /* in bits */
|
||||
unsigned long *oplen, /* in bits */
|
||||
unsigned long *len, /* in bits */
|
||||
unsigned long *wordsz, /* in bytes */
|
||||
unsigned long *chunksz, /* in bytes */
|
||||
unsigned long *lsb0_p,
|
||||
unsigned long *signed_p,
|
||||
unsigned long *trunc_p,
|
||||
unsigned long encoded)
|
||||
{
|
||||
* start = encoded & 0x3F;
|
||||
* len = (encoded >> 6) & 0x3F;
|
||||
@ -7645,9 +7645,9 @@ bfd_elf_perform_complex_relocation (bfd *input_bfd,
|
||||
i.e. the addend has the complete reloc information (bit start, end,
|
||||
word size, etc) encoded within it.). */
|
||||
|
||||
decode_complex_addend (& start, & oplen, & len, & wordsz,
|
||||
& chunksz, & lsb0_p, & signed_p,
|
||||
& trunc_p, rel->r_addend);
|
||||
decode_complex_addend (&start, &oplen, &len, &wordsz,
|
||||
&chunksz, &lsb0_p, &signed_p,
|
||||
&trunc_p, rel->r_addend);
|
||||
|
||||
mask = (((1L << (len - 1)) - 1) << 1) | 1;
|
||||
|
||||
@ -7670,9 +7670,9 @@ bfd_elf_perform_complex_relocation (bfd *input_bfd,
|
||||
if (! trunc_p)
|
||||
{
|
||||
/* Now do an overflow check. */
|
||||
if (bfd_check_overflow ((signed_p ?
|
||||
complain_overflow_signed :
|
||||
complain_overflow_unsigned),
|
||||
if (bfd_check_overflow ((signed_p
|
||||
? complain_overflow_signed
|
||||
: complain_overflow_unsigned),
|
||||
len, 0, (8 * wordsz),
|
||||
relocation) == bfd_reloc_overflow)
|
||||
(*_bfd_error_handler)
|
||||
@ -8189,7 +8189,7 @@ check_dynsym (bfd *abfd, Elf_Internal_Sym *sym)
|
||||
if (sym->st_shndx > SHN_HIRESERVE)
|
||||
{
|
||||
/* The gABI doesn't support dynamic symbols in output sections
|
||||
beyond 64k. */
|
||||
beyond 64k. */
|
||||
(*_bfd_error_handler)
|
||||
(_("%B: Too many sections: %d (>= %d)"),
|
||||
abfd, bfd_count_sections (abfd), SHN_LORESERVE);
|
||||
|
Reference in New Issue
Block a user