diff options
author | Ulf Samuelsson <ulf@emagii.com> | 2023-02-14 10:13:28 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2023-02-14 10:13:28 +0000 |
commit | 0d79a2a8e2d91fc258ac795c19c13e3ab505a6c2 (patch) | |
tree | 6d366ae54f94ded995f08e3f2ea8ac47aa542de5 /ld/testsuite | |
parent | 12ef68305572ed139825be827b2bb1d1aef3ca25 (diff) | |
download | binutils-gdb-0d79a2a8e2d91fc258ac795c19c13e3ab505a6c2.tar.gz |
ASCIZ Command for output section
Adds a new directive to the linker script syntax: ASCIZ.
This inserts a zero-terminated string into the output at the place where it is used.
Diffstat (limited to 'ld/testsuite')
-rw-r--r-- | ld/testsuite/ld-scripts/asciz.d | 17 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/asciz.s | 8 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/asciz.t | 23 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/script.exp | 1 |
4 files changed, 49 insertions, 0 deletions
diff --git a/ld/testsuite/ld-scripts/asciz.d b/ld/testsuite/ld-scripts/asciz.d new file mode 100644 index 00000000000..615cf99732f --- /dev/null +++ b/ld/testsuite/ld-scripts/asciz.d @@ -0,0 +1,17 @@ +#source: asciz.s +#ld: -T asciz.t +#objdump: -s -j .text +#target: [is_elf_format] +#skip: mips*-*-* +#skip: tilegx*-*-* tilepro-*-* +# COFF, PE and MIPS targets align code to a 16 byte boundary +# tilegx andtilepro aligns code to a 8 byte boundary. + +.*: file format .* + +Contents of section .text: + .... 01010101 54686973 20697320 61207374 ....This is a st + .... 72696e67 00...... ........ ........ ring............ + .... 54686973 20697320 616e6f74 68657220 This is another + .... 0a737472 696e6753 00 .stringS........ +#pass diff --git a/ld/testsuite/ld-scripts/asciz.s b/ld/testsuite/ld-scripts/asciz.s new file mode 100644 index 00000000000..5803bb4e8ed --- /dev/null +++ b/ld/testsuite/ld-scripts/asciz.s @@ -0,0 +1,8 @@ + .section .text + .long 0x01010101 + + .section .data + .long 0x9abcdef0 + + .section .bss + .long 0 diff --git a/ld/testsuite/ld-scripts/asciz.t b/ld/testsuite/ld-scripts/asciz.t new file mode 100644 index 00000000000..ab66f9a5bfb --- /dev/null +++ b/ld/testsuite/ld-scripts/asciz.t @@ -0,0 +1,23 @@ +MEMORY { + rom : ORIGIN = 0x00000, LENGTH = 0x10000 + ram : ORIGIN = 0x10000, LENGTH = 0x10000 +} + +_start = 0x000000; +SECTIONS +{ + . = 0x1000 + SIZEOF_HEADERS; + .text ALIGN (0x20) : + { + *(.text) + ASCIZ "This is a string" + . = ALIGN(0x20); + align_label = .; + ASCIZ "This is another \nstring\123" + unalign_label = .; + } + .data : AT (0x10000) { *(.data) } >ram /* NO default AT>rom */ + . = ALIGN(0x20); + .bss : { *(.bss) } >ram /* NO default AT>rom */ + /DISCARD/ : { *(*) } +} diff --git a/ld/testsuite/ld-scripts/script.exp b/ld/testsuite/ld-scripts/script.exp index e0af28134a7..a574dde034c 100644 --- a/ld/testsuite/ld-scripts/script.exp +++ b/ld/testsuite/ld-scripts/script.exp @@ -227,6 +227,7 @@ foreach test_script $test_script_list { run_dump_test [string range $test_script 0 end-2] } +run_dump_test "asciz" run_dump_test "align-with-input" run_dump_test "pr20302" run_dump_test "output-section-types" |