aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-scripts
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/ld-scripts
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/ld-scripts')
-rw-r--r--ld/testsuite/ld-scripts/empty-aligned.d14
-rw-r--r--ld/testsuite/ld-scripts/empty-aligned.t8
2 files changed, 8 insertions, 14 deletions
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)