diff options
author | Nick Clifton <nickc@redhat.com> | 2023-11-06 13:59:53 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2023-11-06 13:59:53 +0000 |
commit | f1837d9c3f2dc2a5c232f4eae4c4bd5a7f77baf8 (patch) | |
tree | 1a402e2068d9a1c0946aaf1e65a2b9729c66f582 /ld/testsuite | |
parent | f005d229412772e89f8deabc493cee6256ea6559 (diff) | |
download | gdb-f1837d9c3f2dc2a5c232f4eae4c4bd5a7f77baf8.zip gdb-f1837d9c3f2dc2a5c232f4eae4c4bd5a7f77baf8.tar.gz gdb-f1837d9c3f2dc2a5c232f4eae4c4bd5a7f77baf8.tar.bz2 |
ld: =fillexp different behaviors for hexidecimal literal
PR 30865
* ld.texi: Update description of the FILL command.
* testsuite/ld-scripts/fill2.d: New test.
* testsuite/ld-scripts/fill2.t: New test source.
* testsuite/ld-scripts/data.exp: Run the new test.
Diffstat (limited to 'ld/testsuite')
-rw-r--r-- | ld/testsuite/ld-scripts/data.exp | 1 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/fill2.d | 12 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/fill2.t | 29 |
3 files changed, 42 insertions, 0 deletions
diff --git a/ld/testsuite/ld-scripts/data.exp b/ld/testsuite/ld-scripts/data.exp index 3de3227..c3198a0 100644 --- a/ld/testsuite/ld-scripts/data.exp +++ b/ld/testsuite/ld-scripts/data.exp @@ -29,6 +29,7 @@ if { [is_pecoff_format] } then { run_dump_test data run_dump_test fill run_dump_test fill16 +run_dump_test fill2 run_dump_test pr27100 set LDFLAGS $old_LDFLAGS diff --git a/ld/testsuite/ld-scripts/fill2.d b/ld/testsuite/ld-scripts/fill2.d new file mode 100644 index 0000000..f913a82 --- /dev/null +++ b/ld/testsuite/ld-scripts/fill2.d @@ -0,0 +1,12 @@ +#source: fill_0.s +#ld: -T fill2.t +#readelf: -x.foo +#notarget: ![is_elf_format] +# See PR 30865 - a fill value expressed as a simple hexadecimal +# number behaves differently from other fill values. + +Hex dump of section '.foo': + 0x00000000 00000000 00000090 91919191 00000092 ................ + 0x00000010 00000093 00025000 00969500 00000097 ................ + 0x00000020 00010203 04050607 04050607 04050607 ................ + 0x00000030 08090a0b ffffffff .* diff --git a/ld/testsuite/ld-scripts/fill2.t b/ld/testsuite/ld-scripts/fill2.t new file mode 100644 index 0000000..1ad9e46 --- /dev/null +++ b/ld/testsuite/ld-scripts/fill2.t @@ -0,0 +1,29 @@ +SECTIONS { + .foo : + { + . += 4; + FILL (144) # Decimal values zero extend to 4 bytes. Fills with: 00 00 00 90 + . += 4; + FILL (0x91) # Hex values do not zero extend. Fills with: 91 91 91 91 + . += 4; + FILL ($92) # A dollar prefix indicates a hex values that does zero extend. Fills with: 00 00 00 92 + . += 4; + FILL (93H) # An H suffix does the same. Fills with: 00 00 00 93 + . += 4; + FILL (0x94K) # A hex value with a manitude suffix zero extends. Fills with: 00 02 50 00 + . += 4; + FILL (0x009695) # Zeros in hex values are significant. Values are big-endian. Fills with: 00 96 95 00 + . += 4; + FILL (0x90+0x7) # An expression containing hex values also zero extends. Fills with: 00 00 00 97 + . += 4; + FILL (0x0001020304050607) # Hex values can be used to specify fills with more than 4 bytes. Fills with: 00 01 02 03 04 05 06 07 + . += 8; + FILL ($0001020304050607) # But non-hex or $-hex or suffix-hex values cannot. Fills with 04 05 06 07 04 05 06 07 + . += 8; + FILL (0x08090a0b0c0d0e0f) # Extra bytes at the end of a value are silently ignored. Fills with 08 09 0a 0b + . += 4; + LONG(0xffffffff) + } =0 + + /DISCARD/ : { *(*) } +} |