aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2014-01-22 11:43:03 +1030
committerAlan Modra <amodra@gmail.com>2014-01-22 11:58:29 +1030
commit2edab91c10dcae30a93ce7d9f8088b8b33ee55eb (patch)
tree883bbadffed39aea4c78262946e12a35660b5bbe /ld/testsuite
parent4584ec12076e088cf36965b88ef8710ca85491f9 (diff)
downloadgdb-2edab91c10dcae30a93ce7d9f8088b8b33ee55eb.zip
gdb-2edab91c10dcae30a93ce7d9f8088b8b33ee55eb.tar.gz
gdb-2edab91c10dcae30a93ce7d9f8088b8b33ee55eb.tar.bz2
Make assignments to dot keep an empty output section.
An assignment to dot in an output section that allocates space of course keeps the output section. Here, I'm changing the behaviour for assignments that don't allocate space. The idea is not so much to allow people to force output of an empty section with ". = .", but to fix cases where an otherwise empty section has padding added by an alignment expression that changes with relaxation or .eh_frame editing. Such a section might have zero size before relaxation and so be stripped incorrectly. ld/ * ld.texinfo (Output Section Discarding): Mention assigning to dot as a way of keeping otherwise empty sections. * ldexp.c (is_dot, is_value, is_sym_value, is_dot_ne_0, is_dot_plus_0, is_align_conditional): New predicates. (exp_fold_tree_1): Set SEC_KEEP when assigning to dot inside an output section, except for some special cases. * scripttempl/elfmicroblaze.sc: Use canonical form to align at end of .heap and .stack. ld/testsuite/ * ld-shared/elf-offset.ld: Align end of .bss with canonical form of ALIGN that allows an empty .bss to be removed. * ld-arm/arm-dyn.ld: Likewise. * ld-arm/arm-lib.ld: Likewise. * ld-elfvsb/elf-offset.ld: Likewise. * ld-mips-elf/mips-dyn.ld: Likewise. * ld-mips-elf/mips-lib.ld: Likewise. * ld-arm/arm-no-rel-plt.ld: Remove duplicate ALIGN. * ld-powerpc/vle-multiseg-1.ld: Remove ALIGN at start of section. ALIGN address of section instead. * ld-powerpc/vle-multiseg-2.ld: Likewise. * ld-powerpc/vle-multiseg-3.ld: Likewise. * ld-powerpc/vle-multiseg-4.ld: Likewise. * ld-powerpc/vle-multiseg-6.ld: Likewise. * ld-scripts/empty-aligned.d: Check section headers not program headers. Remove xfail and notarget. * ld-scripts/empty-aligned.t: Use canonical ALIGN for end of .text2.
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ChangeLog20
-rw-r--r--ld/testsuite/ld-arm/arm-dyn.ld2
-rw-r--r--ld/testsuite/ld-arm/arm-lib.ld2
-rw-r--r--ld/testsuite/ld-arm/arm-no-rel-plt.ld1
-rw-r--r--ld/testsuite/ld-elfvsb/elf-offset.ld2
-rw-r--r--ld/testsuite/ld-mips-elf/mips-dyn.ld2
-rw-r--r--ld/testsuite/ld-mips-elf/mips-lib.ld2
-rw-r--r--ld/testsuite/ld-powerpc/vle-multiseg-1.ld3
-rw-r--r--ld/testsuite/ld-powerpc/vle-multiseg-2.ld3
-rw-r--r--ld/testsuite/ld-powerpc/vle-multiseg-3.ld3
-rw-r--r--ld/testsuite/ld-powerpc/vle-multiseg-4.ld3
-rw-r--r--ld/testsuite/ld-powerpc/vle-multiseg-6.ld3
-rw-r--r--ld/testsuite/ld-scripts/empty-aligned.d14
-rw-r--r--ld/testsuite/ld-scripts/empty-aligned.t8
-rw-r--r--ld/testsuite/ld-shared/elf-offset.ld2
15 files changed, 38 insertions, 32 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index a092428..5fdf831 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,23 @@
+2014-01-22 Alan Modra <amodra@gmail.com>
+
+ * ld-shared/elf-offset.ld: Align end of .bss with canonical form
+ of ALIGN that allows an empty .bss to be removed.
+ * ld-arm/arm-dyn.ld: Likewise.
+ * ld-arm/arm-lib.ld: Likewise.
+ * ld-elfvsb/elf-offset.ld: Likewise.
+ * ld-mips-elf/mips-dyn.ld: Likewise.
+ * ld-mips-elf/mips-lib.ld: Likewise.
+ * ld-arm/arm-no-rel-plt.ld: Remove duplicate ALIGN.
+ * ld-powerpc/vle-multiseg-1.ld: Remove ALIGN at start of section.
+ ALIGN address of section instead.
+ * ld-powerpc/vle-multiseg-2.ld: Likewise.
+ * ld-powerpc/vle-multiseg-3.ld: Likewise.
+ * ld-powerpc/vle-multiseg-4.ld: Likewise.
+ * ld-powerpc/vle-multiseg-6.ld: Likewise.
+ * ld-scripts/empty-aligned.d: Check section headers not program
+ headers. Remove xfail and notarget.
+ * ld-scripts/empty-aligned.t: Use canonical ALIGN for end of .text2.
+
2014-01-21 H.J. Lu <hongjiu.lu@intel.com>
PR ld/16467
diff --git a/ld/testsuite/ld-arm/arm-dyn.ld b/ld/testsuite/ld-arm/arm-dyn.ld
index bef9a18..71cb4c9 100644
--- a/ld/testsuite/ld-arm/arm-dyn.ld
+++ b/ld/testsuite/ld-arm/arm-dyn.ld
@@ -149,7 +149,7 @@ SECTIONS
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections. */
- . = ALIGN(32 / 8);
+ . = ALIGN(. != 0 ? 32 / 8 : 1);
}
. = ALIGN(32 / 8);
_end = .;
diff --git a/ld/testsuite/ld-arm/arm-lib.ld b/ld/testsuite/ld-arm/arm-lib.ld
index c9482c3..f158c23 100644
--- a/ld/testsuite/ld-arm/arm-lib.ld
+++ b/ld/testsuite/ld-arm/arm-lib.ld
@@ -141,7 +141,7 @@ SECTIONS
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections. */
- . = ALIGN(32 / 8);
+ . = ALIGN(. != 0 ? 32 / 8 : 1);
}
. = ALIGN(32 / 8);
_end = .;
diff --git a/ld/testsuite/ld-arm/arm-no-rel-plt.ld b/ld/testsuite/ld-arm/arm-no-rel-plt.ld
index 439909c..d8e5c9d 100644
--- a/ld/testsuite/ld-arm/arm-no-rel-plt.ld
+++ b/ld/testsuite/ld-arm/arm-no-rel-plt.ld
@@ -181,7 +181,6 @@ SECTIONS
}
_bss_end__ = . ; __bss_end__ = . ;
. = ALIGN(32 / 8);
- . = ALIGN(32 / 8);
__end__ = . ;
_end = .; PROVIDE (end = .);
/* Stabs debugging sections. */
diff --git a/ld/testsuite/ld-elfvsb/elf-offset.ld b/ld/testsuite/ld-elfvsb/elf-offset.ld
index 7c64824..cd90bcc 100644
--- a/ld/testsuite/ld-elfvsb/elf-offset.ld
+++ b/ld/testsuite/ld-elfvsb/elf-offset.ld
@@ -131,7 +131,7 @@ SECTIONS
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections. */
- . = ALIGN(32 / 8);
+ . = ALIGN(. != 0 ? 32 / 8 : 1);
}
. = ALIGN(32 / 8);
_end = . ;
diff --git a/ld/testsuite/ld-mips-elf/mips-dyn.ld b/ld/testsuite/ld-mips-elf/mips-dyn.ld
index e4f90d2..b931e1b 100644
--- a/ld/testsuite/ld-mips-elf/mips-dyn.ld
+++ b/ld/testsuite/ld-mips-elf/mips-dyn.ld
@@ -179,7 +179,7 @@ SECTIONS
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections. */
- . = ALIGN(32 / 8);
+ . = ALIGN(. != 0 ? 32 / 8 : 1);
}
. = ALIGN(32 / 8);
_end = .;
diff --git a/ld/testsuite/ld-mips-elf/mips-lib.ld b/ld/testsuite/ld-mips-elf/mips-lib.ld
index 5073d9f..1d66c62 100644
--- a/ld/testsuite/ld-mips-elf/mips-lib.ld
+++ b/ld/testsuite/ld-mips-elf/mips-lib.ld
@@ -173,7 +173,7 @@ SECTIONS
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections. */
- . = ALIGN(32 / 8);
+ . = ALIGN(. != 0 ? 32 / 8 : 1);
}
. = ALIGN(32 / 8);
_end = .;
diff --git a/ld/testsuite/ld-powerpc/vle-multiseg-1.ld b/ld/testsuite/ld-powerpc/vle-multiseg-1.ld
index f2ff319..3fe37b9 100644
--- a/ld/testsuite/ld-powerpc/vle-multiseg-1.ld
+++ b/ld/testsuite/ld-powerpc/vle-multiseg-1.ld
@@ -4,7 +4,6 @@ SECTIONS
{ *(.data) *(.ctors) *(.dtors) *(.eh_frame) *(.jcr) }
.text_vle 0x00001000 :
{
- . = ALIGN(16);
INPUT_SECTION_FLAGS (SHF_PPC_VLE) *(.text_vle)
INPUT_SECTION_FLAGS (SHF_PPC_VLE) *(.text)
INPUT_SECTION_FLAGS (SHF_PPC_VLE) *(.init)
@@ -12,6 +11,6 @@ SECTIONS
INPUT_SECTION_FLAGS (SHF_PPC_VLE) *(.fini)
INPUT_SECTION_FLAGS (SHF_PPC_VLE) *(.fini_vle)
}
- .text_iv . : { . = ALIGN(16); *(.text_iv) }
+ .text_iv ALIGN(16) : { *(.text_iv) }
.iv_handlers 0x0001F000 : { *(.iv_handlers) }
}
diff --git a/ld/testsuite/ld-powerpc/vle-multiseg-2.ld b/ld/testsuite/ld-powerpc/vle-multiseg-2.ld
index 2320b61..da9a79d 100644
--- a/ld/testsuite/ld-powerpc/vle-multiseg-2.ld
+++ b/ld/testsuite/ld-powerpc/vle-multiseg-2.ld
@@ -2,7 +2,6 @@ SECTIONS
{
.text_vle 0x00001000 :
{
- . = ALIGN(16);
INPUT_SECTION_FLAGS (SHF_PPC_VLE) *(.text_vle)
INPUT_SECTION_FLAGS (SHF_PPC_VLE) *(.text)
INPUT_SECTION_FLAGS (SHF_PPC_VLE) *(.init)
@@ -12,6 +11,6 @@ SECTIONS
}
.data 0x00001400 :
{ *(.data) *(.ctors) *(.dtors) *(.eh_frame) *(.jcr) }
- .text_iv . : { . = ALIGN(16); *(.text_iv) }
+ .text_iv ALIGN(16) : { *(.text_iv) }
.iv_handlers 0x0001F000 : { *(.iv_handlers) }
}
diff --git a/ld/testsuite/ld-powerpc/vle-multiseg-3.ld b/ld/testsuite/ld-powerpc/vle-multiseg-3.ld
index 0ed2f44..cfb1d88 100644
--- a/ld/testsuite/ld-powerpc/vle-multiseg-3.ld
+++ b/ld/testsuite/ld-powerpc/vle-multiseg-3.ld
@@ -2,7 +2,6 @@ SECTIONS
{
.text_vle 0x00001000 :
{
- . = ALIGN(16);
INPUT_SECTION_FLAGS (SHF_PPC_VLE) *(.text_vle)
INPUT_SECTION_FLAGS (SHF_PPC_VLE) *(.text)
INPUT_SECTION_FLAGS (SHF_PPC_VLE) *(.init)
@@ -10,7 +9,7 @@ SECTIONS
INPUT_SECTION_FLAGS (SHF_PPC_VLE) *(.fini)
INPUT_SECTION_FLAGS (SHF_PPC_VLE) *(.fini_vle)
}
- .text_iv . : { . = ALIGN(16); *(.text_iv) }
+ .text_iv ALIGN(16) : { *(.text_iv) }
.data 0x00001400 :
{ *(.data) *(.ctors) *(.dtors) *(.eh_frame) *(.jcr) }
.iv_handlers 0x0001F000 : { *(.iv_handlers) }
diff --git a/ld/testsuite/ld-powerpc/vle-multiseg-4.ld b/ld/testsuite/ld-powerpc/vle-multiseg-4.ld
index 503fe06..2130427 100644
--- a/ld/testsuite/ld-powerpc/vle-multiseg-4.ld
+++ b/ld/testsuite/ld-powerpc/vle-multiseg-4.ld
@@ -2,7 +2,6 @@ SECTIONS
{
.text_vle 0x00001000 :
{
- . = ALIGN(16);
INPUT_SECTION_FLAGS (SHF_PPC_VLE) *(.text_vle)
INPUT_SECTION_FLAGS (SHF_PPC_VLE) *(.text)
INPUT_SECTION_FLAGS (SHF_PPC_VLE) *(.init)
@@ -10,7 +9,7 @@ SECTIONS
INPUT_SECTION_FLAGS (SHF_PPC_VLE) *(.fini)
INPUT_SECTION_FLAGS (SHF_PPC_VLE) *(.fini_vle)
}
- .text_iv . : { . = ALIGN(16); *(.text_iv) }
+ .text_iv ALIGN(16) : { *(.text_iv) }
.iv_handlers 0x0001F000 : { *(.iv_handlers) }
.data 0x00020400 :
{ *(.data) *(.ctors) *(.dtors) *(.eh_frame) *(.jcr) }
diff --git a/ld/testsuite/ld-powerpc/vle-multiseg-6.ld b/ld/testsuite/ld-powerpc/vle-multiseg-6.ld
index c8d88dd..2db76cc 100644
--- a/ld/testsuite/ld-powerpc/vle-multiseg-6.ld
+++ b/ld/testsuite/ld-powerpc/vle-multiseg-6.ld
@@ -16,7 +16,6 @@ SECTIONS
}
.text_vle 0x00001000 :
{
- . = ALIGN(16);
INPUT_SECTION_FLAGS (SHF_PPC_VLE) *(.text*)
INPUT_SECTION_FLAGS (SHF_PPC_VLE) *(.init*)
INPUT_SECTION_FLAGS (SHF_PPC_VLE) *(.fini*)
@@ -24,14 +23,12 @@ SECTIONS
.text_iv 0x100000 :
{
- . = ALIGN(16);
INPUT_SECTION_FLAGS (SHF_PPC_VLE) *(.text_iv)
INPUT_SECTION_FLAGS (SHF_PPC_VLE) *(.iv_handlers)
} >vle_seg2
.text 0x101000 :
{
- . = ALIGN(16);
INPUT_SECTION_FLAGS (!SHF_PPC_VLE) *(.text*)
}
}
diff --git a/ld/testsuite/ld-scripts/empty-aligned.d b/ld/testsuite/ld-scripts/empty-aligned.d
index d9916dd..ff131eb 100644
--- a/ld/testsuite/ld-scripts/empty-aligned.d
+++ b/ld/testsuite/ld-scripts/empty-aligned.d
@@ -1,14 +1,8 @@
#source: empty-aligned.s
#ld: -T empty-aligned.t
-#readelf: -l --wide
-#xfail: "hppa64-*-*"
-#notarget: frv-*-*linux*
+#readelf: -S --wide
#...
-Program Headers:
- +Type +Offset +VirtAddr +PhysAddr +FileSiz +MemSiz +Flg +Align
- +LOAD +0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ [RWE ]+ +0x[0-9a-f]+
-! +LOAD .*
-#...
- +Segment Sections\.\.\.
- +00 +.text
+.* .text .*
+!.* .text[234] .*
+#pass
diff --git a/ld/testsuite/ld-scripts/empty-aligned.t b/ld/testsuite/ld-scripts/empty-aligned.t
index e59bc20..5f6a38d 100644
--- a/ld/testsuite/ld-scripts/empty-aligned.t
+++ b/ld/testsuite/ld-scripts/empty-aligned.t
@@ -6,14 +6,14 @@ SECTIONS
{
*(.text1)
}
- /* Same for alignment at beginning and end. */
+ /* Same for alignment at beginning and end, although we need to be
+ careful in the expression used to align. */
.text2 ALIGN (4096) :
{
*(.text2)
- . = ALIGN (4096);
+ . = ALIGN (. != 0 ? 4096 : 1);
}
- /* Same for alignment just at end, although we need to be careful in
- the expression used to align. */
+ /* Same for alignment just at end. */
.text3 :
{
*(.text3)
diff --git a/ld/testsuite/ld-shared/elf-offset.ld b/ld/testsuite/ld-shared/elf-offset.ld
index 125d879..ee587f9 100644
--- a/ld/testsuite/ld-shared/elf-offset.ld
+++ b/ld/testsuite/ld-shared/elf-offset.ld
@@ -128,7 +128,7 @@ SECTIONS
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections. */
- . = ALIGN(32 / 8);
+ . = ALIGN(. != 0 ? 32 / 8 : 1);
}
. = ALIGN(32 / 8);
_end = . ;