summaryrefslogtreecommitdiff
path: root/bfd/elf32-frv.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2006-06-20 14:34:08 +0000
committerAlan Modra <amodra@bigpond.net.au>2006-06-20 14:34:08 +0000
commit475299c6f1669f637d2b92ff4bdd79a75c135108 (patch)
treee314ea82d4e615df8c795bb0b5ff33aad4ecce2b /bfd/elf32-frv.c
parentcf612b38de6e230d75ebcbe4be6eac1f4f69b4d3 (diff)
downloadbinutils-redhat-475299c6f1669f637d2b92ff4bdd79a75c135108.tar.gz
* elf-bfd.h (struct elf_backend_data): Add
elf_backend_modify_program_headers. * elfxx-target.h (elf_backend_modify_program_headers): Define. (elfNN_bed): Init new field. * elf.c (elf_modify_segment_map): Remove comment. (assign_file_positions_for_load_sections): Only call elf_modify_segment_map for objcopy/strip. (assign_file_positions_except_relocs): Call elf_backend_modify_program_headers. * elf32-frv.c (elf32_frvfdpic_always_size_sections): Don't make .stack section. (elf32_frvfdpic_modify_segment_map): Delete. (elf32_frvfdpic_modify_program_headers): New. (elf_backend_modify_segment_map): Don't define. (elf_backend_modify_program_headers): Define. * elf32-bfin.c (elf32_bfinfdpic_always_size_sections): Don't make .stack section. (elf32_bfinfdpic_modify_segment_map): Delete. (elf32_bfinfdpic_modify_program_headers): New. (elf_backend_modify_segment_map): Don't define. (elf_backend_modify_program_headers): Define. * elfxx-ia64.c (elfNN_ia64_modify_program_headers): New function. Split out from.. (elfNN_ia64_modify_segment_map): ..here. (elf_backend_modify_program_headers): Define.
Diffstat (limited to 'bfd/elf32-frv.c')
-rw-r--r--bfd/elf32-frv.c56
1 files changed, 21 insertions, 35 deletions
diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c
index de2358be34..5f83f81bfe 100644
--- a/bfd/elf32-frv.c
+++ b/bfd/elf32-frv.c
@@ -5603,7 +5603,6 @@ elf32_frvfdpic_always_size_sections (bfd *output_bfd,
if (!info->relocatable)
{
struct elf_link_hash_entry *h;
- asection *sec;
/* Force a PT_GNU_STACK segment to be created. */
if (! elf_tdata (output_bfd)->stack_flags)
@@ -5630,13 +5629,6 @@ elf32_frvfdpic_always_size_sections (bfd *output_bfd,
h->type = STT_OBJECT;
/* This one must NOT be hidden. */
}
-
- /* Create a stack section, and set its alignment. */
- sec = bfd_make_section (output_bfd, ".stack");
-
- if (sec == NULL
- || ! bfd_set_section_alignment (output_bfd, sec, 3))
- return FALSE;
}
return TRUE;
@@ -5718,51 +5710,45 @@ elf32_frvfdpic_relax_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec,
}
static bfd_boolean
-elf32_frvfdpic_modify_segment_map (bfd *output_bfd,
- struct bfd_link_info *info)
+elf32_frvfdpic_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;
/* objcopy and strip preserve what's already there using
elf32_frvfdpic_copy_private_bfd_data (). */
if (! info)
return TRUE;
- for (m = elf_tdata (output_bfd)->segment_map; m != NULL; m = m->next)
+ for (p = tdata->phdr, m = tdata->segment_map; m != NULL; m = m->next, p++)
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);
+ if (h)
{
- /* 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;
+ 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;
+ /* 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;
- /* Add the stack section to the PT_GNU_STACK segment,
- such that its size and alignment requirements make it
- to the segment. */
- if (m->count == 0)
- {
- m->sections[m->count] = sec;
- m->count++;
- }
- }
+ p->p_align = 8;
}
return TRUE;
@@ -6973,9 +6959,9 @@ elf32_frv_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
#undef elf_backend_always_size_sections
#define elf_backend_always_size_sections \
elf32_frvfdpic_always_size_sections
-#undef elf_backend_modify_segment_map
-#define elf_backend_modify_segment_map \
- elf32_frvfdpic_modify_segment_map
+#undef elf_backend_modify_program_headers
+#define elf_backend_modify_program_headers \
+ elf32_frvfdpic_modify_program_headers
#undef bfd_elf32_bfd_copy_private_bfd_data
#define bfd_elf32_bfd_copy_private_bfd_data \
elf32_frvfdpic_copy_private_bfd_data