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

Delta Between Two Patch Sets: src/cmd/ld/pe.c

Issue 4383047: code review 4383047: ld: 25% faster (Closed)
Left Patch Set: diff -r 4fb77130a7ef https://go.googlecode.com/hg/ Created 13 years, 11 months ago
Right Patch Set: diff -r 543d4c83a379 https://go.googlecode.com/hg/ Created 13 years, 11 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/cmd/ld/lib.c ('k') | src/cmd/ld/symtab.c » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // PE (Portable Executable) file writing 5 // PE (Portable Executable) file writing
6 // http://www.microsoft.com/whdc/system/platform/firmware/PECOFF.mspx 6 // http://www.microsoft.com/whdc/system/platform/firmware/PECOFF.mspx
7 7
8 #include <time.h> 8 #include <time.h>
9 9
10 #include "l.h" 10 #include "l.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 if(n%2) 164 if(n%2)
165 cput('\0'); 165 cput('\0');
166 } 166 }
167 167
168 static Dll*· 168 static Dll*·
169 initdynimport(void) 169 initdynimport(void)
170 { 170 {
171 Imp *m; 171 Imp *m;
172 Dll *d; 172 Dll *d;
173 Sym *s, *dynamic; 173 Sym *s, *dynamic;
174 int i;
175 174
176 dr = nil; 175 dr = nil;
177 ········ 176 ········
178 » for(i=0; i<NHASH; i++) 177 » for(s = allsym; s != S; s = s->allsym) {
179 » for(s = hash[i]; s != S; s = s->hash) {
180 if(!s->reachable || !s->dynimpname || s->dynexport) 178 if(!s->reachable || !s->dynimpname || s->dynexport)
181 continue; 179 continue;
182 for(d = dr; d != nil; d = d->next) { 180 for(d = dr; d != nil; d = d->next) {
183 if(strcmp(d->name,s->dynimplib) == 0) { 181 if(strcmp(d->name,s->dynimplib) == 0) {
184 m = mal(sizeof *m); 182 m = mal(sizeof *m);
185 break; 183 break;
186 } 184 }
187 } 185 }
188 if(d == nil) { 186 if(d == nil) {
189 d = mal(sizeof *d); 187 d = mal(sizeof *d);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 Sym *s1, *s2; 303 Sym *s1, *s2;
306 304
307 s1 = *(Sym**)p1; 305 s1 = *(Sym**)p1;
308 s2 = *(Sym**)p2; 306 s2 = *(Sym**)p2;
309 return strcmp(s1->dynimpname, s2->dynimpname); 307 return strcmp(s1->dynimpname, s2->dynimpname);
310 } 308 }
311 309
312 static void 310 static void
313 initdynexport(void) 311 initdynexport(void)
314 { 312 {
315 int i;
316 Sym *s; 313 Sym *s;
317 ········ 314 ········
318 nexport = 0; 315 nexport = 0;
319 » for(i=0; i<NHASH; i++) 316 » for(s = allsym; s != S; s = s->allsym) {
320 » for(s = hash[i]; s != S; s = s->hash) {
321 if(!s->reachable || !s->dynimpname || !s->dynexport) 317 if(!s->reachable || !s->dynimpname || !s->dynexport)
322 continue; 318 continue;
323 if(nexport+1 > sizeof(dexport)/sizeof(dexport[0])) { 319 if(nexport+1 > sizeof(dexport)/sizeof(dexport[0])) {
324 diag("pe dynexport table is full"); 320 diag("pe dynexport table is full");
325 errorexit(); 321 errorexit();
326 } 322 }
327 ················ 323 ················
328 dexport[nexport] = s; 324 dexport[nexport] = s;
329 nexport++; 325 nexport++;
330 } 326 }
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 else 527 else
532 set(Subsystem, IMAGE_SUBSYSTEM_WINDOWS_CUI); 528 set(Subsystem, IMAGE_SUBSYSTEM_WINDOWS_CUI);
533 set(SizeOfStackReserve, 0x0040000); 529 set(SizeOfStackReserve, 0x0040000);
534 set(SizeOfStackCommit, 0x00001000); 530 set(SizeOfStackCommit, 0x00001000);
535 set(SizeOfHeapReserve, 0x00100000); 531 set(SizeOfHeapReserve, 0x00100000);
536 set(SizeOfHeapCommit, 0x00001000); 532 set(SizeOfHeapCommit, 0x00001000);
537 set(NumberOfRvaAndSizes, 16); 533 set(NumberOfRvaAndSizes, 16);
538 534
539 pewrite(); 535 pewrite();
540 } 536 }
LEFTRIGHT

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