aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2007-01-19 15:06:27 +0000
committerH.J. Lu <hjl.tools@gmail.com>2007-01-19 15:06:27 +0000
commitb81428656759ee87a5619f8495c04123ec71d582 (patch)
tree59636355e4dc3a3b04e1d3c7ee82c85bec953f95 /ld
parent14be856495aa9995b691665ac113d84277439feb (diff)
downloadfsf-binutils-gdb-b81428656759ee87a5619f8495c04123ec71d582.zip
fsf-binutils-gdb-b81428656759ee87a5619f8495c04123ec71d582.tar.gz
fsf-binutils-gdb-b81428656759ee87a5619f8495c04123ec71d582.tar.bz2
ld/
2007-01-19 Jakub Jelinek <jakub@redhat.com> H.J. Lu <hongjiu.lu@intel.com> * emultempl/elf32.em (handle_option): Make sure -z max-page-size or -z common-page-size argument is a power of 2. Call bfd_emul_set_maxpagesize and bfd_emul_set_commonpagesize. 2007-01-19 H.J. Lu <hongjiu.lu@intel.com> * ldmain.c (main): Don't call bfd_emul_set_maxpagesize nor bfd_emul_set_commonpagesize. ld/testsuite/ 2007-01-19 H.J. Lu <hongjiu.lu@intel.com> * ld-elf/maxpage3.t: New file. * ld-elf/maxpage3a.d: Likewise. * ld-elf/maxpage3b.d: Likewise. * ld-elf/maxpage3c.d: Likewise.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog12
-rw-r--r--ld/emultempl/elf32.em10
-rw-r--r--ld/ldmain.c7
-rw-r--r--ld/testsuite/ChangeLog7
-rw-r--r--ld/testsuite/ld-elf/maxpage3.t7
-rw-r--r--ld/testsuite/ld-elf/maxpage3a.d11
-rw-r--r--ld/testsuite/ld-elf/maxpage3b.d10
-rw-r--r--ld/testsuite/ld-elf/maxpage3c.d12
8 files changed, 67 insertions, 9 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 8bf6eca..4fb8e55 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,15 @@
+2007-01-19 Jakub Jelinek <jakub@redhat.com>
+ H.J. Lu <hongjiu.lu@intel.com>
+
+ * emultempl/elf32.em (handle_option): Make sure -z max-page-size
+ or -z common-page-size argument is a power of 2. Call
+ bfd_emul_set_maxpagesize and bfd_emul_set_commonpagesize.
+
+2007-01-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ * ldmain.c (main): Don't call bfd_emul_set_maxpagesize nor
+ bfd_emul_set_commonpagesize.
+
2007-01-19 H.J. Lu <hongjiu.lu@intel.com>
* NEWS: Mention --default-script/-dT.
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 2888008..1646d2e 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -1915,17 +1915,23 @@ cat >>e${EMULATION_NAME}.c <<EOF
char *end;
config.maxpagesize = strtoul (optarg + 14, &end, 0);
- if (*end)
+ if (*end || (config.maxpagesize & (config.maxpagesize - 1)) != 0)
einfo (_("%P%F: invalid maxium page size \`%s'\n"),
optarg + 14);
+ ASSERT (default_target != NULL);
+ bfd_emul_set_maxpagesize (default_target, config.maxpagesize);
}
else if (CONST_STRNEQ (optarg, "common-page-size="))
{
char *end;
config.commonpagesize = strtoul (optarg + 17, &end, 0);
- if (*end)
+ if (*end
+ || (config.commonpagesize & (config.commonpagesize - 1)) != 0)
einfo (_("%P%F: invalid common page size \`%s'\n"),
optarg + 17);
+ ASSERT (default_target != NULL);
+ bfd_emul_set_commonpagesize (default_target,
+ config.commonpagesize);
}
/* What about the other Solaris -z options? FIXME. */
break;
diff --git a/ld/ldmain.c b/ld/ldmain.c
index eb59ba8..8bd4bf4 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -344,13 +344,6 @@ main (int argc, char **argv)
if (config.hash_table_size != 0)
bfd_hash_set_default_size (config.hash_table_size);
- if (config.maxpagesize != 0)
- bfd_emul_set_maxpagesize (default_target, config.maxpagesize);
-
- if (config.commonpagesize != 0)
- bfd_emul_set_commonpagesize (default_target,
- config.commonpagesize);
-
ldemul_set_symbols ();
if (link_info.relocatable)
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index e40246b..db2440e 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2007-01-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ * ld-elf/maxpage3.t: New file.
+ * ld-elf/maxpage3a.d: Likewise.
+ * ld-elf/maxpage3b.d: Likewise.
+ * ld-elf/maxpage3c.d: Likewise.
+
2007-01-19 H.J. Lu <hongjiu.lu@intel.com>
* ld-scripts/default-script.exp: New file.
diff --git a/ld/testsuite/ld-elf/maxpage3.t b/ld/testsuite/ld-elf/maxpage3.t
new file mode 100644
index 0000000..556dcd5
--- /dev/null
+++ b/ld/testsuite/ld-elf/maxpage3.t
@@ -0,0 +1,7 @@
+SECTIONS
+{
+ .text : {*(.text)}
+ . = ALIGN(CONSTANT (MAXPAGESIZE));
+ .data : {*(.data)}
+ /DISCARD/ : {*(*)}
+}
diff --git a/ld/testsuite/ld-elf/maxpage3a.d b/ld/testsuite/ld-elf/maxpage3a.d
new file mode 100644
index 0000000..0e46b6b
--- /dev/null
+++ b/ld/testsuite/ld-elf/maxpage3a.d
@@ -0,0 +1,11 @@
+#source: maxpage1.s
+#ld: -z max-page-size=0x10000000 -T maxpage3.t
+#readelf: -lS --wide
+#target: *-*-linux*
+
+#...
+ \[[ 0-9]+\] \.data[ \t]+PROGBITS[ \t]+0*10000000[ \t]+[ \t0-9a-f]+WA?.*
+#...
+ LOAD+.*0x10000000
+ LOAD+.*0x10000000
+#pass
diff --git a/ld/testsuite/ld-elf/maxpage3b.d b/ld/testsuite/ld-elf/maxpage3b.d
new file mode 100644
index 0000000..4bee0ec
--- /dev/null
+++ b/ld/testsuite/ld-elf/maxpage3b.d
@@ -0,0 +1,10 @@
+#source: maxpage1.s
+#ld: -T maxpage3.t -z max-page-size=0x10000000
+#readelf: -lS --wide
+#target: x86_64-*-linux*
+
+#...
+ \[[ 0-9]+\] \.data[ \t]+PROGBITS[ \t]+0*200000[ \t]+[ \t0-9a-f]+WA?.*
+#...
+ LOAD+.*0x10000000
+#pass
diff --git a/ld/testsuite/ld-elf/maxpage3c.d b/ld/testsuite/ld-elf/maxpage3c.d
new file mode 100644
index 0000000..cdc3eaf
--- /dev/null
+++ b/ld/testsuite/ld-elf/maxpage3c.d
@@ -0,0 +1,12 @@
+#source: maxpage1.s
+#as: --32
+#ld: -m elf_i386 -z max-page-size=0x10000000 -T maxpage3.t
+#readelf: -lS --wide
+#target: x86_64-*-linux*
+
+#...
+ \[[ 0-9]+\] \.data[ \t]+PROGBITS[ \t]+0*10000000[ \t]+[ \t0-9a-f]+WA?.*
+#...
+ LOAD+.*0x10000000
+ LOAD+.*0x10000000
+#pass