mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-21 04:42:53 +08:00
2fe50fe3ef
* dlltool.c (set_dll_name_from_def): Accept new second arg that indicates if we are building DLL or EXE, and use it to add a default suffix to the output filename when none is already present. (def_name): Indicate we are building an EXE when calling it. (def_library): Indicate we are building a DLL when calling it. ld/testsuite/ChangeLog * ld-cygwin/exe-export.exp: Add "-lkernel32" when linking test exe. * ld-cygwin/testexe.c (testexe_main): Indicate whether global_a was set to correct final value using error return status. (testexe_dummy): Dummy function calls an import from kernel32.dll to ensure it is mapped into the process space at runtime.
32 lines
679 B
C
32 lines
679 B
C
int global_a = 2;
|
|
|
|
void
|
|
exewrite (void)
|
|
{
|
|
global_a = 1;
|
|
}
|
|
|
|
extern void dllwrite (void);
|
|
|
|
int _stdcall
|
|
testexe_main (void* p1, void *p2, char* p3, int p4)
|
|
{
|
|
dllwrite ();
|
|
/* We can't print or assert in a minimal app like this,
|
|
so use the return status to indicate if global_a
|
|
ended up with the correct expected value. */
|
|
return 1 - global_a;
|
|
}
|
|
|
|
/* We have to import something, anything at all, from
|
|
kernel32, in order to have the thread and process
|
|
base thunk routines loaded when we start running!. */
|
|
extern __attribute((dllimport)) void _stdcall Sleep (unsigned int duration);
|
|
|
|
int _stdcall
|
|
testexe_dummy (unsigned int foobar)
|
|
{
|
|
Sleep (foobar);
|
|
}
|
|
|