Warn if value of SEGMENT_START isn't multiple of maximum page size.
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 26 May 2010 14:10:15 +0000 (14:10 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 26 May 2010 14:10:15 +0000 (14:10 +0000)
ld/

2010-05-26  H.J. Lu  <hongjiu.lu@intel.com>

PR ld/11628
* ldexp.c (fold_binary): Warn if value of SEGMENT_START isn't
multiple of maximum page size.

ld/testsuite/

2010-05-26  H.J. Lu  <hongjiu.lu@intel.com>

PR ld/11628
* ld-elf/textaddr3.d: New.
* ld-elf/textaddr4.d: Likewise.
* ld-elf/textaddr5.d: Likewise.
* ld-elf/textaddr6.d: Likewise.
* ld-elf/textaddr7.d: Likewise.

ld/ChangeLog
ld/ldexp.c
ld/testsuite/ChangeLog
ld/testsuite/ld-elf/textaddr3.d [new file with mode: 0644]
ld/testsuite/ld-elf/textaddr4.d [new file with mode: 0644]
ld/testsuite/ld-elf/textaddr5.d [new file with mode: 0644]
ld/testsuite/ld-elf/textaddr6.d [new file with mode: 0644]
ld/testsuite/ld-elf/textaddr7.d [new file with mode: 0644]

index ffa59e7db96006f23145458a682ab8d3fb58e26e..d6324e0254b775576e6115ebb9e8df170e80e488 100644 (file)
@@ -1,3 +1,9 @@
+2010-05-26  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/11628
+       * ldexp.c (fold_binary): Warn if value of SEGMENT_START isn't
+       multiple of maximum page size.
+
 2010-05-25  Nick Clifton  <nickc@redhat.com>
 
        * Makefile.am: Fix typo.
index 34d9eabde7f67506d79f54afdcdc262b194d7b30..c0ca818247a66a18aa08fc175dcf801cc0494706 100644 (file)
@@ -299,6 +299,11 @@ fold_binary (etree_type *tree)
       for (seg = segments; seg; seg = seg->next) 
        if (strcmp (seg->name, segment_name) == 0)
          {
+           if (!seg->used
+               && config.magic_demand_paged
+               && (seg->value % config.maxpagesize) != 0)
+             einfo (_("%P: warning: address of `%s' isn't multiple of maximum page size\n"),
+                    segment_name);
            seg->used = TRUE;
            expld.result.value = seg->value;
            expld.result.str = NULL;
index 4a3989e08d083fea6e2f759bf6ea7fc36d0bcf05..a59ad4a2b78d499efc687e04901c5944448fc40e 100644 (file)
@@ -1,3 +1,12 @@
+2010-05-26  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/11628
+       * ld-elf/textaddr3.d: New.
+       * ld-elf/textaddr4.d: Likewise.
+       * ld-elf/textaddr5.d: Likewise.
+       * ld-elf/textaddr6.d: Likewise.
+       * ld-elf/textaddr7.d: Likewise.
+
 2010-05-25  Daniel Jacobowitz  <dan@codesourcery.com>
            Joseph Myers  <joseph@codesourcery.com>
            Andrew Stubbs  <ams@codesourcery.com>
diff --git a/ld/testsuite/ld-elf/textaddr3.d b/ld/testsuite/ld-elf/textaddr3.d
new file mode 100644 (file)
index 0000000..d533e24
--- /dev/null
@@ -0,0 +1,4 @@
+#source: maxpage1.s
+#ld: -Ttext-segment 0x10000 -z max-page-size=0x200000
+#target: *-*-linux-gnu
+#warning: .*address of `text-segment' isn't multiple of maximum page size
diff --git a/ld/testsuite/ld-elf/textaddr4.d b/ld/testsuite/ld-elf/textaddr4.d
new file mode 100644 (file)
index 0000000..bfd7630
--- /dev/null
@@ -0,0 +1,8 @@
+#source: maxpage1.s
+#ld: -z max-page-size=0x10000 -Ttext-segment 0x10000
+#readelf: -l --wide
+#target: *-*-linux-gnu
+
+#...
+  LOAD +0x0+ 0x0*10000 0x0*10000 0x0*[0-9a-f][0-9a-f][0-9a-f] 0x0*[0-9a-f][0-9a-f][0-9a-f] R E 0x10000
+#pass
diff --git a/ld/testsuite/ld-elf/textaddr5.d b/ld/testsuite/ld-elf/textaddr5.d
new file mode 100644 (file)
index 0000000..5fe41d0
--- /dev/null
@@ -0,0 +1,4 @@
+#source: maxpage1.s
+#ld: -shared -z max-page-size=0x200000 -Ttext-segment 0x10000
+#target: *-*-linux-gnu
+#warning: .*address of `text-segment' isn't multiple of maximum page size
diff --git a/ld/testsuite/ld-elf/textaddr6.d b/ld/testsuite/ld-elf/textaddr6.d
new file mode 100644 (file)
index 0000000..b3b9f84
--- /dev/null
@@ -0,0 +1,8 @@
+#source: maxpage1.s
+#ld: -shared -z max-page-size=0x10000 -Ttext-segment 0x10000
+#readelf: -l --wide
+#target: *-*-linux-gnu
+
+#...
+  LOAD +0x0+ 0x0*10000 0x0*10000 0x0*[0-9a-f][0-9a-f][0-9a-f] 0x0*[0-9a-f][0-9a-f][0-9a-f] R E 0x10000
+#pass
diff --git a/ld/testsuite/ld-elf/textaddr7.d b/ld/testsuite/ld-elf/textaddr7.d
new file mode 100644 (file)
index 0000000..54a571f
--- /dev/null
@@ -0,0 +1,8 @@
+#source: maxpage1.s
+#ld: -n -z max-page-size=0x200000 -Ttext-segment 0x10000
+#readelf: -l --wide
+#target: *-*-linux-gnu
+
+#...
+  LOAD .*
+#pass