LEFT | RIGHT |
(no file at all) | |
1 /* | 1 /* |
2 Derived from Plan 9 from User Space's src/libmach/elf.h, elf.c | 2 Derived from Plan 9 from User Space's src/libmach/elf.h, elf.c |
3 http://code.swtch.com/plan9port/src/tip/src/libmach/ | 3 http://code.swtch.com/plan9port/src/tip/src/libmach/ |
4 | 4 |
5 Copyright © 2004 Russ Cox. | 5 Copyright © 2004 Russ Cox. |
6 Portions Copyright © 2008-2010 Google Inc. | 6 Portions Copyright © 2008-2010 Google Inc. |
7 Portions Copyright © 2010 The Go Authors. | 7 Portions Copyright © 2010 The Go Authors. |
8 | 8 |
9 Permission is hereby granted, free of charge, to any person obtaining a copy | 9 Permission is hereby granted, free of charge, to any person obtaining a copy |
10 of this software and associated documentation files (the "Software"), to deal | 10 of this software and associated documentation files (the "Software"), to deal |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 if(sym->type&N_STAB) | 604 if(sym->type&N_STAB) |
605 continue; | 605 continue; |
606 // TODO: check sym->type against outer->type. | 606 // TODO: check sym->type against outer->type. |
607 name = sym->name; | 607 name = sym->name; |
608 if(name[0] == '_' && name[1] != '\0') | 608 if(name[0] == '_' && name[1] != '\0') |
609 name++; | 609 name++; |
610 v = 0; | 610 v = 0; |
611 if(!(sym->type&N_EXT)) | 611 if(!(sym->type&N_EXT)) |
612 v = version; | 612 v = version; |
613 s = lookup(name, v); | 613 s = lookup(name, v); |
| 614 if(!(sym->type&N_EXT)) |
| 615 s->dupok = 1; |
614 sym->sym = s; | 616 sym->sym = s; |
615 if(sym->sectnum == 0) // undefined | 617 if(sym->sectnum == 0) // undefined |
616 continue; | 618 continue; |
617 if(sym->sectnum > c->seg.nsect) { | 619 if(sym->sectnum > c->seg.nsect) { |
618 werrstr("reference to invalid section %d", sym->sectnum)
; | 620 werrstr("reference to invalid section %d", sym->sectnum)
; |
619 goto bad; | 621 goto bad; |
620 } | 622 } |
621 sect = &c->seg.sect[sym->sectnum-1]; | 623 sect = &c->seg.sect[sym->sectnum-1]; |
622 outer = sect->sym; | 624 outer = sect->sym; |
623 if(outer == nil) { | 625 if(outer == nil) { |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 }······················· | 847 }······················· |
846 qsort(r, rp - r, sizeof r[0], rbyoff); | 848 qsort(r, rp - r, sizeof r[0], rbyoff); |
847 s->r = r; | 849 s->r = r; |
848 s->nr = rp - r; | 850 s->nr = rp - r; |
849 } | 851 } |
850 return; | 852 return; |
851 | 853 |
852 bad: | 854 bad: |
853 diag("%s: malformed mach-o file: %r", pn); | 855 diag("%s: malformed mach-o file: %r", pn); |
854 } | 856 } |
LEFT | RIGHT |