diff options
author | Pali Rohár <pali@kernel.org> | 2024-07-26 15:10:18 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2024-07-29 20:01:06 +0930 |
commit | fb2a924990d3595c4b39cbcd37ebc36df761a3ad (patch) | |
tree | ab733665ef3bbc937acbd936b884ecf46c406c31 /ld/testsuite/ld-pe | |
parent | 972092a9eda941a5744125f79fe58e52fb7007e4 (diff) | |
download | gdb-fb2a924990d3595c4b39cbcd37ebc36df761a3ad.zip gdb-fb2a924990d3595c4b39cbcd37ebc36df761a3ad.tar.gz gdb-fb2a924990d3595c4b39cbcd37ebc36df761a3ad.tar.bz2 |
PR 31728 testcases
Diffstat (limited to 'ld/testsuite/ld-pe')
12 files changed, 148 insertions, 12 deletions
diff --git a/ld/testsuite/ld-pe/exclude-symbols-def-i386.d b/ld/testsuite/ld-pe/exclude-symbols-def-i386.d index 91426c5..512b9ab 100644 --- a/ld/testsuite/ld-pe/exclude-symbols-def-i386.d +++ b/ld/testsuite/ld-pe/exclude-symbols-def-i386.d @@ -4,7 +4,9 @@ #objdump: -p #... -.*\[[ ]*0\].*sym1 -.*\[[ ]*1\].*sym3 -.*\[[ ]*2\].*sym5 +.* Ordinal Hint Name +.*\+base\[ 1\] 0000 sym1 +.*\+base\[ 2\] 0001 sym3 +.*\+base\[ 3\] 0002 sym5 + #pass diff --git a/ld/testsuite/ld-pe/exclude-symbols-def-x86_64.d b/ld/testsuite/ld-pe/exclude-symbols-def-x86_64.d index e3f0698..d17de41 100644 --- a/ld/testsuite/ld-pe/exclude-symbols-def-x86_64.d +++ b/ld/testsuite/ld-pe/exclude-symbols-def-x86_64.d @@ -4,7 +4,9 @@ #objdump: -p #... -.*\[[ ]*0\].*sym1 -.*\[[ ]*1\].*sym3 -.*\[[ ]*2\].*sym5 +.* Ordinal Hint Name +.*\+base\[ 1\] 0000 sym1 +.*\+base\[ 2\] 0001 sym3 +.*\+base\[ 3\] 0002 sym5 + #pass diff --git a/ld/testsuite/ld-pe/exclude-symbols-embedded-i386.d b/ld/testsuite/ld-pe/exclude-symbols-embedded-i386.d index fd79a7c..89ca6e6 100644 --- a/ld/testsuite/ld-pe/exclude-symbols-embedded-i386.d +++ b/ld/testsuite/ld-pe/exclude-symbols-embedded-i386.d @@ -4,7 +4,9 @@ #objdump: -p #... -.*\[[ ]*0\].*sym1 -.*\[[ ]*1\].*sym3 -.*\[[ ]*2\].*sym5 +.* Ordinal Hint Name +.*\+base\[ 1\] 0000 sym1 +.*\+base\[ 2\] 0001 sym3 +.*\+base\[ 3\] 0002 sym5 + #pass diff --git a/ld/testsuite/ld-pe/exclude-symbols-embedded-x86_64.d b/ld/testsuite/ld-pe/exclude-symbols-embedded-x86_64.d index 780482e..5bbda0f 100644 --- a/ld/testsuite/ld-pe/exclude-symbols-embedded-x86_64.d +++ b/ld/testsuite/ld-pe/exclude-symbols-embedded-x86_64.d @@ -4,7 +4,9 @@ #objdump: -p #... -.*\[[ ]*0\].*sym1 -.*\[[ ]*1\].*sym3 -.*\[[ ]*2\].*sym5 +.* Ordinal Hint Name +.*\+base\[ 1\] 0000 sym1 +.*\+base\[ 2\] 0001 sym3 +.*\+base\[ 3\] 0002 sym5 + #pass diff --git a/ld/testsuite/ld-pe/pe.exp b/ld/testsuite/ld-pe/pe.exp index 6a30366..457b667 100644 --- a/ld/testsuite/ld-pe/pe.exp +++ b/ld/testsuite/ld-pe/pe.exp @@ -144,3 +144,8 @@ run_dump_test "exclude-symbols-embedded-i386" run_dump_test "exclude-symbols-embedded-x86_64" run_dump_test "exclude-symbols-def-i386" run_dump_test "exclude-symbols-def-x86_64" + +run_dump_test "symbols-ordinals-hints-exports-ld" +run_dump_test "symbols-ordinals-hints-exports-dlltool" +run_dump_test "symbols-ordinals-hints-imports-ld" +run_dump_test "symbols-ordinals-hints-imports-dlltool" diff --git a/ld/testsuite/ld-pe/symbols-ordinals-hints-call-imports.s b/ld/testsuite/ld-pe/symbols-ordinals-hints-call-imports.s new file mode 100644 index 0000000..475f72e --- /dev/null +++ b/ld/testsuite/ld-pe/symbols-ordinals-hints-call-imports.s @@ -0,0 +1,8 @@ +.global _func +_func: + call __imp__sym1 + call __imp__sym2 + call __imp__sym3 + call __imp__sym4 + call __imp__sym5 + ret diff --git a/ld/testsuite/ld-pe/symbols-ordinals-hints-exports-dlltool.d b/ld/testsuite/ld-pe/symbols-ordinals-hints-exports-dlltool.d new file mode 100644 index 0000000..8de0976 --- /dev/null +++ b/ld/testsuite/ld-pe/symbols-ordinals-hints-exports-dlltool.d @@ -0,0 +1,21 @@ +#source: symbols-ordinals-hints-exports.s +#dlltool: -d ${srcdir}/${subdir}/symbols-ordinals-hints.def -e exports-dlltool.o +#ld: -shared exports-dlltool.o +#objdump: -p + +# Rules for Ordinal/Name Pointer Table: +# - Table rows must be lexicographically sorted by symbol names +# - Hint numbers must be in sequence starting from zero +# - Ordinal numbers must match the @ordinal keyword from .def file +# - Symbols in .def file without @ordinal keyword have assigned the first free ordinal starting from 1 +# - Symbols in .def file with NONAME keyword must not be present in Name Pointer Table + +#... +.*\[Ordinal/Name Pointer\] Table -- Ordinal Base.* +.* Ordinal Hint Name +.*\+base\[ 2\] 0000 sym1 +.*\+base\[ 5\] 0001 sym2 +.*\+base\[ 3\] 0002 sym4 +.*\+base\[ 4\] 0003 sym5 + +#pass diff --git a/ld/testsuite/ld-pe/symbols-ordinals-hints-exports-ld.d b/ld/testsuite/ld-pe/symbols-ordinals-hints-exports-ld.d new file mode 100644 index 0000000..0e7dcac --- /dev/null +++ b/ld/testsuite/ld-pe/symbols-ordinals-hints-exports-ld.d @@ -0,0 +1,20 @@ +#source: symbols-ordinals-hints-exports.s +#ld: -shared ${srcdir}/${subdir}/symbols-ordinals-hints.def +#objdump: -p + +# Rules for Ordinal/Name Pointer Table: +# - Table rows must be lexicographically sorted by symbol names +# - Hint numbers must be in sequence starting from zero +# - Ordinal numbers must match the @ordinal keyword from .def file +# - Symbols in .def file without @ordinal keyword have assigned the first free ordinal starting from 1 +# - Symbols in .def file with NONAME keyword must not be present in Name Pointer Table + +#... +.*\[Ordinal/Name Pointer\] Table -- Ordinal Base.* +.* Ordinal Hint Name +.*\+base\[ 2\] 0000 sym1 +.*\+base\[ 5\] 0001 sym2 +.*\+base\[ 3\] 0002 sym4 +.*\+base\[ 4\] 0003 sym5 + +#pass diff --git a/ld/testsuite/ld-pe/symbols-ordinals-hints-exports.s b/ld/testsuite/ld-pe/symbols-ordinals-hints-exports.s new file mode 100644 index 0000000..d775d70 --- /dev/null +++ b/ld/testsuite/ld-pe/symbols-ordinals-hints-exports.s @@ -0,0 +1,12 @@ +# define symbols in no specific order +.global _sym2 +.global _sym5 +.global _sym3 +.global _sym1 +.global _sym4 +_sym2: +_sym5: +_sym3: +_sym1: +_sym4: + ret diff --git a/ld/testsuite/ld-pe/symbols-ordinals-hints-imports-dlltool.d b/ld/testsuite/ld-pe/symbols-ordinals-hints-imports-dlltool.d new file mode 100644 index 0000000..6cfa5c4 --- /dev/null +++ b/ld/testsuite/ld-pe/symbols-ordinals-hints-imports-dlltool.d @@ -0,0 +1,27 @@ +#source: symbols-ordinals-hints-call-imports.s +#dlltool: -d ${srcdir}/${subdir}/symbols-ordinals-hints.def -l libimports-dlltool.a +#ld: -shared +#ld_after_inputfiles: libimports-dlltool.a +#objdump: -p + +# Rules for Import Tables: +# - Ordinal, Hint and Member-Name (what is present) match Ordinal/Name Pointer Table of +# the external DLL (from corresponding symbols-ordinals-hints-exports-*.d test) +# - Symbols in .def file with NONAME keyword have only Ordinal, must no have Hint and Member-Name +# - Symbols in .def file without NONAME keyword have Hint and Member-Name, must not have Ordinal + +#... +The Import Tables \(interpreted \.idata section contents\) + vma: Hint Time Forward DLL First + Table Stamp Chain Name Thunk +.* + +.*DLL Name:.* +.* Ordinal Hint Member-Name Bound-To +.* <none> 0000 sym1 +.* <none> 0001 sym2 +.* 1 <none> <none> +.* <none> 0002 sym4 +.* <none> 0003 sym5 + +#pass diff --git a/ld/testsuite/ld-pe/symbols-ordinals-hints-imports-ld.d b/ld/testsuite/ld-pe/symbols-ordinals-hints-imports-ld.d new file mode 100644 index 0000000..1b17351 --- /dev/null +++ b/ld/testsuite/ld-pe/symbols-ordinals-hints-imports-ld.d @@ -0,0 +1,26 @@ +#source: symbols-ordinals-hints-exports.s +#ld: -shared ${srcdir}/${subdir}/symbols-ordinals-hints.def --out-implib libimports-ld.a +#ld_after_inputfiles: && $AS ${srcdir}/${subdir}/symbols-ordinals-hints-call-imports.s -o call-imports-ld.o && $LD -shared call-imports-ld.o libimports-ld.a -o tmpdir/dump +#objdump: -p + +# Rules for Import Tables: +# - Ordinal, Hint and Member-Name (what is present) match Ordinal/Name Pointer Table of +# the external DLL (from corresponding symbols-ordinals-hints-exports-*.d test) +# - Symbols in .def file with NONAME keyword have only Ordinal, must no have Hint and Member-Name +# - Symbols in .def file without NONAME keyword have Hint and Member-Name, must not have Ordinal + +#... +The Import Tables \(interpreted \.idata section contents\) + vma: Hint Time Forward DLL First + Table Stamp Chain Name Thunk +.* + +.*DLL Name:.* +.* Ordinal Hint Member-Name Bound-To +.* <none> 0000 sym1 +.* <none> 0001 sym2 +.* 1 <none> <none> +.* <none> 0002 sym4 +.* <none> 0003 sym5 + +#pass diff --git a/ld/testsuite/ld-pe/symbols-ordinals-hints.def b/ld/testsuite/ld-pe/symbols-ordinals-hints.def new file mode 100644 index 0000000..5b79a48 --- /dev/null +++ b/ld/testsuite/ld-pe/symbols-ordinals-hints.def @@ -0,0 +1,9 @@ +LIBRARY "symbols-ordinals-hints.dll" +EXPORTS +; define symbols in no specific order +; define ordinals also in no specific order +sym2 @5 +sym5 +sym3 @1 NONAME +sym1 @2 +sym4 |