aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2007-01-11 12:23:53 +0000
committerNathan Sidwell <nathan@codesourcery.com>2007-01-11 12:23:53 +0000
commit59e0647f0d3c0176557aef0f0d6fc14ee44a0b2a (patch)
tree24b862907e031ac594072b2dea3a720d1f0dfb38
parente2204714e24debd8c495122615ea1582724db750 (diff)
downloadgdb-59e0647f0d3c0176557aef0f0d6fc14ee44a0b2a.zip
gdb-59e0647f0d3c0176557aef0f0d6fc14ee44a0b2a.tar.gz
gdb-59e0647f0d3c0176557aef0f0d6fc14ee44a0b2a.tar.bz2
bfd/
* elf.c (assign_file_positions_for_load_sections): We can require fewer phdrs than expected. ld/ * emultempl/elf-generic.em (gdl_map_segments): Only allow header shrinkage for the first few iterations. ld/testsuite/ * ld-elf/header.d: New. * ld-elf/header.t: New. * ld-elf/header.s: New.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf.c2
-rw-r--r--ld/ChangeLog5
-rw-r--r--ld/emultempl/elf-generic.em12
-rw-r--r--ld/testsuite/ChangeLog6
-rw-r--r--ld/testsuite/ld-elf/header.d12
-rw-r--r--ld/testsuite/ld-elf/header.s8
-rw-r--r--ld/testsuite/ld-elf/header.t8
8 files changed, 56 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 0db2a5e..c3cc405 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2007-01-11 Nathan Sidwell <nathan@codesourcery.com>
+
+ * elf.c (assign_file_positions_for_load_sections): We can
+ require fewer phdrs than expected.
+
2007-01-08 Kazu Hirata <kazu@codesourcery.com>
* archures.c (bfd_mach_cpu32_fido): Rename to bfd_mach_fido.
diff --git a/bfd/elf.c b/bfd/elf.c
index c8fcbb5..faeb145 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -4275,7 +4275,7 @@ assign_file_positions_for_load_sections (bfd *abfd,
elf_tdata (abfd)->program_header_size = alloc * bed->s->sizeof_phdr;
else
BFD_ASSERT (elf_tdata (abfd)->program_header_size
- == alloc * bed->s->sizeof_phdr);
+ >= alloc * bed->s->sizeof_phdr);
if (alloc == 0)
{
diff --git a/ld/ChangeLog b/ld/ChangeLog
index b3de4e6..d5366ec 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,8 @@
+2007-01-11 Nathan Sidwell <nathan@codesourcery.com>
+
+ * emultempl/elf-generic.em (gdl_map_segments): Only allow header
+ shrinkage for the first few iterations.
+
2007-01-08 Kai Tietz <kai.tietz@onevision.com>
* configure.tgt: Renamed target x86_64-*-mingw64 to
diff --git a/ld/emultempl/elf-generic.em b/ld/emultempl/elf-generic.em
index dd0907c..7edee8b 100644
--- a/ld/emultempl/elf-generic.em
+++ b/ld/emultempl/elf-generic.em
@@ -60,7 +60,17 @@ gld${EMULATION_NAME}_map_segments (bfd_boolean need_layout)
einfo ("%F%P: map sections to segments failed: %E\n");
if (phdr_size != elf_tdata (output_bfd)->program_header_size)
- need_layout = TRUE;
+ {
+ if (tries > 6)
+ /* The first few times we allow any change to
+ phdr_size . */
+ need_layout = TRUE;
+ else if (phdr_size < elf_tdata (output_bfd)->program_header_size)
+ /* After that we only allow the size to grow. */
+ need_layout = TRUE;
+ else
+ elf_tdata (output_bfd)->program_header_size = phdr_size;
+ }
}
}
while (need_layout && --tries);
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 93c63d6..4b70936 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2007-01-11 Nathan Sidwell <nathan@codesourcery.com>
+
+ * ld-elf/header.d: New.
+ * ld-elf/header.t: New.
+ * ld-elf/header.s: New.
+
2007-01-08 Kai Tietz <kai.tietz@onevision.com>
* ld-fastcall/fastcall.exp: Renamed target x86_64-*-mingw64 to
diff --git a/ld/testsuite/ld-elf/header.d b/ld/testsuite/ld-elf/header.d
new file mode 100644
index 0000000..bc4bed3
--- /dev/null
+++ b/ld/testsuite/ld-elf/header.d
@@ -0,0 +1,12 @@
+# ld: -T header.t -z max-page-size=0x10000
+# objdump: -hpw
+
+#...
+Program Header:
+ LOAD off 0x0*0000000 vaddr 0x0*0010000 paddr 0x0*0010000 align 2..16
+ filesz 0x0*001002[48] memsz 0x0*001002[48] flags rwx
+
+Sections:
+Idx Name Size VMA *LMA *File off Algn Flags
+ 0 .text 0*000ffac 0*001007[48] 0*001007[48] 0*000007[48] 2... CONTENTS, ALLOC, LOAD, READONLY, CODE
+ 1 .data 0*0000004 0*002002[04] 0*002002[04] 0*001002[04] 2... CONTENTS, ALLOC, LOAD, DATA
diff --git a/ld/testsuite/ld-elf/header.s b/ld/testsuite/ld-elf/header.s
new file mode 100644
index 0000000..c47d3f1
--- /dev/null
+++ b/ld/testsuite/ld-elf/header.s
@@ -0,0 +1,8 @@
+ .text
+ .globl main
+main:
+ .rept 0x4000 - 0x15
+ .long 0xfedcba98
+ .endr
+ .data
+ .long 0x76543210
diff --git a/ld/testsuite/ld-elf/header.t b/ld/testsuite/ld-elf/header.t
new file mode 100644
index 0000000..cc0317b
--- /dev/null
+++ b/ld/testsuite/ld-elf/header.t
@@ -0,0 +1,8 @@
+ENTRY(main)
+
+SECTIONS
+{
+ . = 0x10000 + SIZEOF_HEADERS;
+ .text : { *(.text) }
+ .data : { *(.data) }
+}