aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf-nacl.c
diff options
context:
space:
mode:
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)
{