aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2006-06-20 14:34:08 +0000
committerAlan Modra <amodra@gmail.com>2006-06-20 14:34:08 +0000
commite36284abcf727bced126cad8c8a1cc7ba33ad6c2 (patch)
treed308125ac4028d70454f104f164a817f53ffd42e /bfd/elf.c
parentadd68859a914922df926ec91edeb3282dcf86cd4 (diff)
downloadgdb-e36284abcf727bced126cad8c8a1cc7ba33ad6c2.zip
gdb-e36284abcf727bced126cad8c8a1cc7ba33ad6c2.tar.gz
gdb-e36284abcf727bced126cad8c8a1cc7ba33ad6c2.tar.bz2
* 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/elf.c')
-rw-r--r--bfd/elf.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 25570ec..8a725c3 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -3734,8 +3734,6 @@ elf_modify_segment_map (bfd *abfd, struct bfd_link_info *info)
m->count = new_count;
}
- /* Yes, we call elf_backend_modify_segment_map at least two times
- for the linker. The final time the link_orders are available. */
bed = get_elf_backend_data (abfd);
if (bed->elf_backend_modify_segment_map != NULL)
{
@@ -4217,7 +4215,8 @@ assign_file_positions_for_load_sections (bfd *abfd,
unsigned int alloc;
unsigned int i;
- if (!elf_modify_segment_map (abfd, link_info))
+ if (link_info == NULL
+ && !elf_modify_segment_map (abfd, link_info))
return FALSE;
alloc = 0;
@@ -4720,8 +4719,8 @@ assign_file_positions_for_non_load_sections (bfd *abfd,
if (lp->p_type == PT_LOAD
&& lp->p_vaddr <= link_info->relro_end
&& lp->p_vaddr >= link_info->relro_start
- && lp->p_vaddr + lp->p_filesz
- >= link_info->relro_end)
+ && (lp->p_vaddr + lp->p_filesz
+ >= link_info->relro_end))
break;
}
@@ -4823,6 +4822,12 @@ assign_file_positions_except_relocs (bfd *abfd,
if (!assign_file_positions_for_non_load_sections (abfd, link_info))
return FALSE;
+ if (bed->elf_backend_modify_program_headers != NULL)
+ {
+ if (!(*bed->elf_backend_modify_program_headers) (abfd, link_info))
+ return FALSE;
+ }
+
/* Write out the program headers. */
alloc = tdata->program_header_size / bed->s->sizeof_phdr;
if (bfd_seek (abfd, (bfd_signed_vma) bed->s->sizeof_ehdr, SEEK_SET) != 0