diff options
Diffstat (limited to 'ld')
-rw-r--r-- | ld/emultempl/elf.em | 1 | ||||
-rw-r--r-- | ld/ldelf.c | 3 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/elf.exp | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/header.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/linux-x86.exp | 36 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/p_align-1.c | 25 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/page-size-1.d | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr26936.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/seg.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-pru/pru_irq_map-1.d | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-pru/pru_irq_map-2.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/pr23571.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/rgn-at5.d | 2 |
13 files changed, 79 insertions, 10 deletions
diff --git a/ld/emultempl/elf.em b/ld/emultempl/elf.em index 9c8e792..5977526 100644 --- a/ld/emultempl/elf.em +++ b/ld/emultempl/elf.em @@ -721,6 +721,7 @@ fragment <<EOF || (link_info.maxpagesize & (link_info.maxpagesize - 1)) != 0) einfo (_("%F%P: invalid maximum page size \`%s'\n"), optarg + 14); + link_info.maxpagesize_is_set = true; } else if (startswith (optarg, "common-page-size=")) { @@ -72,6 +72,9 @@ ldelf_after_parse (void) link_info.dynamic_undefined_weak = 0; } after_parse_default (); + if (link_info.commonpagesize > link_info.maxpagesize) + einfo (_("%F%P: common page size (0x%v) > maximum page size (0x%v)\n"), + link_info.commonpagesize, link_info.maxpagesize); } /* Handle the generation of DT_NEEDED tags. */ diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp index 119908c..16128c2 100644 --- a/ld/testsuite/ld-elf/elf.exp +++ b/ld/testsuite/ld-elf/elf.exp @@ -365,7 +365,7 @@ if { [istarget *-*-linux*] run_ld_link_exec_tests [list \ [list \ "Run mbind2a" \ - "$NOPIE_LDFLAGS -Wl,-z,common-page-size=0x4000" \ + "$NOPIE_LDFLAGS -Wl,-z,common-page-size=0x4000,-z,max-page-size=0x4000" \ "" \ { mbind2a.s mbind2b.c } \ "mbind2a" \ @@ -374,7 +374,7 @@ if { [istarget *-*-linux*] ] \ [list \ "Run mbind2b" \ - "-static -Wl,-z,common-page-size=0x4000" \ + "-static -Wl,-z,common-page-size=0x4000,-z,max-page-size=0x4000" \ "" \ { mbind2a.s mbind2b.c } \ "mbind2b" \ diff --git a/ld/testsuite/ld-elf/header.d b/ld/testsuite/ld-elf/header.d index c4d174a..67f0c98 100644 --- a/ld/testsuite/ld-elf/header.d +++ b/ld/testsuite/ld-elf/header.d @@ -1,5 +1,5 @@ # target: *-*-linux* *-*-gnu* *-*-vxworks arm*-*-uclinuxfdpiceabi -# ld: -T header.t -z max-page-size=0x100 +# ld: -T header.t -z max-page-size=0x100 -z common-page-size=0x100 # objdump: -hpw #... diff --git a/ld/testsuite/ld-elf/linux-x86.exp b/ld/testsuite/ld-elf/linux-x86.exp index f48c196..2e0cbd3 100644 --- a/ld/testsuite/ld-elf/linux-x86.exp +++ b/ld/testsuite/ld-elf/linux-x86.exp @@ -185,6 +185,42 @@ run_ld_link_exec_tests [list \ "" \ "tmpdir/indirect-extern-access-2.so" \ ] \ + [list \ + "Run p_align-1a without PIE" \ + "$NOPIE_LDFLAGS" \ + "" \ + { p_align-1.c } \ + "p_align-1a" \ + "pass.out" \ + "$NOPIE_CFLAGS" \ + ] \ + [list \ + "Run p_align-1b with PIE" \ + "-pie" \ + "" \ + { p_align-1.c } \ + "p_align-1b" \ + "pass.out" \ + "-fpie" \ + ] \ + [list \ + "Run p_align-1c with -Wl,-z,max-page-size=0x1000 without PIE" \ + "$NOPIE_LDFLAGS -Wl,-z,max-page-size=0x1000" \ + "" \ + { p_align-1.c } \ + "p_align-1c" \ + "pass.out" \ + "$NOPIE_CFLAGS" \ + ] \ + [list \ + "Run p_align-1d with -Wl,-z,max-page-size=0x1000 with PIE" \ + "-pie -Wl,-z,max-page-size=0x1000" \ + "" \ + { p_align-1.c } \ + "p_align-1d" \ + "pass.out" \ + "-fpie" \ + ] \ ] proc elfedit_test { options test output } { diff --git a/ld/testsuite/ld-elf/p_align-1.c b/ld/testsuite/ld-elf/p_align-1.c new file mode 100644 index 0000000..6579cd7 --- /dev/null +++ b/ld/testsuite/ld-elf/p_align-1.c @@ -0,0 +1,25 @@ +#include <stdio.h> +#include <stdint.h> +#include <stdlib.h> + +#ifndef ALIGN +# define ALIGN 0x800000 +#endif + +int +__attribute__ ((weak)) +is_aligned (void *p, int align) +{ + return (((uintptr_t) p) & (align - 1)) == 0; +} + +int foo __attribute__ ((aligned (ALIGN))) = 1; + +int +main (void) +{ + if (!is_aligned (&foo, ALIGN)) + abort (); + printf ("PASS\n"); + return 0; +} diff --git a/ld/testsuite/ld-elf/page-size-1.d b/ld/testsuite/ld-elf/page-size-1.d new file mode 100644 index 0000000..04d2153 --- /dev/null +++ b/ld/testsuite/ld-elf/page-size-1.d @@ -0,0 +1,4 @@ +#source: dummy.s +#ld: -z common-page-size=0x4000 -z max-page-size=0x1000 +#error: common page size \(0x4000\) > maximum page size \(0x1000\) +#target: *-*-linux-gnu *-*-gnu* arm*-*-uclinuxfdpiceabi diff --git a/ld/testsuite/ld-elf/pr26936.d b/ld/testsuite/ld-elf/pr26936.d index 0a2831d..c479f47 100644 --- a/ld/testsuite/ld-elf/pr26936.d +++ b/ld/testsuite/ld-elf/pr26936.d @@ -2,7 +2,7 @@ #source: pr26936b.s #source: pr26936c.s #as: --gen-debug -#ld: -z noseparate-code -Ttext-segment 0x10000 -z max-page-size=0x1000 +#ld: -z noseparate-code -Ttext-segment 0x10000 -z max-page-size=0x1000 -z common-page-size=0x1000 #readelf: -wL -W #target: [check_shared_lib_support] # Assembly source file for the HPPA assembler is renamed and modifed by diff --git a/ld/testsuite/ld-elf/seg.d b/ld/testsuite/ld-elf/seg.d index 3ff7aba..9dce11e 100644 --- a/ld/testsuite/ld-elf/seg.d +++ b/ld/testsuite/ld-elf/seg.d @@ -1,6 +1,6 @@ #target: *-*-linux* *-*-gnu* *-*-vxworks arm*-*-uclinuxfdpiceabi #source: seg.s -#ld: -T seg.t -z max-page-size=0x1000 +#ld: -T seg.t -z max-page-size=0x1000 -z common-page-size=0x1000 #readelf: -l --wide #... diff --git a/ld/testsuite/ld-pru/pru_irq_map-1.d b/ld/testsuite/ld-pru/pru_irq_map-1.d index bbdf5b6..2538f4c 100644 --- a/ld/testsuite/ld-pru/pru_irq_map-1.d +++ b/ld/testsuite/ld-pru/pru_irq_map-1.d @@ -1,4 +1,4 @@ -#name: pru_irq_map special section for host +#name: pru_irq_map special section for host 1 #source: pru_irq_map.s #ld: --defsym=__HEAP_SIZE=0 --defsym=__STACK_SIZE=0 #readelf: -l --wide @@ -9,7 +9,7 @@ Program Headers: +Type +Offset +VirtAddr +PhysAddr +FileSiz +MemSiz +Flg +Align +LOAD +0x[0-9a-f]+ 0x0+ 0x0+ 0x0+8 0x0+8 RW 0x1 - +LOAD +0x[0-9a-f]+ 0x20+ 0x20+ 0x0+4 0x0+4 R E 0x1 + +LOAD +0x[0-9a-f]+ 0x20+ 0x20+ 0x0+4 0x0+4 R E 0x4 Section to Segment mapping: +Segment Sections... diff --git a/ld/testsuite/ld-pru/pru_irq_map-2.d b/ld/testsuite/ld-pru/pru_irq_map-2.d index 3166595..d6c583f 100644 --- a/ld/testsuite/ld-pru/pru_irq_map-2.d +++ b/ld/testsuite/ld-pru/pru_irq_map-2.d @@ -1,4 +1,4 @@ -#name: pru_irq_map special section for host +#name: pru_irq_map special section for host 2 #source: pru_irq_map.s #ld: --defsym=__HEAP_SIZE=0 --defsym=__STACK_SIZE=0 #readelf: -S --wide diff --git a/ld/testsuite/ld-scripts/pr23571.d b/ld/testsuite/ld-scripts/pr23571.d index adf4796..45b4059 100644 --- a/ld/testsuite/ld-scripts/pr23571.d +++ b/ld/testsuite/ld-scripts/pr23571.d @@ -1,5 +1,5 @@ #source: align2a.s -#ld: -T pr23571.t -z common-page-size=0x1000 +#ld: -T pr23571.t -z common-page-size=0x1000 -z max-page-size=0x1000 #objdump: -h -w .*: +file format .* diff --git a/ld/testsuite/ld-scripts/rgn-at5.d b/ld/testsuite/ld-scripts/rgn-at5.d index 767285c..e9ab081 100644 --- a/ld/testsuite/ld-scripts/rgn-at5.d +++ b/ld/testsuite/ld-scripts/rgn-at5.d @@ -1,6 +1,6 @@ # name: rgn-at5 # source: rgn-at5.s -# ld: -T rgn-at5.t -z max-page-size=0x1000 +# ld: -T rgn-at5.t -z max-page-size=0x1000 -z common-page-size=0x1000 # objdump: -w -h # target: *-*-linux* *-*-gnu* arm*-*-uclinuxfdpiceabi # xfail: rx-*-* |