Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(12)

Unified Diff: src/pkg/runtime/symtab.c

Issue 994044: code review 994044: 5l, 6l, 8l, runtime: make -s binaries work (Closed)
Patch Set: code review 994044: 5l, 6l, 8l, runtime: make -s binaries work Created 14 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/cmd/ld/lib.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pkg/runtime/symtab.c
===================================================================
--- a/src/pkg/runtime/symtab.c
+++ b/src/pkg/runtime/symtab.c
@@ -17,10 +17,7 @@
#include "os.h"
#include "arch.h"
-// TODO(rsc): Move this *under* the text segment.
-// Then define names for these addresses instead of hard-coding magic ones.
-#define SYMCOUNTS ((int32*)(0x99LL<<24)) // known to 6l, 8l; see src/cmd/ld/lib.h
-#define SYMDATA ((byte*)(0x99LL<<24) + 8)
+extern int32 symdat[];
typedef struct Sym Sym;
struct Sym
@@ -39,18 +36,15 @@
byte *p, *ep, *q;
Sym s;
- // TODO(rsc): Remove once TODO at top of file is done.
- if(goos != nil && strcmp((uint8*)goos, (uint8*)"nacl") == 0)
- return;
- if(goos != nil && strcmp((uint8*)goos, (uint8*)"pchw") == 0)
+ if(symdat == nil)
return;
#ifdef __MINGW__
v = get_symdat_addr();
p = (byte*)v+8;
#else
- v = SYMCOUNTS;
- p = SYMDATA;
+ v = symdat;
+ p = (byte*)(symdat+2);
#endif
ep = p + v[0];
while(p < ep) {
@@ -248,7 +242,7 @@
Func *f, *ef;
int32 *v;
int32 pcquant;
-
+
switch(thechar) {
case '5':
pcquant = 4;
@@ -258,10 +252,7 @@
break;
}
- // TODO(rsc): Remove once TODO at top of file is done.
- if(goos != nil && strcmp((uint8*)goos, (uint8*)"nacl") == 0)
- return;
- if(goos != nil && strcmp((uint8*)goos, (uint8*)"pchw") == 0)
+ if(symdat == nil)
return;
// pc/ln table bounds
@@ -269,8 +260,8 @@
v = get_symdat_addr();
p = (byte*)v+8;
#else
- v = SYMCOUNTS;
- p = SYMDATA;
+ v = symdat;
+ p = (byte*)(symdat+2);
#endif
p += v[0];
ep = p+v[1];
« no previous file with comments | « src/cmd/ld/lib.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b