Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4418)

Unified Diff: bfd/elf32-lm32.c

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « bfd/elf32-iq2000.c ('k') | bfd/elf32-m32c.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bfd/elf32-lm32.c
diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c
index 8d530a4cf31345c404391c4098d752bd8e585d94..4ebe534ddf139aff6ba3f53e6ac1961b1db738ec 100644
--- a/bfd/elf32-lm32.c
+++ b/bfd/elf32-lm32.c
@@ -159,7 +159,7 @@ lm32_elf_link_hash_table_create (bfd *abfd)
struct elf_lm32_link_hash_table *ret;
bfd_size_type amt = sizeof (struct elf_lm32_link_hash_table);
- ret = bfd_malloc (amt);
+ ret = bfd_zmalloc (amt);
if (ret == NULL)
return NULL;
@@ -172,16 +172,6 @@ lm32_elf_link_hash_table_create (bfd *abfd)
return NULL;
}
- ret->sgot = NULL;
- ret->sgotplt = NULL;
- ret->srelgot = NULL;
- ret->sfixup32 = NULL;
- ret->splt = NULL;
- ret->srelplt = NULL;
- ret->sdynbss = NULL;
- ret->srelbss = NULL;
- ret->relocs32 = 0;
-
return &ret->root.root;
}
@@ -785,8 +775,7 @@ _lm32fdpic_osec_to_segment (bfd *output_bfd, asection *osec)
Elf_Internal_Phdr *p;
/* Find the segment that contains the output_section. */
- for (m = elf_tdata (output_bfd)->segment_map,
- p = elf_tdata (output_bfd)->phdr;
+ for (m = elf_seg_map (output_bfd), p = elf_tdata (output_bfd)->phdr;
m != NULL;
m = m->next, p++)
{
@@ -886,12 +875,12 @@ lm32_elf_relocate_section (bfd *output_bfd,
{
/* It's a global symbol. */
bfd_boolean unresolved_reloc;
- bfd_boolean warned;
+ bfd_boolean warned, ignored;
RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
r_symndx, symtab_hdr, sym_hashes,
h, sec, relocation,
- unresolved_reloc, warned);
+ unresolved_reloc, warned, ignored);
name = h->root.root.string;
}
@@ -1316,6 +1305,10 @@ lm32_elf_check_relocs (bfd *abfd,
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ /* PR15323, ref flags aren't set for references in the same
+ object. */
+ h->root.non_ir_ref = 1;
}
/* Some relocs require a global offset table. */
@@ -1745,15 +1738,16 @@ lm32_elf_finish_dynamic_symbol (bfd *output_bfd,
}
/* Mark some specially defined symbols as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || h == htab->root.hgot)
+ if (h == htab->root.hdynamic || h == htab->root.hgot)
sym->st_shndx = SHN_ABS;
return TRUE;
}
static enum elf_reloc_type_class
-lm32_elf_reloc_type_class (const Elf_Internal_Rela *rela)
+lm32_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ const asection *rel_sec ATTRIBUTE_UNUSED,
+ const Elf_Internal_Rela *rela)
{
switch ((int) ELF32_R_TYPE (rela->r_info))
{
@@ -2616,135 +2610,22 @@ lm32_elf_copy_indirect_symbol (struct bfd_link_info *info,
}
static bfd_boolean
-lm32_elf_always_size_sections (bfd *output_bfd,
- struct bfd_link_info *info)
+lm32_elf_always_size_sections (bfd *output_bfd, struct bfd_link_info *info)
{
if (!info->relocatable)
{
- struct elf_link_hash_entry *h;
-
- /* Force a PT_GNU_STACK segment to be created. */
- if (! elf_tdata (output_bfd)->stack_flags)
- elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
-
- /* Define __stacksize if it's not defined yet. */
- h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
- FALSE, FALSE, FALSE);
- if (! h || h->root.type != bfd_link_hash_defined
- || h->type != STT_OBJECT
- || !h->def_regular)
- {
- struct bfd_link_hash_entry *bh = NULL;
-
- if (!(_bfd_generic_link_add_one_symbol
- (info, output_bfd, "__stacksize",
- BSF_GLOBAL, bfd_abs_section_ptr, DEFAULT_STACK_SIZE,
- (const char *) NULL, FALSE,
- get_elf_backend_data (output_bfd)->collect, &bh)))
- return FALSE;
-
- h = (struct elf_link_hash_entry *) bh;
- h->def_regular = 1;
- h->type = STT_OBJECT;
- /* This one must NOT be hidden. */
- }
- }
-
- return TRUE;
-}
+ if (!bfd_elf_stack_segment_size (output_bfd, info,
+ "__stacksize", DEFAULT_STACK_SIZE))
+ return FALSE;
-static bfd_boolean
-lm32_elf_modify_segment_map (bfd *output_bfd,
- struct bfd_link_info *info)
-{
- struct elf_segment_map *m;
-
- /* objcopy and strip preserve what's already there using elf32_lm32fdpic_copy_
- private_bfd_data (). */
- if (! info)
- return TRUE;
-
- for (m = elf_tdata (output_bfd)->segment_map; m != NULL; m = m->next)
- if (m->p_type == PT_GNU_STACK)
- break;
-
- if (m)
- {
asection *sec = bfd_get_section_by_name (output_bfd, ".stack");
- struct elf_link_hash_entry *h;
-
if (sec)
- {
- /* Obtain the pointer to the __stacksize symbol. */
- h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
- FALSE, FALSE, FALSE);
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *)h->root.u.i.link;
- BFD_ASSERT (h->root.type == bfd_link_hash_defined);
-
- /* Set the section size from the symbol value. We
- intentionally ignore the symbol section. */
- if (h->root.type == bfd_link_hash_defined)
- sec->size = h->root.u.def.value;
- else
- sec->size = DEFAULT_STACK_SIZE;
-
- /* Add the stack section to the PT_GNU_STACK segment,
- such that its size and alignment requirements make it
- to the segment. */
- m->sections[m->count] = sec;
- m->count++;
- }
- }
-
- return TRUE;
-}
-
-static bfd_boolean
-lm32_elf_modify_program_headers (bfd *output_bfd,
- struct bfd_link_info *info)
-{
- struct elf_obj_tdata *tdata = elf_tdata (output_bfd);
- struct elf_segment_map *m;
- Elf_Internal_Phdr *p;
-
- if (! info)
- return TRUE;
-
- for (p = tdata->phdr, m = tdata->segment_map; m != NULL; m = m->next, p++)
- if (m->p_type == PT_GNU_STACK)
- break;
-
- if (m)
- {
- struct elf_link_hash_entry *h;
-
- /* Obtain the pointer to the __stacksize symbol. */
- h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
- FALSE, FALSE, FALSE);
- if (h)
- {
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
- BFD_ASSERT (h->root.type == bfd_link_hash_defined);
- }
-
- /* Set the header p_memsz from the symbol value. We
- intentionally ignore the symbol section. */
- if (h && h->root.type == bfd_link_hash_defined)
- p->p_memsz = h->root.u.def.value;
- else
- p->p_memsz = DEFAULT_STACK_SIZE;
-
- p->p_align = 8;
+ sec->size = info->stacksize >= 0 ? info->stacksize : 0;
}
return TRUE;
}
-
static bfd_boolean
lm32_elf_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
{
@@ -2823,6 +2704,7 @@ lm32_elf_fdpic_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
#define elf_backend_rela_normal 1
#define elf_backend_object_p lm32_elf_object_p
#define elf_backend_final_write_processing lm32_elf_final_write_processing
+#define elf_backend_stack_align 8
#define elf_backend_can_gc_sections 1
#define elf_backend_can_refcount 1
#define elf_backend_gc_mark_hook lm32_elf_gc_mark_hook
@@ -2858,10 +2740,6 @@ lm32_elf_fdpic_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
#undef elf_backend_always_size_sections
#define elf_backend_always_size_sections lm32_elf_always_size_sections
-#undef elf_backend_modify_segment_map
-#define elf_backend_modify_segment_map lm32_elf_modify_segment_map
-#undef elf_backend_modify_program_headers
-#define elf_backend_modify_program_headers lm32_elf_modify_program_headers
#undef bfd_elf32_bfd_copy_private_bfd_data
#define bfd_elf32_bfd_copy_private_bfd_data lm32_elf_fdpic_copy_private_bfd_data
« no previous file with comments | « bfd/elf32-iq2000.c ('k') | bfd/elf32-m32c.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698