summaryrefslogtreecommitdiff
path: root/bfd/elf-nacl.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2012-04-09 16:27:14 +0000
committerRoland McGrath <roland@gnu.org>2012-04-09 16:27:14 +0000
commit78d1f159cba9d502f392018f73fec49a93d85dbb (patch)
treedf632f3c62ae5f9539b36acf877572c7a4f0be21 /bfd/elf-nacl.c
parent5ef01b8ce95c2c23fa49b17320b2783ba703a9e4 (diff)
downloadbinutils-redhat-78d1f159cba9d502f392018f73fec49a93d85dbb.tar.gz
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 3ba7f5582e..842e367d97 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)
{