[PATCH v2 5/5] LoongArch: Add DT_RELR tests
mengqinggang
mengqinggang@loongson.cn
Thu Jun 27 07:11:39 GMT 2024
> diff --git a/ld/testsuite/ld-loongarch-elf/relr-text-pie.d b/ld/testsuite/ld-loongarch-elf/relr-text-pie.d
> new file mode 100644
> index 00000000000..8e34500fbd2
> --- /dev/null
> +++ b/ld/testsuite/ld-loongarch-elf/relr-text-pie.d
> @@ -0,0 +1,14 @@
> +#source: relr-text.s
> +#ld: -shared -z pack-relative-relocs -T relr-relocs.ld
ld: -shared -> ld: pie?
> +#readelf: -drW
> +
> +#...
> + 0x0000000000000016 \(TEXTREL\) 0x0
> +#...
> + 0x0000000000000024 \(RELR\) .*
> + 0x0000000000000023 \(RELRSZ\) 8 \(bytes\)
> + 0x0000000000000025 \(RELRENT\) 8 \(bytes\)
> +#...
> +Relocation section '\.relr\.dyn' .* contains 1 entry which relocates 1 location:
> +Index: Entry Address Symbolic Address
> +0000: 0000000000010000 0000000000010000 _start
> diff --git a/ld/testsuite/ld-loongarch-elf/relr-text-shared.d b/ld/testsuite/ld-loongarch-elf/relr-text-shared.d
> new file mode 100644
> index 00000000000..8e34500fbd2
> --- /dev/null
> +++ b/ld/testsuite/ld-loongarch-elf/relr-text-shared.d
> @@ -0,0 +1,14 @@
> +#source: relr-text.s
> +#ld: -shared -z pack-relative-relocs -T relr-relocs.ld
> +#readelf: -drW
> +
> +#...
> + 0x0000000000000016 \(TEXTREL\) 0x0
> +#...
> + 0x0000000000000024 \(RELR\) .*
> + 0x0000000000000023 \(RELRSZ\) 8 \(bytes\)
> + 0x0000000000000025 \(RELRENT\) 8 \(bytes\)
> +#...
> +Relocation section '\.relr\.dyn' .* contains 1 entry which relocates 1 location:
> +Index: Entry Address Symbolic Address
> +0000: 0000000000010000 0000000000010000 _start
> diff --git a/ld/testsuite/ld-loongarch-elf/relr-text.s b/ld/testsuite/ld-loongarch-elf/relr-text.s
> new file mode 100644
> index 00000000000..47465f2d8c4
> --- /dev/null
> +++ b/ld/testsuite/ld-loongarch-elf/relr-text.s
> @@ -0,0 +1,10 @@
> +# Test DT_RELR with DT_TEXTREL and R_LARCH_ALIGN.
> +
> +.text
> +.p2align 5
> +.global _start
> +_start:
> +.global foo
> +.hidden foo
> +foo:
> +.quad foo
More information about the Binutils
mailing list