aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf-nacl.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2012-04-09 16:27:18 +0000
committerRoland McGrath <roland@gnu.org>2012-04-09 16:27:18 +0000
commitd324f6d66ba4ddd975973e0a494c5c9c9be532fc (patch)
tree561e713d099fbd067469d7821b5adde18f21e364 /bfd/elf-nacl.c
parentfb57d4525b04b5fc28dc98c6034aa5c667bbbc71 (diff)
downloadgdb-d324f6d66ba4ddd975973e0a494c5c9c9be532fc.zip
gdb-d324f6d66ba4ddd975973e0a494c5c9c9be532fc.tar.gz
gdb-d324f6d66ba4ddd975973e0a494c5c9c9be532fc.tar.bz2
bfd/
* elf.c (_bfd_elf_map_sections_to_segments): Set INFO->user_phdrs. * elf-nacl.c (nacl_modify_segment_map): Do nothing if INFO->user_phdrs. (nacl_modify_program_headers): Likewise. include/ * bfdlink.h (struct bfd_link_info): Add new member user_phdrs.
Diffstat (limited to 'bfd/elf-nacl.c')
-rw-r--r--bfd/elf-nacl.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/bfd/elf-nacl.c b/bfd/elf-nacl.c
index 3ba7f55..842e367 100644
--- a/bfd/elf-nacl.c
+++ b/bfd/elf-nacl.c
@@ -62,13 +62,18 @@ segment_nonexecutable_and_has_contents (struct elf_segment_map *seg)
The first non-executable PT_LOAD segment appears first in the file
and contains the ELF file header and phdrs. */
bfd_boolean
-nacl_modify_segment_map (bfd *abfd, struct bfd_link_info *info ATTRIBUTE_UNUSED)
+nacl_modify_segment_map (bfd *abfd, struct bfd_link_info *info)
{
struct elf_segment_map **m = &elf_tdata (abfd)->segment_map;
struct elf_segment_map **first_load = NULL;
struct elf_segment_map **last_load = NULL;
bfd_boolean moved_headers = FALSE;
+ if (info != NULL && info->user_phdrs)
+ /* The linker script used PHDRS explicitly, so don't change what the
+ user asked for. */
+ return TRUE;
+
while (*m != NULL)
{
struct elf_segment_map *seg = *m;
@@ -141,6 +146,11 @@ nacl_modify_program_headers (bfd *abfd,
Elf_Internal_Phdr *phdr = elf_tdata (abfd)->phdr;
Elf_Internal_Phdr *p = phdr;
+ if (info != NULL && info->user_phdrs)
+ /* The linker script used PHDRS explicitly, so don't change what the
+ user asked for. */
+ return TRUE;
+
/* Find the PT_LOAD that contains the headers (should be the first). */
while (*m != NULL)
{