aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/windows/thread.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-10-19 18:07:19 -0400
committerRuss Cox <rsc@golang.org>2010-10-19 18:07:19 -0400
commit19fd5c787f3ff0ac434bca6a29c558ed966e1012 (patch)
treed55c64383144d4fce53f529a4b7a02cc5dfec66a /src/pkg/runtime/windows/thread.c
parent01df088f8d7812046f27eaa8e285ad28c0e10a0c (diff)
downloadgo-19fd5c787f3ff0ac434bca6a29c558ed966e1012.tar.xz
5l, 6l, 8l: link pclntab and symtab as ordinary rodata symbols
That is, move the pc/ln table and the symbol table into the read-only data segment. This eliminates the need for a special load command to map the symbol table into memory, which makes the information available on systems that couldn't handle the magic load to 0x99000000, like NaCl and ARM QEMU and Linux without config_highmem=y. It also eliminates an #ifdef and some clumsy code to find the symbol table on Windows. The bad news is that the binary appears to be bigger than it used to be. This is not actually the case, though: the same amount of data is being mapped into memory as before, and the tables are still read-only, so they're still shared across multiple instances of the binary as they were before. The difference is just that the tables aren't squirreled away in some section that "size" doesn't know to look at. This is a checkpoint. It probably breaks Windows and breaks NaCl more than it used to be broken, but those will be fixed. The logic involving -s needs to be revisited too. Fixes #871. R=ken2 CC=golang-dev https://golang.org/cl/2587041
Diffstat (limited to 'src/pkg/runtime/windows/thread.c')
-rw-r--r--src/pkg/runtime/windows/thread.c20
1 files changed, 0 insertions, 20 deletions
diff --git a/src/pkg/runtime/windows/thread.c b/src/pkg/runtime/windows/thread.c
index 82d1fa84e5..decea96781 100644
--- a/src/pkg/runtime/windows/thread.c
+++ b/src/pkg/runtime/windows/thread.c
@@ -22,7 +22,6 @@ void *SetLastError;
static void *CreateEvent;
static void *CreateThread;
-static void *GetModuleHandle;
static void *WaitForSingleObject;
static void*
@@ -60,7 +59,6 @@ osinit(void)
CreateEvent = get_proc_addr("kernel32.dll", "CreateEventA");
CreateThread = get_proc_addr("kernel32.dll", "CreateThread");
ExitProcess = get_proc_addr("kernel32.dll", "ExitProcess");
- GetModuleHandle = get_proc_addr("kernel32.dll", "GetModuleHandleA");
GetStdHandle = get_proc_addr("kernel32.dll", "GetStdHandle");
SetEvent = get_proc_addr("kernel32.dll", "SetEvent");
VirtualAlloc = get_proc_addr("kernel32.dll", "VirtualAlloc");
@@ -155,24 +153,6 @@ write(int32 fd, void *buf, int32 n)
return written;
}
-void*
-get_symdat_addr(void)
-{
- byte *mod, *p;
- uint32 peh, add;
- uint16 oph;
-
- mod = stdcall(GetModuleHandle, 1, 0);
- peh = *(uint32*)(mod+0x3c);
- p = mod+peh+4;
- oph = *(uint16*)(p+0x10);
- p += 0x14+oph;
- while(strcmp(p, (byte*)".symdat"))
- p += 40;
- add = *(uint32*)(p+0x0c);
- return mod+add;
-}
-
// Thread-safe allocation of an event.
static void
initevent(void **pevent)