ld/
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 19 Jan 2007 15:06:27 +0000 (15:06 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 19 Jan 2007 15:06:27 +0000 (15:06 +0000)
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.

ld/ChangeLog
ld/emultempl/elf32.em
ld/ldmain.c
ld/testsuite/ChangeLog
ld/testsuite/ld-elf/maxpage3.t [new file with mode: 0644]
ld/testsuite/ld-elf/maxpage3a.d [new file with mode: 0644]
ld/testsuite/ld-elf/maxpage3b.d [new file with mode: 0644]
ld/testsuite/ld-elf/maxpage3c.d [new file with mode: 0644]

index 8bf6eca77b3eedc84a711ffe8140f2b12afbd68c..4fb8e5545c0c9894feef23a555c6f186f98dfdc5 100644 (file)
@@ -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.
index 28880084fa885b1b8d2a914c2761cf680f1f5da1..1646d2ebf3d721584dc2bf0abf70e3c2f9cdfdcb 100644 (file)
@@ -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;
index eb59ba8076f045436f25e0a1180792b57f207522..8bd4bf4786a618b11abb0ac854e7bc5f79417ab1 100644 (file)
@@ -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)
index e40246b5412a2670d53b9b407a1ac7544517f257..db2440e2a71b2f25002ae30d9a77ede7086b4922 100644 (file)
@@ -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 (file)
index 0000000..556dcd5
--- /dev/null
@@ -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 (file)
index 0000000..0e46b6b
--- /dev/null
@@ -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 (file)
index 0000000..4bee0ec
--- /dev/null
@@ -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 (file)
index 0000000..cdc3eaf
--- /dev/null
@@ -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