diff options
Diffstat (limited to 'binutils-2.21/ld/testsuite/ld-pe')
52 files changed, 1733 insertions, 0 deletions
diff --git a/binutils-2.21/ld/testsuite/ld-pe/aligncomm-1.c b/binutils-2.21/ld/testsuite/ld-pe/aligncomm-1.c new file mode 100755 index 0000000..fc6cb03 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/aligncomm-1.c @@ -0,0 +1,26 @@ + +typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__)); +typedef __SIZE_TYPE__ size_t; + +long s1 = 0; +__m128 r; +__m128 * volatile raddr = &r; + +int main (int argc, const char **argv) +{ + return 15 & (int)(size_t)raddr; +} + +void __main (void) +{ + asm (".section .drectve\n" + " .ascii \" -aligncomm:_r,4\"\n" + " .ascii \" -aligncomm:r,4\"\n" + " .text"); +} + +#if defined (__CYGWIN__) || defined (__MINGW32__) +void _alloca (void) +{ +} +#endif diff --git a/binutils-2.21/ld/testsuite/ld-pe/aligncomm-2.c b/binutils-2.21/ld/testsuite/ld-pe/aligncomm-2.c new file mode 100755 index 0000000..5e042b8 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/aligncomm-2.c @@ -0,0 +1,27 @@ + +typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__)); +typedef __SIZE_TYPE__ size_t; + +long s1 = 0; +long s2 = 0; +__m128 r; +__m128 * volatile raddr = &r; + +int main (int argc, const char **argv) +{ + return 15 & (int)(size_t)raddr; +} + +void __main (void) +{ + asm (".section .drectve\n" + " .ascii \" -aligncomm:_r,4\"\n" + " .ascii \" -aligncomm:r,4\"\n" + " .text"); +} + +#if defined (__CYGWIN__) || defined (__MINGW32__) +void _alloca (void) +{ +} +#endif diff --git a/binutils-2.21/ld/testsuite/ld-pe/aligncomm-3.c b/binutils-2.21/ld/testsuite/ld-pe/aligncomm-3.c new file mode 100755 index 0000000..69184f9 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/aligncomm-3.c @@ -0,0 +1,28 @@ + +typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__)); +typedef __SIZE_TYPE__ size_t; + +long s1 = 0; +long s2 = 0; +long s3 = 0; +__m128 r; +__m128 * volatile raddr = &r; + +int main (int argc, const char **argv) +{ + return 15 & (int)(size_t)raddr; +} + +void __main (void) +{ + asm (".section .drectve\n" + " .ascii \" -aligncomm:_r,4\"\n" + " .ascii \" -aligncomm:r,4\"\n" + " .text"); +} + +#if defined (__CYGWIN__) || defined (__MINGW32__) +void _alloca (void) +{ +} +#endif diff --git a/binutils-2.21/ld/testsuite/ld-pe/aligncomm-4.c b/binutils-2.21/ld/testsuite/ld-pe/aligncomm-4.c new file mode 100755 index 0000000..085335a --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/aligncomm-4.c @@ -0,0 +1,29 @@ + +typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__)); +typedef __SIZE_TYPE__ size_t; + +long s1 = 0; +long s2 = 0; +long s3 = 0; +long s4 = 0; +__m128 r; +__m128 * volatile raddr = &r; + +int main (int argc, const char **argv) +{ + return 15 & (int)(size_t)raddr; +} + +void __main (void) +{ + asm (".section .drectve\n" + " .ascii \" -aligncomm:_r,4\"\n" + " .ascii \" -aligncomm:r,4\"\n" + " .text"); +} + +#if defined (__CYGWIN__) || defined (__MINGW32__) +void _alloca (void) +{ +} +#endif diff --git a/binutils-2.21/ld/testsuite/ld-pe/aligncomm.d b/binutils-2.21/ld/testsuite/ld-pe/aligncomm.d new file mode 100755 index 0000000..6f33644 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/aligncomm.d @@ -0,0 +1,3 @@ +#... +[0-9a-fA-F]{7,15}0 . r +#... diff --git a/binutils-2.21/ld/testsuite/ld-pe/basefile1.s b/binutils-2.21/ld/testsuite/ld-pe/basefile1.s new file mode 100644 index 0000000..f24c4fc --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/basefile1.s @@ -0,0 +1,18 @@ +.globl _start +.globl start +.text +_start: +start: + .long 0 + +.globl _d1 +.globl _d2 +.globl _d3 +.data +_d1: + .long 1 +_d2: + .secrel32 _d3 +_d3: + .long 2 + diff --git a/binutils-2.21/ld/testsuite/ld-pe/direct2_client.c b/binutils-2.21/ld/testsuite/ld-pe/direct2_client.c new file mode 100644 index 0000000..84cdcb6 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/direct2_client.c @@ -0,0 +1,47 @@ +extern void abort (void); + +void +__cdecl +lib2foocdecl(int junk1, int* junk2); + +void +__stdcall +lib2foostdcall(int junk1, int* junk2); + +void +__fastcall +lib2foofastcall(int junk1, int* junk2); + +void +__cdecl +lib1foocdecl(int junk1, int* junk2) +{ + lib2foocdecl(junk1, junk2); +} + +void +__stdcall +lib1foostdcall(int junk1, int* junk2) +{ + lib2foostdcall(junk1, junk2); +} + +void +__fastcall +lib1foofastcall(int junk1, int* junk2) +{ + lib2foofastcall(junk1, junk2); +} + +int main() +{ + int junk[3]; + lib1foofastcall (1, &junk[0]); + lib1foostdcall (2, &junk[1]); + lib1foocdecl (3, &junk[2]); + if (junk[1] != 2 || junk[0] != 1 || junk[2] != 3) + abort (); + + return 0; +} + diff --git a/binutils-2.21/ld/testsuite/ld-pe/direct2_dll.c b/binutils-2.21/ld/testsuite/ld-pe/direct2_dll.c new file mode 100644 index 0000000..115f9b9 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/direct2_dll.c @@ -0,0 +1,20 @@ +void +__cdecl +lib2foocdecl(int junk1, int* junk2) +{ + *junk2 = junk1; +} + +void +__stdcall +lib2foostdcall(int junk1, int* junk2) +{ + *junk2 = junk1; +} + +void +__fastcall +lib2foofastcall(int junk1, int* junk2) +{ + *junk2 = junk1; +} diff --git a/binutils-2.21/ld/testsuite/ld-pe/direct2_dll.def b/binutils-2.21/ld/testsuite/ld-pe/direct2_dll.def new file mode 100644 index 0000000..2e8986d --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/direct2_dll.def @@ -0,0 +1,6 @@ +LIBRARY "direct2_dll.dll" + +EXPORTS +lib2foocdecl +lib2foostdcall +lib2foofastcall diff --git a/binutils-2.21/ld/testsuite/ld-pe/direct_client.c b/binutils-2.21/ld/testsuite/ld-pe/direct_client.c new file mode 100644 index 0000000..6264a78 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/direct_client.c @@ -0,0 +1,8 @@ +__declspec(dllimport) int dll_func (void); + +int +main() +{ + dll_func (); + return 0; +} diff --git a/binutils-2.21/ld/testsuite/ld-pe/direct_dll.c b/binutils-2.21/ld/testsuite/ld-pe/direct_dll.c new file mode 100644 index 0000000..9863d1a --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/direct_dll.c @@ -0,0 +1,5 @@ +__declspec(dllexport) int +dll_func (void) +{ + return 10; +} diff --git a/binutils-2.21/ld/testsuite/ld-pe/export_dynamic_warning.d b/binutils-2.21/ld/testsuite/ld-pe/export_dynamic_warning.d new file mode 100644 index 0000000..38759b7 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/export_dynamic_warning.d @@ -0,0 +1,5 @@ +#name: PE-COFF --export-dynamic warning +#target: *-*-mingw32 *-*-cygwin *-*-pe +#ld: --export-dynamic +#warning: warning: --export-dynamic is not supported for PE\+? targets, did you mean --export-all-symbols\? + diff --git a/binutils-2.21/ld/testsuite/ld-pe/export_dynamic_warning.s b/binutils-2.21/ld/testsuite/ld-pe/export_dynamic_warning.s new file mode 100755 index 0000000..8089e06 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/export_dynamic_warning.s @@ -0,0 +1,4 @@ + +_start: + nop + diff --git a/binutils-2.21/ld/testsuite/ld-pe/exports.d b/binutils-2.21/ld/testsuite/ld-pe/exports.d new file mode 100644 index 0000000..bbeda11 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/exports.d @@ -0,0 +1,4 @@ +#... +The Data Directory +Entry 0 00000000 00000000 Export Directory \[\.edata \(or where ever we found it\)\] +#... diff --git a/binutils-2.21/ld/testsuite/ld-pe/exports.s b/binutils-2.21/ld/testsuite/ld-pe/exports.s new file mode 100644 index 0000000..aac7075 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/exports.s @@ -0,0 +1,2 @@ +# Deliberately left empty. + diff --git a/binutils-2.21/ld/testsuite/ld-pe/exports64.d b/binutils-2.21/ld/testsuite/ld-pe/exports64.d new file mode 100755 index 0000000..5fc5aeb --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/exports64.d @@ -0,0 +1,4 @@ +#... +The Data Directory +Entry 0 0000000000000000 00000000 Export Directory \[\.edata \(or where ever we found it\)\] +#... diff --git a/binutils-2.21/ld/testsuite/ld-pe/image_size.d b/binutils-2.21/ld/testsuite/ld-pe/image_size.d new file mode 100644 index 0000000..bd709e6 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/image_size.d @@ -0,0 +1,9 @@ +#name: PE-COFF SizeOfImage +#ld: -T image_size.t +#objdump: -p +#target: *-*-mingw32 *-*-cygwin + +.*: file format .* +#... +SizeOfImage 00004000 +#... diff --git a/binutils-2.21/ld/testsuite/ld-pe/image_size.s b/binutils-2.21/ld/testsuite/ld-pe/image_size.s new file mode 100644 index 0000000..3b56d7f --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/image_size.s @@ -0,0 +1,8 @@ + .text + .global _start +_start: + .byte 1 + .global data + .data +data: + .byte 2 diff --git a/binutils-2.21/ld/testsuite/ld-pe/image_size.t b/binutils-2.21/ld/testsuite/ld-pe/image_size.t new file mode 100644 index 0000000..f646eca --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/image_size.t @@ -0,0 +1,15 @@ +SECTIONS +{ + . = SIZEOF_HEADERS; + . = ALIGN(__section_alignment__); + .text __image_base__ + ( __section_alignment__ < 0x1000 ? . : __section_alignment__ ) : + { + *(.text) + } + . = . + 0x1000; + .data BLOCK(__section_alignment__) : + { + *(.data) + } + /DISCARD/ : { *(.*) } +} diff --git a/binutils-2.21/ld/testsuite/ld-pe/longsecn-1.d b/binutils-2.21/ld/testsuite/ld-pe/longsecn-1.d new file mode 100755 index 0000000..95b3337 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/longsecn-1.d @@ -0,0 +1,22 @@ +#name: PE-COFF Long section names (disabled) +#ld: --disable-long-section-names +#objdump: -h +#source: longsecn.s + +.*: file format .* + +Sections: +Idx Name Size VMA +LMA +File off Algn + 0 \.text [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, READONLY, CODE, DATA + 1 \.data [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 2 \.rodata [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 3 \.data\.ve [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 4 \.rodata\. [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 5 \.idata [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + diff --git a/binutils-2.21/ld/testsuite/ld-pe/longsecn-2.d b/binutils-2.21/ld/testsuite/ld-pe/longsecn-2.d new file mode 100755 index 0000000..8170006 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/longsecn-2.d @@ -0,0 +1,21 @@ +#name: PE-COFF Long section names (enabled) +#ld: --enable-long-section-names +#objdump: -h +#source: longsecn.s + +.*: file format .* + +Sections: +Idx Name Size VMA +LMA +File off Algn + 0 \.text [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, READONLY, CODE, DATA + 1 \.data [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 2 \.rodata [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 3 \.data\.very\.long\.section [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 4 \.rodata\.very.long\.section [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 5 \.idata [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA diff --git a/binutils-2.21/ld/testsuite/ld-pe/longsecn-3.d b/binutils-2.21/ld/testsuite/ld-pe/longsecn-3.d new file mode 100755 index 0000000..0317be3 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/longsecn-3.d @@ -0,0 +1,41 @@ +#name: PE-COFF Long section names in objects (default) +#ld: -r +#objdump: -h +#source: longsecn.s + +.*: file format .* + +Sections: +Idx Name Size VMA +LMA +File off Algn + 0 \.(text|bss ) [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + (CONTENTS, ALLOC, LOAD, (READONLY, )?CODE|ALLOC) + 1 \.text\.very\.long\.section\.name [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, READONLY, CODE, DATA + 2 \.data [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 3 \.data\$1 [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 4 \.rodata\$1 [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 5 \.data\$123 [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 6 \.rodata\$123 [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 7 \.data\$123456789 [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 8 \.rodata\$123456789 [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 9 \.data\.very\.long\.section [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 10 \.rodata\.very\.long\.section [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 11 \.data\.very\.long\.section\$1 [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 12 \.rodata\.very\.long\.section\$1 [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 13 \.data\.very\.long\.section\$1234 [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 14 \.rodata\.very\.long\.section\$1234 [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 15 \.(bss |text) [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + (ALLOC|CONTENTS, ALLOC, LOAD, (READONLY, )?CODE) diff --git a/binutils-2.21/ld/testsuite/ld-pe/longsecn-4.d b/binutils-2.21/ld/testsuite/ld-pe/longsecn-4.d new file mode 100755 index 0000000..565ef38 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/longsecn-4.d @@ -0,0 +1,41 @@ +#name: PE-COFF Long section names in objects (disabled) +#ld: --disable-long-section-names -r +#objdump: -h +#source: longsecn.s + +.*: file format .* + +Sections: +Idx Name Size VMA +LMA +File off Algn + 0 \.(text|bss ) [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + (CONTENTS, ALLOC, LOAD, (READONLY, )?CODE|ALLOC) + 1 \.text\.ve [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, READONLY, CODE, DATA + 2 \.data [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 3 \.data\$1 [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 4 \.rodata\$ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 5 \.data\$12 [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 6 \.rodata\$ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 7 \.data\$12 [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 8 \.rodata\$ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 9 \.data\.ve [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 10 \.rodata\. [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 11 \.data\.ve [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 12 \.rodata\. [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 13 \.data\.ve [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 14 \.rodata\. [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 15 \.(bss |text) [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + (ALLOC|CONTENTS, ALLOC, LOAD, (READONLY, )?CODE) diff --git a/binutils-2.21/ld/testsuite/ld-pe/longsecn-5.d b/binutils-2.21/ld/testsuite/ld-pe/longsecn-5.d new file mode 100755 index 0000000..82d94b8 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/longsecn-5.d @@ -0,0 +1,41 @@ +#name: PE-COFF Long section names in objects (enabled) +#ld: --enable-long-section-names -r +#objdump: -h +#source: longsecn.s + +.*: file format .* + +Sections: +Idx Name Size VMA +LMA +File off Algn + 0 \.(text|bss ) [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + (CONTENTS, ALLOC, LOAD, (READONLY, )?CODE|ALLOC) + 1 \.text\.very\.long\.section\.name [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, READONLY, CODE, DATA + 2 \.data [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 3 \.data\$1 [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 4 \.rodata\$1 [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 5 \.data\$123 [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 6 \.rodata\$123 [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 7 \.data\$123456789 [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 8 \.rodata\$123456789 [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 9 \.data\.very\.long\.section [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 10 \.rodata\.very\.long\.section [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 11 \.data\.very\.long\.section\$1 [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 12 \.rodata\.very\.long\.section\$1 [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 13 \.data\.very\.long\.section\$1234 [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 14 \.rodata\.very\.long\.section\$1234 [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 15 \.(bss |text) [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + (ALLOC|CONTENTS, ALLOC, LOAD, (READONLY, )?CODE) diff --git a/binutils-2.21/ld/testsuite/ld-pe/longsecn.d b/binutils-2.21/ld/testsuite/ld-pe/longsecn.d new file mode 100755 index 0000000..2dcde35 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/longsecn.d @@ -0,0 +1,22 @@ +#name: PE-COFF Long section names (default) +#ld: +#objdump: -h +#source: longsecn.s + +.*: file format .* + +Sections: +Idx Name Size VMA +LMA +File off Algn + 0 \.text [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, READONLY, CODE, DATA + 1 \.data [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 2 \.rodata [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 3 \.data\.ve [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 4 \.rodata\. [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + 5 \.idata [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9] + CONTENTS, ALLOC, LOAD, DATA + diff --git a/binutils-2.21/ld/testsuite/ld-pe/longsecn.s b/binutils-2.21/ld/testsuite/ld-pe/longsecn.s new file mode 100755 index 0000000..1fc4da3 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/longsecn.s @@ -0,0 +1,44 @@ + .text + .global _start + .global _mainCRTStartup +_start: +_mainCRTStartup: + .byte 1 + .global data + .data +data: + .byte 2 + + .section .text.very.long.section.name,"rx" +vls: + .byte 3 + + .section .data$1,"wd" + .byte 4 + .section .rodata$1,"rd" + .byte 5 + + .section .data$123,"wd" + .byte 4 + .section .rodata$123,"rd" + .byte 5 + .section .data$123456789,"wd" + .byte 4 + .section .rodata$123456789,"rd" + .byte 5 + + .section .data.very.long.section,"wd" + .byte 6 + .section .rodata.very.long.section,"rd" + .byte 7 + + .section .data.very.long.section$1,"wd" + .byte 6 + .section .rodata.very.long.section$1,"rd" + .byte 7 + .section .data.very.long.section$1234,"wd" + .byte 6 + .section .rodata.very.long.section$1234,"rd" + .byte 7 + + .end diff --git a/binutils-2.21/ld/testsuite/ld-pe/non-c-lang-syms.d b/binutils-2.21/ld/testsuite/ld-pe/non-c-lang-syms.d new file mode 100755 index 0000000..3c7fa93 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/non-c-lang-syms.d @@ -0,0 +1,10 @@ +#... +[0-9A-Fa-f]{6,14}[08]0 B _?test\$equiv\.eq\. +[0-9A-Fa-f]{6,14}[02468aAcCeE]0 B _?test\$equiv\.eq\.100 +[0-9A-Fa-f]{6,14}[0-9A-Fa-f]0 B _?test\$equiv\.eq\.1_ +[0-9A-Fa-f]{6,14}[048cC]0 B _?test\$equiv\.eq\._ +[0-9A-Fa-f]{6,14}[08]0 B _?test_equiv\.eq\. +[0-9A-Fa-f]{6,14}[02468aAcCeE]0 B _?test_equiv\.eq\.100 +[0-9A-Fa-f]{6,14}[0-9A-Fa-f]0 B _?test_equiv\.eq\.1_ +[0-9A-Fa-f]{6,14}[048cC]0 B _?test_equiv\.eq\._ +#... diff --git a/binutils-2.21/ld/testsuite/ld-pe/non-c-lang-syms.s b/binutils-2.21/ld/testsuite/ld-pe/non-c-lang-syms.s new file mode 100755 index 0000000..e849d9e --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/non-c-lang-syms.s @@ -0,0 +1,15 @@ + +main: +_main: + nop + + .comm _test_equiv.eq.1_, 16, 4 + .comm _test_equiv.eq.100, 16, 5 + .comm _test_equiv.eq._, 16, 6 + .comm _test_equiv.eq., 16, 7 + + .comm _test$equiv.eq.1_, 16, 4 + .comm _test$equiv.eq.100, 16, 5 + .comm _test$equiv.eq._, 16, 6 + .comm _test$equiv.eq., 16, 7 + diff --git a/binutils-2.21/ld/testsuite/ld-pe/orphan.d b/binutils-2.21/ld/testsuite/ld-pe/orphan.d new file mode 100644 index 0000000..4047a6a --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/orphan.d @@ -0,0 +1,13 @@ +#source: orphana.s +#source: orphanb.s +#source: orphand.s +#source: orphane.s +#ld: --file-align 1 --section-align 1 +#objdump: -h --wide + +#... + +0 +\.text .* + +1 +\.foo +0+20 .* + +2 +\.foo +0+20 .* + +3 +\.idata .* +#pass diff --git a/binutils-2.21/ld/testsuite/ld-pe/orphan_nu.d b/binutils-2.21/ld/testsuite/ld-pe/orphan_nu.d new file mode 100644 index 0000000..5e88da7 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/orphan_nu.d @@ -0,0 +1,13 @@ +#source: orphana_nu.s +#source: orphanb.s +#source: orphand.s +#source: orphane.s +#ld: --file-align 1 --section-align 1 --no-leading-underscore +#objdump: -h --wide + +#... + +0 +\.text .* + +1 +\.foo +0+20 .* + +2 +\.foo +0+20 .* + +3 +\.idata .* +#pass diff --git a/binutils-2.21/ld/testsuite/ld-pe/orphana.s b/binutils-2.21/ld/testsuite/ld-pe/orphana.s new file mode 100644 index 0000000..6510491 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/orphana.s @@ -0,0 +1,8 @@ + .globl _mainCRTStartup + .globl _start + .text +_mainCRTStartup: +_start: + + .section .foo,"b" + .space 16 diff --git a/binutils-2.21/ld/testsuite/ld-pe/orphana_nu.s b/binutils-2.21/ld/testsuite/ld-pe/orphana_nu.s new file mode 100644 index 0000000..d3c564f --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/orphana_nu.s @@ -0,0 +1,8 @@ + .globl mainCRTStartup + .globl start + .text +mainCRTStartup: +start: + + .section .foo,"b" + .space 16 diff --git a/binutils-2.21/ld/testsuite/ld-pe/orphanb.s b/binutils-2.21/ld/testsuite/ld-pe/orphanb.s new file mode 100644 index 0000000..6f26b94 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/orphanb.s @@ -0,0 +1,2 @@ + .section .foo + .long 1,1,1,1 diff --git a/binutils-2.21/ld/testsuite/ld-pe/orphand.s b/binutils-2.21/ld/testsuite/ld-pe/orphand.s new file mode 100644 index 0000000..9b23cb5 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/orphand.s @@ -0,0 +1,2 @@ + .section .foo,"b" + .space 16 diff --git a/binutils-2.21/ld/testsuite/ld-pe/orphane.s b/binutils-2.21/ld/testsuite/ld-pe/orphane.s new file mode 100644 index 0000000..aff3e84 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/orphane.s @@ -0,0 +1,2 @@ + .section .foo + .long 4,4,4,4 diff --git a/binutils-2.21/ld/testsuite/ld-pe/pe-compile.exp b/binutils-2.21/ld/testsuite/ld-pe/pe-compile.exp new file mode 100755 index 0000000..d912719 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/pe-compile.exp @@ -0,0 +1,143 @@ +# Expect script for complex PE tests that require a C compiler +# in addition to the just-built binutils. +# Copyright 2009 +# Free Software Foundation, Inc. +# +# This file is part of the GNU Binutils. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. +# + +# These tests can only be run on PE/COFF platforms. +if {![is_pecoff_format]} { + return +} + +# No compiler, no test. +if { [which $CC] == 0 } { + untested "PE version scripts" + untested "aligned common tests" + # Add more "untested" directives here when adding more tests below. + return +} + +proc build_basefile1_o {} { + global CC + global CFLAGS + global srcdir + global subdir + + # Compile the object file. + if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/basefile1.s tmpdir/basefile1.o] { + fail "compiling basefile1 object" + } +} + +proc run_basefile_test { testname } { + global LD + global DLLTOOL + global srcdir + global subdir + global verbose + + if ![ld_simple_link "$LD -e start \ + --base-file=tmpdir/$testname.base \ + --export-all-symbols" tmpdir/$testname.dll \ + "tmpdir/basefile1.o"] { + fail "linking DLL" + return + } + + if { $verbose > 2 } then { verbose "output is [file_contents tmpdir/$testname.base]" 3 } + + catch "exec wc -c tmpdir/$testname.base" err + + if ![string match "0 tmpdir/$testname.base" [string trim $err]] then { + send_log "$err\n" + if { $verbose == 2 } then { verbose "$err" 2 } + fail $testname + return + } + + pass "$testname" +} + +proc build_vers_script_dll_o {} { + global CC + global CFLAGS + global srcdir + global subdir + + # Compile the object file. + if ![ld_compile "$CC $CFLAGS -shared" $srcdir/$subdir/vers-script-dll.c tmpdir/vers-script-dll.o] { + fail "compiling shared lib object" + } +} + +proc run_ver_script_test { testname } { + global CC + global srcdir + global subdir + global verbose + + if ![ld_simple_link "$CC -shared \ + -Wl,--version-script,$srcdir/$subdir/$testname.ver \ + -Wl,--output-def,tmpdir/$testname.def" tmpdir/$testname.dll \ + "tmpdir/vers-script-dll.o"] { + fail "linking DLL" + } + + if { $verbose > 2 } then { verbose "output is [file_contents tmpdir/$testname.def]" 3 } + if { [regexp_diff tmpdir/$testname.def $srcdir/$subdir/$testname.d] } then { + fail $testname + if { $verbose == 2 } then { verbose "output is [file_contents tmpdir/$testname.def]" 2 } + return + } + + pass "$testname" +} + + +build_vers_script_dll_o + +run_ver_script_test "vers-script-1" +run_ver_script_test "vers-script-2" +run_ver_script_test "vers-script-3" +run_ver_script_test "vers-script-4" + +if {[istarget i*86-*-cygwin*] + || [istarget i*86-*-pe] + || [istarget i*86-*-mingw*] + || [istarget x86_64-*-mingw*] } { + + build_basefile1_o + run_basefile_test "basefile-secrel" + } else { + untested "PE basefile test" + } + +set align_tests { + {"aligned common 1" "" "" {aligncomm-1.c} + {{nm -C aligncomm.d}} "aligncomm-1.x"} + {"aligned common 2" "" "" {aligncomm-2.c} + {{nm -C aligncomm.d}} "aligncomm-2.x"} + {"aligned common 3" "" "" {aligncomm-3.c} + {{nm -C aligncomm.d}} "aligncomm-3.x"} + {"aligned common 4" "" "" {aligncomm-4.c} + {{nm -C aligncomm.d}} "aligncomm-4.x"} +} + +run_ld_link_tests $align_tests diff --git a/binutils-2.21/ld/testsuite/ld-pe/pe-run.exp b/binutils-2.21/ld/testsuite/ld-pe/pe-run.exp new file mode 100755 index 0000000..709fb19 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/pe-run.exp @@ -0,0 +1,149 @@ +# Expect script for complex PE tests that require a C compiler and the ability +# to run target executables natively, in addition to the just-built binutils. +# Copyright 2006, 2007, 2009 +# Free Software Foundation, Inc. +# +# This file is part of the GNU Binutils. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. +# +# Written by Pedro Alves <pedro_alves@portugalmail.pt> +# + +# Note: +# +# This test checks the "direct linking to a dll" functionality. +# +# The test has 7 stages: +# +# 1. compile and link a test dll with ".dll" extension. +# +# 2. compile and link a test dll with ".sl" (i.e. != ".dll") extension. +# +# 3. compile and link a client application linking directly to the ".dll" dll built in 1. +# This should produce no errors. +# +# 4. compile and link a client application linking directly to the ".sl" dll built in 2. +# This should produce no errors. +# +# 5. compile and link a client application linking directly to a symlink into +# the ".dll" dll built in 1. +# This should produce no errors. +# +# 6. compile and link a client application linking directly to a symlink into +# the ".sl" dll built in 1. +# This should produce no errors. +# +# 7. run the produced executables + +# This test can only be run on PE/COFF platforms. +if {![is_pecoff_format]} { + return +} + +# No compiler, no test. +if { [which $CC] == 0 } { + untested "Direct linking to dll test" + return +} + +set tmpdir tmpdir + +proc test_direct_link_dll {} { + global CC + global CFLAGS + global srcdir + global subdir + global tmpdir + + # Compile the dll. + if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/direct_dll.c $tmpdir/direct_dll.o ] { + fail "compiling shared lib" + } elseif ![ld_simple_link "$CC -shared" $tmpdir/direct_dll.dll "$tmpdir/direct_dll.o" ] { + fail "linking shared lib (.dll)" + } elseif ![ld_simple_link "$CC -shared" $tmpdir/direct_dll.sl "$tmpdir/direct_dll.o" ] { + fail "linking shared lib (.sl)" + } else { + # Compile and link the client program. + if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/direct_client.c $tmpdir/direct_client.o ] { + fail "compiling client" + } else { + # Check linking directly to direct_dll.dll. + set msg "linking client (.dll)" + if [ld_simple_link "$CC -Wl,--enable-auto-import" $tmpdir/direct_client_dll.exe \ + "$tmpdir/direct_client.o $tmpdir/direct_dll.dll" ] { + pass $msg + } else { + fail $msg + } + + # Check linking directly to direct_dll.sl. + set msg "linking client (.sl)" + if [ld_simple_link "$CC -Wl,--enable-auto-import" $tmpdir/direct_client_sl.exe \ + "$tmpdir/direct_client.o $tmpdir/direct_dll.sl" ] { + pass $msg + } else { + fail $msg + } + + # Check dll direct linking through symlink to .dll. + # Create symbolic link. + catch "exec ln -fs direct_dll.dll $tmpdir/libdirect_dll.dll.a" ln_catch + set msg "linking client (symlink -> .dll)" + if [ld_simple_link "$CC -Wl,--enable-auto-import" $tmpdir/direct_client_symlink_dll.exe \ + "$tmpdir/direct_client.o $tmpdir/libdirect_dll.dll.a" ] { + pass $msg + } else { + fail $msg + } + + # Check dll direct linking through symlink to .sl. + # Create symbolic link. + catch "exec ln -fs direct_dll.sl $tmpdir/libdirect_sl.dll.a" ln_catch + set msg "linking client (symlink -> .sl)" + if [ld_simple_link "$CC -Wl,--enable-auto-import" $tmpdir/direct_client_symlink_sl.exe \ + "$tmpdir/direct_client.o $tmpdir/libdirect_sl.dll.a" ] { + pass $msg + } else { + fail $msg + } + } + } +} + +proc directdll_execute {exe msg} { + set expected "" + catch "exec $exe" prog_output + if [string match $expected $prog_output] then { + pass $msg + } else { + verbose $prog_output + fail $msg + } +} + +test_direct_link_dll + +# This is as far as we can go with a cross-compiler +if ![isnative] then { + verbose "Not running natively, so cannot execute binaries" + return +} + +directdll_execute "$tmpdir/direct_client_dll.exe" "running direct linked dll (.dll)" +directdll_execute "$tmpdir/direct_client_sl.exe" "running direct linked dll (.sl)" +directdll_execute "$tmpdir/direct_client_symlink_sl.exe" "running direct linked dll (symlink -> .sl)" +directdll_execute "$tmpdir/direct_client_symlink_dll.exe" "running direct linked dll (symlink -> .dll)" diff --git a/binutils-2.21/ld/testsuite/ld-pe/pe-run2.exp b/binutils-2.21/ld/testsuite/ld-pe/pe-run2.exp new file mode 100644 index 0000000..6cc066e --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/pe-run2.exp @@ -0,0 +1,151 @@ +# Expect script for complex PE tests that require a C compiler and the ability +# to run target executables natively, in addition to the just-built binutils. +# Copyright 2006, 2007, 2009 +# Free Software Foundation, Inc. +# +# This file is part of the GNU Binutils. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. +# +# Based on the script pe-run.exp written by Pedro Alves. +# Written by Kai Tietz <kai.tietz@onevision.com> +# + +# Note: +# +# This test checks the "direct linking to a dll" functionality with stdcall +# and fastcall fixup. +# +# The test has 7 stages: +# +# 1. compile and link a test dll with ".dll" extension. +# +# 2. compile and link a test dll with ".sl" (i.e. != ".dll") extension. +# +# 3. compile and link a client application linking directly to the ".dll" dll built in 1. +# This should produce no errors. +# +# 4. compile and link a client application linking directly to the ".sl" dll built in 2. +# This should produce no errors. +# +# 5. compile and link a client application linking directly to a symlink into +# the ".dll" dll built in 1. +# This should produce no errors. +# +# 6. compile and link a client application linking directly to a symlink into +# the ".sl" dll built in 1. +# This should produce no errors. +# +# 7. run the produced executables + +# This test can only be run on PE/COFF platforms. +if {![is_pecoff_format]} { + return +} + +# No compiler, no test. +if { [which $CC] == 0 } { + untested "Direct linking to dll fastcall/stdcall test" + return +} + +set tmpdir tmpdir + +proc test_direct2_link_dll {} { + global CC + global CFLAGS + global srcdir + global subdir + global tmpdir + + # Compile the dll. + if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/direct2_dll.c $tmpdir/direct2_dll.o ] { + fail "compiling shared lib fastcall/stdcall" + } elseif ![ld_simple_link "$CC -shared -Wl,--enable-stdcall-fixup -Wl,--kill-at " $tmpdir/direct2_dll.dll "$tmpdir/direct2_dll.o" ] { + fail "linking shared lib (.dll) fastcall/stdcall" + } elseif ![ld_simple_link "$CC -shared -Wl,--enable-stdcall-fixup -Wl,--kill-at " $tmpdir/direct2_dll.sl "$tmpdir/direct2_dll.o" ] { + fail "linking shared lib (.sl) fastcall/stdcall" + } else { + # Compile and link the client program. + if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/direct2_client.c $tmpdir/direct2_client.o ] { + fail "compiling client fastcall/stdcall" + } else { + # Check linking directly to direct2_dll.dll. + set msg "linking client (.dll) fastcall/stdcall" + if [ld_simple_link "$CC -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_dll.exe \ + "$tmpdir/direct2_client.o $tmpdir/direct2_dll.dll" ] { + pass $msg + } else { + fail $msg + } + + # Check linking directly to direct2_dll.sl. + set msg "linking client (.sl) fastcall/stdcall" + if [ld_simple_link "$CC -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_sl.exe \ + "$tmpdir/direct2_client.o $tmpdir/direct2_dll.sl" ] { + pass $msg + } else { + fail $msg + } + + # Check dll direct linking through symlink to .dll. + # Create symbolic link. + catch "exec ln -fs direct2_dll.dll $tmpdir/libdirect2_dll.dll.a" ln_catch + set msg "linking client (symlink -> .dll) fastcall/stdcall" + if [ld_simple_link "$CC -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_symlink_dll.exe \ + "$tmpdir/direct2_client.o $tmpdir/libdirect2_dll.dll.a" ] { + pass $msg + } else { + fail $msg + } + + # Check dll direct linking through symlink to .sl. + # Create symbolic link. + catch "exec ln -fs direct2_dll.sl $tmpdir/libdirect2_sl.dll.a" ln_catch + set msg "linking client (symlink -> .sl) fastcall/stdcall" + if [ld_simple_link "$CC -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_symlink_sl.exe \ + "$tmpdir/direct2_client.o $tmpdir/libdirect2_sl.dll.a" ] { + pass $msg + } else { + fail $msg + } + } + } +} + +proc directdll_execute {exe msg} { + set expected "" + catch "exec $exe" prog_output + if [string match $expected $prog_output] then { + pass $msg + } else { + verbose $prog_output + fail $msg + } +} + +test_direct2_link_dll + +# This is as far as we can go with a cross-compiler +if ![isnative] then { + verbose "Not running natively, so cannot execute binaries" + return +} + +directdll_execute "$tmpdir/direct2_client_dll.exe" "running direct linked dll (.dll) fastcall/stdcall" +directdll_execute "$tmpdir/direct2_client_sl.exe" "running direct linked dll (.sl) fastcall/stdcall" +directdll_execute "$tmpdir/direct2_client_symlink_sl.exe" "running direct linked dll (symlink -> .sl) fastcall/stdcall" +directdll_execute "$tmpdir/direct2_client_symlink_dll.exe" "running direct linked dll (symlink -> .dll) fastcall/stdcall" diff --git a/binutils-2.21/ld/testsuite/ld-pe/pe.exp b/binutils-2.21/ld/testsuite/ld-pe/pe.exp new file mode 100644 index 0000000..dd4b9f7 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/pe.exp @@ -0,0 +1,79 @@ +# Expect script for simple PE tests that require the just-built binutils only. +# Copyright 2004, 2005, 2006, 2007, 2009 +# Free Software Foundation, Inc. +# +# This file is part of the GNU Binutils. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. +# + +# These tests can only be run on PE/COFF platforms. +if {![is_pecoff_format]} { + return +} + +# This test can only be run on PE/COFF platforms that support .secrel32. +if {[istarget i*86-*-cygwin*] + || [istarget i*86-*-pe] + || [istarget i*86-*-mingw*] + || [istarget x86_64-*-mingw*] + || [istarget arm-wince-pe] } { + + if {[istarget x86_64-*-mingw*] } { + set pe_tests { + {".secrel32" "" "" {secrel1.s secrel2.s} + {{objdump -s secrel_64.d}} "secrel.x"} + {"Empty export table" "" "" "exports.s" + {{objdump -p exports64.d}} "exports.dll"} + } + } elseif {[istarget i*86-*-cygwin*] } { + set pe_tests { + {".secrel32" "--disable-auto-import" "" {secrel1.s secrel2.s} + {{objdump -s secrel.d}} "secrel.x"} + {"Empty export table" "" "" "exports.s" + {{objdump -p exports.d}} "exports.dll"} + } + } else { + set pe_tests { + {".secrel32" "" "" {secrel1.s secrel2.s} + {{objdump -s secrel.d}} "secrel.x"} + {"Empty export table" "" "" "exports.s" + {{objdump -p exports.d}} "exports.dll"} + } + } + + run_ld_link_tests $pe_tests +} + +run_dump_test "image_size" +run_dump_test "export_dynamic_warning" + +run_dump_test "longsecn" +run_dump_test "longsecn-1" +run_dump_test "longsecn-2" +run_dump_test "longsecn-3" +run_dump_test "longsecn-4" +run_dump_test "longsecn-5" + +run_dump_test "orphan" +run_dump_test "orphan_nu" + +set foreign_sym_test { + {"non-C aligned common" "" "" {non-c-lang-syms.s} + {{nm -C non-c-lang-syms.d}} "non-c-lang-syms.x"} +} + +run_ld_link_tests $foreign_sym_test diff --git a/binutils-2.21/ld/testsuite/ld-pe/secrel.d b/binutils-2.21/ld/testsuite/ld-pe/secrel.d new file mode 100644 index 0000000..b924f54 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/secrel.d @@ -0,0 +1,27 @@ +
+tmpdir/secrel\.x: +file format pei-.*
+
+Contents of section \.text:
+ .*1000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c >>>><<<<>>>>><<<
+ .*1010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c >>>>>><<>>>>>>><
+ .*1020 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c >>>><<<<>>>>><<<
+ .*1030 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c >>>>>><<>>>>>>><
+ .*1040 ........ ........ ........ ........ ................
+Contents of section \.data:
+ .*2000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c >>>><<<<>>>>><<<
+ .*2010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c >>>>>><<>>>>>>><
+ .*2020 3e3e3e3e 04000000 110d0000 00111600 >>>>............
+ .*2030 0000111f 00000011 3c3c3c3c 3c3c3c3c ........<<<<<<<<
+ .*2040 3e3e3e3e 04000000 110d0000 00111600 >>>>............
+ .*2050 0000111f 00000011 3c3c3c3c 3c3c3c3c ........<<<<<<<<
+ .*2060 3e3e3e3e 04000000 110d0000 00111600 >>>>............
+ .*2070 0000111f 00000011 3c3c3c3c 3c3c3c3c ........<<<<<<<<
+ .*2080 3e3e3e3e 24000000 112d0000 00113600 >>>>\$....-....6.
+ .*2090 0000113f 00000011 3c3c3c3c 3c3c3c3c ...\?....<<<<<<<<
+Contents of section \.rdata:
+ .*3000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c >>>><<<<>>>>><<<
+ .*3010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c >>>>>><<>>>>>>><
+ .*3020 3e3e3e3e 00000000 00000000 00000000 >>>>............
+Contents of section \.idata:
+ .*4000 00000000 00000000 00000000 00000000 ................
+ .*4010 00000000 ....
diff --git a/binutils-2.21/ld/testsuite/ld-pe/secrel1.s b/binutils-2.21/ld/testsuite/ld-pe/secrel1.s new file mode 100644 index 0000000..c162990 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/secrel1.s @@ -0,0 +1,79 @@ +.text
+
+ .ascii ">>>>"
+pre04: .ascii "<<<<"
+ .ascii ">>>>>"
+pre0d: .ascii "<<<"
+ .ascii ">>>>>>"
+pre16: .ascii "<<"
+ .ascii ">>>>>>>"
+pre1f: .ascii "<"
+
+.data
+
+ .ascii ">>>>"
+sam04: .ascii "<<<<"
+ .ascii ">>>>>"
+sam0d: .ascii "<<<"
+ .ascii ">>>>>>"
+sam16: .ascii "<<"
+ .ascii ">>>>>>>"
+sam1f: .ascii "<"
+
+ .ascii ">>>>"
+ .secrel32 pre04
+ .byte 0x11
+ .secrel32 pre0d
+ .byte 0x11
+ .secrel32 pre16
+ .byte 0x11
+ .secrel32 pre1f
+ .byte 0x11
+ .ascii "<<<<<<<<"
+
+ .ascii ">>>>"
+ .secrel32 sam04
+ .byte 0x11
+ .secrel32 sam0d
+ .byte 0x11
+ .secrel32 sam16
+ .byte 0x11
+ .secrel32 sam1f
+ .byte 0x11
+ .ascii "<<<<<<<<"
+
+ .ascii ">>>>"
+ .secrel32 nex04
+ .byte 0x11
+ .secrel32 nex0d
+ .byte 0x11
+ .secrel32 nex16
+ .byte 0x11
+ .secrel32 nex1f
+ .byte 0x11
+ .ascii "<<<<<<<<"
+
+ .ascii ">>>>"
+ .secrel32 ext24
+ .byte 0x11
+ .secrel32 ext2d
+ .byte 0x11
+ .secrel32 ext36
+ .byte 0x11
+ .secrel32 ext3f
+ .byte 0x11
+ .ascii "<<<<<<<<"
+
+.section .rdata
+
+ .ascii ">>>>"
+nex04: .ascii "<<<<"
+ .ascii ">>>>>"
+nex0d: .ascii "<<<"
+ .ascii ">>>>>>"
+nex16: .ascii "<<"
+ .ascii ">>>>>>>"
+nex1f: .ascii "<"
+ .ascii ">>>>"
+
+ .p2align 4,0
diff --git a/binutils-2.21/ld/testsuite/ld-pe/secrel2.s b/binutils-2.21/ld/testsuite/ld-pe/secrel2.s new file mode 100644 index 0000000..a1f871f --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/secrel2.s @@ -0,0 +1,14 @@ +.text
+
+ .ascii ">>>>"
+.global ext24
+ext24: .ascii "<<<<"
+ .ascii ">>>>>"
+.global ext2d
+ext2d: .ascii "<<<"
+ .ascii ">>>>>>"
+.global ext36
+ext36: .ascii "<<"
+ .ascii ">>>>>>>"
+.global ext3f
+ext3f: .ascii "<"
diff --git a/binutils-2.21/ld/testsuite/ld-pe/secrel_64.d b/binutils-2.21/ld/testsuite/ld-pe/secrel_64.d new file mode 100644 index 0000000..aba1bf1 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/secrel_64.d @@ -0,0 +1,28 @@ +
+tmpdir/secrel\.x: +file format pei-.*
+
+Contents of section \.text:
+ .*1000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c >>>><<<<>>>>><<<
+ .*1010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c >>>>>><<>>>>>>><
+ .*1020 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c >>>><<<<>>>>><<<
+ .*1030 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c >>>>>><<>>>>>>><
+ .*1040 ffffffff ffffffff 00000000 00000000 ................
+ .*1050 ffffffff ffffffff 00000000 00000000 ................
+Contents of section \.data:
+ .*2000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c >>>><<<<>>>>><<<
+ .*2010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c >>>>>><<>>>>>>><
+ .*2020 3e3e3e3e 04000000 110d0000 00111600 >>>>............
+ .*2030 0000111f 00000011 3c3c3c3c 3c3c3c3c ........<<<<<<<<
+ .*2040 3e3e3e3e 04000000 110d0000 00111600 >>>>............
+ .*2050 0000111f 00000011 3c3c3c3c 3c3c3c3c ........<<<<<<<<
+ .*2060 3e3e3e3e 04000000 110d0000 00111600 >>>>............
+ .*2070 0000111f 00000011 3c3c3c3c 3c3c3c3c ........<<<<<<<<
+ .*2080 3e3e3e3e 24000000 112d0000 00113600 >>>>\$....-....6.
+ .*2090 0000113f 00000011 3c3c3c3c 3c3c3c3c ...\?....<<<<<<<<
+Contents of section \.rdata:
+ .*3000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c >>>><<<<>>>>><<<
+ .*3010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c >>>>>><<>>>>>>><
+ .*3020 3e3e3e3e 00000000 00000000 00000000 >>>>............
+Contents of section \.idata:
+ .*4000 00000000 00000000 00000000 00000000 ................
+ .*4010 00000000 ....
diff --git a/binutils-2.21/ld/testsuite/ld-pe/vers-script-1.d b/binutils-2.21/ld/testsuite/ld-pe/vers-script-1.d new file mode 100644 index 0000000..d494cfc --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/vers-script-1.d @@ -0,0 +1,153 @@ +EXPORTS + A @1 + B @2 + C @3 + D @4 + E @5 + GC_abort @6 + GC_add_ext_descriptor @7 + GC_add_leaked @8 + GC_add_map_entry @9 + GC_used_heap_size_after_full @10 + GC_version @11 + GC_with_callee_saves_pushed @12 + GC_words_allocd_at_reset @13 + GC_world_stopped @14 + GC_write @15 + JIS0208_to_Unicode @16 + JIS0212_to_Unicode @17 + JvConvertArgv @18 + JvRunMain @19 + JvRunMainName @20 + Unicode_to_JIS @21 + _Jv_AllocBytes @22 + _Jv_AllocObject @23 + _Jv_AllocObjectNoFinalizer @24 + _Jv_JNIFunctions @25 + _Jv_JNI_InvokeFunctions @26 + _Jv_JNI_PopSystemFrame @27 + _Jv_JVMPI_Notify_OBJECT_ALLOC @28 + _Jv_JVMPI_Notify_THREAD_END @29 + _Jv_JVMPI_Notify_THREAD_START @30 + _Jv_JVMTI_Interface @31 + _Jv_LookupInterfaceMethod @32 + _Jv_LookupInterfaceMethodIdx @33 + _Jv_LookupJNIMethod @34 + _Jv_Malloc @35 + _Jv_Throw @36 + _Jv_ThrowAbstractMethodError @37 + _Jv_UnwrapJNIweakReference @38 + _Jv__mcmp @39 + _Jv__mdiff @40 + _Jv__mprec_bigtens @41 + _Jv__mprec_tinytens @42 + _Jv_argc @43 + _Jv_argv @44 + _Jv_b2d @45 + _Jv_booleanClass @46 + _Jv_byteClass @47 + _Jv_charClass @48 + _Jv_d2b @49 + _Jv_ulp @50 + _Jv_voidClass @51 + _Z10_Jv_InitGCv @52 + _Z10_Jv_equalnP13_Jv_Utf8ConstPN4java4lang6StringEi @53 + _Z11_Jv_SetArgsiPPKc @54 + _Z11_Jv_ZMallocPvjj @55 + _Z11trie_lookupPtt @56 + _Z12_Jv_CondWaitP23_Jv_ConditionVariable_tP11_Jv_Mutex_txi @57 + _Z12_Jv_init_cifP13_Jv_Utf8ConstibP7ffi_cifPP9_ffi_typeS5_ @58 + _Z12_Jv_is_proxyPv @59 + _Z12shsTransformP8SHS_INFO @60 + _Z13_Jv_DisableGCv @61 + _Z15_Jv_create_coreP14_Jv_core_chainPN4java4lang6StringE @62 + _Z16_Jv_BlockSigchldv @63 + _Z16_Jv_BuildGCDescrPN4java4lang5ClassE @64 + _Z16_Jv_GCFreeMemoryv @65 + _Z16_Jv_SetStackSizePKc @66 + _Z16_Jv_VerifyMethodP16_Jv_InterpMethod @67 + _Z17JvNewStringLatin1PKc @68 + _Z24_Jv_isPrimitiveOrDerivedPK13_Jv_Utf8Const @69 + _Z26_Jv_FindSymbolInExecutablePKc @70 + _Z26_Jv_GCInitializeFinalizersPFvvE @71 + _Z37_Jv_FindClassFromSignatureNoExceptionPcPN4java4lang11ClassLoaderEPS_ @72 + _Z39_Jv_ThrowNoClassDefFoundErrorTrampolineP7ffi_cifPvPS1_S1_ @73 + _Z7in_hashPN4java4lang6ObjectE @74 + _Z7shsInitP8SHS_INFO @75 + _Z8shsFinalP8SHS_INFO @76 + _Z9_Jv_AbortPKcS0_iS0_ @77 + _Z9_Jv_RunGCv @78 + _Z9_Jv_ZFreePvS_ @79 + _Z9_Jv_equalP13_Jv_Utf8ConstPN4java4lang6StringEi @80 + _Z9shsUpdateP8SHS_INFOPhi @81 + _ZGr30_java_Sutil_Sweeks__properties @82 + _ZGr32_java_Sutil_Siso4217__properties @83 + _ZGr48_gnu_Sjavax_Sprint_SPrinterDialog_de__properties @84 + _ZGr49_gnu_Sjava_Slocale_SLocaleInformation__properties @85 + _ZGr51_gnu_Sjava_Sutil_Sregex_SMessagesBundle__properties @86 + _ZTVN5javax8security4auth4x50021X500PrivateCredentialE @87 + _ZTVN5javax8security4auth5login12LoginContextE @88 + _ZTVN5javax8security4auth5login13ConfigurationE @89 + _ZTVN5javax8security4auth5login14LoginExceptionE @90 + _ZTVN5javax8security4sasl19RealmChoiceCallbackE @91 + _ZTVN5javax8security4sasl23AuthenticationExceptionE @92 + _ZTVN5javax8security4sasl4SaslE @93 + __gcj_personality_v0 @94 + __ieee754_acos @95 + __ieee754_asin @96 + __ieee754_atan2 @97 + __kernel_cos @98 + __kernel_rem_pio2 @99 + __kernel_sin @100 + __kernel_tan @101 + _dist_code @102 + _length_code @103 + _mprec_log10 @104 + _tr_align @105 + _tr_flush_block @106 + _tr_init @107 + _tr_stored_block @108 + _tr_tally @109 + adler32 @110 + adler32_combine @111 + crc32 @112 + crc32_combine @113 + deflate @114 + deflateBound @115 + deflateCopy @116 + ffi_call_STDCALL @117 + ffi_call_SYSV @118 + ffi_closure_SYSV @119 + ffi_closure_SYSV_inner @120 + ffi_closure_alloc @121 + ffi_closure_free @122 + free_list_index_of @123 + get_crc_table @124 + gzclearerr @125 + gzclose @126 + gzungetc @127 + gzwrite @128 + h0 @129 + h1 @130 + h2 @131 + h3 @132 + h4 @133 + inflate @134 + inflateBack @135 + inflateBackEnd @136 + inflate_fast @137 + inflate_table @138 + lt_dladderror @139 + lt_dladdsearchdir @140 + lt_dlsetsearchpath @141 + lt_dlsym @142 + lt_preloaded_symbols @143 + print @144 + thread_table @145 + uncompress @146 + zError @147 + z_errmsg @148 + zcalloc @149 + zcfree @150 + zlibCompileFlags @151 + zlibVersion @152 diff --git a/binutils-2.21/ld/testsuite/ld-pe/vers-script-1.ver b/binutils-2.21/ld/testsuite/ld-pe/vers-script-1.ver new file mode 100755 index 0000000..07f54aa --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/vers-script-1.ver @@ -0,0 +1,5 @@ +# Anonymous GNU ld version script to export everything. + +{ + global: *; +}; diff --git a/binutils-2.21/ld/testsuite/ld-pe/vers-script-2.d b/binutils-2.21/ld/testsuite/ld-pe/vers-script-2.d new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/vers-script-2.d diff --git a/binutils-2.21/ld/testsuite/ld-pe/vers-script-2.ver b/binutils-2.21/ld/testsuite/ld-pe/vers-script-2.ver new file mode 100755 index 0000000..6e7cac6 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/vers-script-2.ver @@ -0,0 +1,5 @@ +# Anonymous GNU ld version script to export nothing. + +{ + local: *; +}; diff --git a/binutils-2.21/ld/testsuite/ld-pe/vers-script-3.d b/binutils-2.21/ld/testsuite/ld-pe/vers-script-3.d new file mode 100644 index 0000000..0feafe0 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/vers-script-3.d @@ -0,0 +1,77 @@ +EXPORTS + JvConvertArgv @1 + JvRunMain @2 + JvRunMainName @3 + _Jv_AllocBytes @4 + _Jv_AllocObject @5 + _Jv_AllocObjectNoFinalizer @6 + _Jv_JNIFunctions @7 + _Jv_JNI_InvokeFunctions @8 + _Jv_JNI_PopSystemFrame @9 + _Jv_JVMPI_Notify_OBJECT_ALLOC @10 + _Jv_JVMPI_Notify_THREAD_END @11 + _Jv_JVMPI_Notify_THREAD_START @12 + _Jv_JVMTI_Interface @13 + _Jv_LookupInterfaceMethod @14 + _Jv_LookupInterfaceMethodIdx @15 + _Jv_LookupJNIMethod @16 + _Jv_Malloc @17 + _Jv_Throw @18 + _Jv_ThrowAbstractMethodError @19 + _Jv_UnwrapJNIweakReference @20 + _Jv__mcmp @21 + _Jv__mdiff @22 + _Jv__mprec_bigtens @23 + _Jv__mprec_tinytens @24 + _Jv_argc @25 + _Jv_argv @26 + _Jv_b2d @27 + _Jv_booleanClass @28 + _Jv_byteClass @29 + _Jv_charClass @30 + _Jv_d2b @31 + _Jv_ulp @32 + _Jv_voidClass @33 + _Z10_Jv_InitGCv @34 + _Z10_Jv_equalnP13_Jv_Utf8ConstPN4java4lang6StringEi @35 + _Z11_Jv_SetArgsiPPKc @36 + _Z11_Jv_ZMallocPvjj @37 + _Z11trie_lookupPtt @38 + _Z12_Jv_CondWaitP23_Jv_ConditionVariable_tP11_Jv_Mutex_txi @39 + _Z12_Jv_init_cifP13_Jv_Utf8ConstibP7ffi_cifPP9_ffi_typeS5_ @40 + _Z12_Jv_is_proxyPv @41 + _Z12shsTransformP8SHS_INFO @42 + _Z13_Jv_DisableGCv @43 + _Z15_Jv_create_coreP14_Jv_core_chainPN4java4lang6StringE @44 + _Z16_Jv_BlockSigchldv @45 + _Z16_Jv_BuildGCDescrPN4java4lang5ClassE @46 + _Z16_Jv_GCFreeMemoryv @47 + _Z16_Jv_SetStackSizePKc @48 + _Z16_Jv_VerifyMethodP16_Jv_InterpMethod @49 + _Z17JvNewStringLatin1PKc @50 + _Z24_Jv_isPrimitiveOrDerivedPK13_Jv_Utf8Const @51 + _Z26_Jv_FindSymbolInExecutablePKc @52 + _Z26_Jv_GCInitializeFinalizersPFvvE @53 + _Z37_Jv_FindClassFromSignatureNoExceptionPcPN4java4lang11ClassLoaderEPS_ @54 + _Z39_Jv_ThrowNoClassDefFoundErrorTrampolineP7ffi_cifPvPS1_S1_ @55 + _Z7in_hashPN4java4lang6ObjectE @56 + _Z7shsInitP8SHS_INFO @57 + _Z8shsFinalP8SHS_INFO @58 + _Z9_Jv_AbortPKcS0_iS0_ @59 + _Z9_Jv_RunGCv @60 + _Z9_Jv_ZFreePvS_ @61 + _Z9_Jv_equalP13_Jv_Utf8ConstPN4java4lang6StringEi @62 + _Z9shsUpdateP8SHS_INFOPhi @63 + _ZGr30_java_Sutil_Sweeks__properties @64 + _ZGr32_java_Sutil_Siso4217__properties @65 + _ZGr48_gnu_Sjavax_Sprint_SPrinterDialog_de__properties @66 + _ZGr49_gnu_Sjava_Slocale_SLocaleInformation__properties @67 + _ZGr51_gnu_Sjava_Sutil_Sregex_SMessagesBundle__properties @68 + _ZTVN5javax8security4auth4x50021X500PrivateCredentialE @69 + _ZTVN5javax8security4auth5login12LoginContextE @70 + _ZTVN5javax8security4auth5login13ConfigurationE @71 + _ZTVN5javax8security4auth5login14LoginExceptionE @72 + _ZTVN5javax8security4sasl19RealmChoiceCallbackE @73 + _ZTVN5javax8security4sasl23AuthenticationExceptionE @74 + _ZTVN5javax8security4sasl4SaslE @75 + __gcj_personality_v0 @76 diff --git a/binutils-2.21/ld/testsuite/ld-pe/vers-script-3.ver b/binutils-2.21/ld/testsuite/ld-pe/vers-script-3.ver new file mode 100755 index 0000000..d2d189b --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/vers-script-3.ver @@ -0,0 +1,7 @@ +# Anonymous GNU ld version script to hide boehm-gc, libffi and fdlibm +# symbols in libgcj.so. + +{ + global: Jv*; _Jv_*; __gcj_personality_v0; __gcj_personality_sj0; _Z*; + local: *; +}; diff --git a/binutils-2.21/ld/testsuite/ld-pe/vers-script-4.d b/binutils-2.21/ld/testsuite/ld-pe/vers-script-4.d new file mode 100644 index 0000000..0feafe0 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/vers-script-4.d @@ -0,0 +1,77 @@ +EXPORTS + JvConvertArgv @1 + JvRunMain @2 + JvRunMainName @3 + _Jv_AllocBytes @4 + _Jv_AllocObject @5 + _Jv_AllocObjectNoFinalizer @6 + _Jv_JNIFunctions @7 + _Jv_JNI_InvokeFunctions @8 + _Jv_JNI_PopSystemFrame @9 + _Jv_JVMPI_Notify_OBJECT_ALLOC @10 + _Jv_JVMPI_Notify_THREAD_END @11 + _Jv_JVMPI_Notify_THREAD_START @12 + _Jv_JVMTI_Interface @13 + _Jv_LookupInterfaceMethod @14 + _Jv_LookupInterfaceMethodIdx @15 + _Jv_LookupJNIMethod @16 + _Jv_Malloc @17 + _Jv_Throw @18 + _Jv_ThrowAbstractMethodError @19 + _Jv_UnwrapJNIweakReference @20 + _Jv__mcmp @21 + _Jv__mdiff @22 + _Jv__mprec_bigtens @23 + _Jv__mprec_tinytens @24 + _Jv_argc @25 + _Jv_argv @26 + _Jv_b2d @27 + _Jv_booleanClass @28 + _Jv_byteClass @29 + _Jv_charClass @30 + _Jv_d2b @31 + _Jv_ulp @32 + _Jv_voidClass @33 + _Z10_Jv_InitGCv @34 + _Z10_Jv_equalnP13_Jv_Utf8ConstPN4java4lang6StringEi @35 + _Z11_Jv_SetArgsiPPKc @36 + _Z11_Jv_ZMallocPvjj @37 + _Z11trie_lookupPtt @38 + _Z12_Jv_CondWaitP23_Jv_ConditionVariable_tP11_Jv_Mutex_txi @39 + _Z12_Jv_init_cifP13_Jv_Utf8ConstibP7ffi_cifPP9_ffi_typeS5_ @40 + _Z12_Jv_is_proxyPv @41 + _Z12shsTransformP8SHS_INFO @42 + _Z13_Jv_DisableGCv @43 + _Z15_Jv_create_coreP14_Jv_core_chainPN4java4lang6StringE @44 + _Z16_Jv_BlockSigchldv @45 + _Z16_Jv_BuildGCDescrPN4java4lang5ClassE @46 + _Z16_Jv_GCFreeMemoryv @47 + _Z16_Jv_SetStackSizePKc @48 + _Z16_Jv_VerifyMethodP16_Jv_InterpMethod @49 + _Z17JvNewStringLatin1PKc @50 + _Z24_Jv_isPrimitiveOrDerivedPK13_Jv_Utf8Const @51 + _Z26_Jv_FindSymbolInExecutablePKc @52 + _Z26_Jv_GCInitializeFinalizersPFvvE @53 + _Z37_Jv_FindClassFromSignatureNoExceptionPcPN4java4lang11ClassLoaderEPS_ @54 + _Z39_Jv_ThrowNoClassDefFoundErrorTrampolineP7ffi_cifPvPS1_S1_ @55 + _Z7in_hashPN4java4lang6ObjectE @56 + _Z7shsInitP8SHS_INFO @57 + _Z8shsFinalP8SHS_INFO @58 + _Z9_Jv_AbortPKcS0_iS0_ @59 + _Z9_Jv_RunGCv @60 + _Z9_Jv_ZFreePvS_ @61 + _Z9_Jv_equalP13_Jv_Utf8ConstPN4java4lang6StringEi @62 + _Z9shsUpdateP8SHS_INFOPhi @63 + _ZGr30_java_Sutil_Sweeks__properties @64 + _ZGr32_java_Sutil_Siso4217__properties @65 + _ZGr48_gnu_Sjavax_Sprint_SPrinterDialog_de__properties @66 + _ZGr49_gnu_Sjava_Slocale_SLocaleInformation__properties @67 + _ZGr51_gnu_Sjava_Sutil_Sregex_SMessagesBundle__properties @68 + _ZTVN5javax8security4auth4x50021X500PrivateCredentialE @69 + _ZTVN5javax8security4auth5login12LoginContextE @70 + _ZTVN5javax8security4auth5login13ConfigurationE @71 + _ZTVN5javax8security4auth5login14LoginExceptionE @72 + _ZTVN5javax8security4sasl19RealmChoiceCallbackE @73 + _ZTVN5javax8security4sasl23AuthenticationExceptionE @74 + _ZTVN5javax8security4sasl4SaslE @75 + __gcj_personality_v0 @76 diff --git a/binutils-2.21/ld/testsuite/ld-pe/vers-script-4.ver b/binutils-2.21/ld/testsuite/ld-pe/vers-script-4.ver new file mode 100755 index 0000000..f38abf1 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/vers-script-4.ver @@ -0,0 +1,10 @@ +# GNU ld version script to hide boehm-gc, libffi and fdlibm +# symbols in libgcj.so. + +TEST_1_0 { + local: *; +}; + +TEST_1_1 { + global: Jv*; _Jv_*; __gcj_personality_v0; __gcj_personality_sj0; _Z*; +};
\ No newline at end of file diff --git a/binutils-2.21/ld/testsuite/ld-pe/vers-script-dll.c b/binutils-2.21/ld/testsuite/ld-pe/vers-script-dll.c new file mode 100755 index 0000000..547ddb5 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-pe/vers-script-dll.c @@ -0,0 +1,156 @@ + +#define FUNC(X_) extern void X_ (void); void X_ (void) { }; + +FUNC(A) +FUNC(B) +FUNC(C) +FUNC(D) +FUNC(E) +FUNC(GC_abort) +FUNC(GC_add_ext_descriptor) +FUNC(GC_add_leaked) +FUNC(GC_add_map_entry) +FUNC(GC_used_heap_size_after_full) +FUNC(GC_version) +FUNC(GC_with_callee_saves_pushed) +FUNC(GC_words_allocd_at_reset) +FUNC(GC_world_stopped) +FUNC(GC_write) +FUNC(JIS0208_to_Unicode) +FUNC(JIS0212_to_Unicode) +FUNC(JvConvertArgv) +FUNC(JvRunMain) +FUNC(JvRunMainName) +FUNC(Unicode_to_JIS) +FUNC(_Jv_AllocBytes) +FUNC(_Jv_AllocObject) +FUNC(_Jv_AllocObjectNoFinalizer) +FUNC(_ZTVN5javax8security4sasl23AuthenticationExceptionE) +FUNC(_ZTVN5javax8security4sasl4SaslE) +FUNC(__gcj_personality_v0) +FUNC(__ieee754_acos) +FUNC(__ieee754_asin) +FUNC(__ieee754_atan2) +FUNC(__kernel_cos) +FUNC(__kernel_rem_pio2) +FUNC(__kernel_sin) +FUNC(__kernel_tan) +FUNC(_dist_code) +FUNC(_length_code) +FUNC(_mprec_log10) +FUNC(_tr_align) +FUNC(_tr_flush_block) +FUNC(_tr_init) +FUNC(_tr_stored_block) +FUNC(_tr_tally) +FUNC(adler32) +FUNC(adler32_combine) +FUNC(crc32) +FUNC(crc32_combine) +FUNC(deflate) +FUNC(deflateBound) +FUNC(deflateCopy) +FUNC(ffi_call_STDCALL) +FUNC(ffi_call_SYSV) +FUNC(ffi_closure_SYSV) +FUNC(ffi_closure_SYSV_inner) +FUNC(ffi_closure_alloc) +FUNC(ffi_closure_free) +FUNC(free_list_index_of) +FUNC(get_crc_table) +FUNC(gzclearerr) +FUNC(gzclose) +FUNC(gzungetc) +FUNC(gzwrite) +FUNC(h0) +FUNC(h1) +FUNC(h2) +FUNC(h3) +FUNC(h4) +FUNC(inflate) +FUNC(inflateBack) +FUNC(inflateBackEnd) +FUNC(inflate_fast) +FUNC(inflate_table) +FUNC(lt_dladderror) +FUNC(lt_dladdsearchdir) +FUNC(lt_dlsetsearchpath) +FUNC(lt_dlsym) +FUNC(lt_preloaded_symbols) +FUNC(print) +FUNC(thread_table) +FUNC(uncompress) +FUNC(zError) +FUNC(z_errmsg) +FUNC(zcalloc) +FUNC(zcfree) +FUNC(zlibCompileFlags) +FUNC(zlibVersion) +FUNC(_Jv_JNIFunctions) +FUNC(_Jv_JNI_InvokeFunctions) +FUNC(_Jv_JNI_PopSystemFrame) +FUNC(_Jv_JVMPI_Notify_OBJECT_ALLOC) +FUNC(_Jv_JVMPI_Notify_THREAD_END) +FUNC(_Jv_JVMPI_Notify_THREAD_START) +FUNC(_Jv_JVMTI_Interface) +FUNC(_Jv_LookupInterfaceMethod) +FUNC(_Jv_LookupInterfaceMethodIdx) +FUNC(_Jv_LookupJNIMethod) +FUNC(_Jv_Malloc) +FUNC(_Jv_Throw) +FUNC(_Jv_ThrowAbstractMethodError) +FUNC(_Jv_UnwrapJNIweakReference) +FUNC(_Jv__mcmp) +FUNC(_Jv__mdiff) +FUNC(_Jv__mprec_bigtens) +FUNC(_Jv__mprec_tinytens) +FUNC(_Jv_argc) +FUNC(_Jv_argv) +FUNC(_Jv_b2d) +FUNC(_Jv_booleanClass) +FUNC(_Jv_byteClass) +FUNC(_Jv_charClass) +FUNC(_Jv_d2b) +FUNC(_Jv_ulp) +FUNC(_Jv_voidClass) +FUNC(_Z10_Jv_InitGCv) +FUNC(_Z10_Jv_equalnP13_Jv_Utf8ConstPN4java4lang6StringEi) +FUNC(_Z11_Jv_SetArgsiPPKc) +FUNC(_Z11_Jv_ZMallocPvjj) +FUNC(_Z11trie_lookupPtt) +FUNC(_Z12_Jv_CondWaitP23_Jv_ConditionVariable_tP11_Jv_Mutex_txi) +FUNC(_Z12_Jv_init_cifP13_Jv_Utf8ConstibP7ffi_cifPP9_ffi_typeS5_) +FUNC(_Z12_Jv_is_proxyPv) +FUNC(_Z12shsTransformP8SHS_INFO) +FUNC(_Z13_Jv_DisableGCv) +FUNC(_Z15_Jv_create_coreP14_Jv_core_chainPN4java4lang6StringE) +FUNC(_Z16_Jv_BlockSigchldv) +FUNC(_Z16_Jv_BuildGCDescrPN4java4lang5ClassE) +FUNC(_Z16_Jv_GCFreeMemoryv) +FUNC(_Z16_Jv_SetStackSizePKc) +FUNC(_Z16_Jv_VerifyMethodP16_Jv_InterpMethod) +FUNC(_Z17JvNewStringLatin1PKc) +FUNC(_ZTVN5javax8security4auth4x50021X500PrivateCredentialE) +FUNC(_ZTVN5javax8security4auth5login12LoginContextE) +FUNC(_ZTVN5javax8security4auth5login13ConfigurationE) +FUNC(_ZTVN5javax8security4auth5login14LoginExceptionE) +FUNC(_ZTVN5javax8security4sasl19RealmChoiceCallbackE) +FUNC(_Z24_Jv_isPrimitiveOrDerivedPK13_Jv_Utf8Const) +FUNC(_Z26_Jv_FindSymbolInExecutablePKc) +FUNC(_Z26_Jv_GCInitializeFinalizersPFvvE) +FUNC(_Z37_Jv_FindClassFromSignatureNoExceptionPcPN4java4lang11ClassLoaderEPS_) +FUNC(_Z39_Jv_ThrowNoClassDefFoundErrorTrampolineP7ffi_cifPvPS1_S1_) +FUNC(_Z7in_hashPN4java4lang6ObjectE) +FUNC(_Z7shsInitP8SHS_INFO) +FUNC(_Z8shsFinalP8SHS_INFO) +FUNC(_Z9_Jv_AbortPKcS0_iS0_) +FUNC(_Z9_Jv_RunGCv) +FUNC(_Z9_Jv_ZFreePvS_) +FUNC(_Z9_Jv_equalP13_Jv_Utf8ConstPN4java4lang6StringEi) +FUNC(_Z9shsUpdateP8SHS_INFOPhi) +FUNC(_ZGr30_java_Sutil_Sweeks__properties) +FUNC(_ZGr32_java_Sutil_Siso4217__properties) +FUNC(_ZGr48_gnu_Sjavax_Sprint_SPrinterDialog_de__properties) +FUNC(_ZGr49_gnu_Sjava_Slocale_SLocaleInformation__properties) +FUNC(_ZGr51_gnu_Sjava_Sutil_Sregex_SMessagesBundle__properties) + |