plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

symmacho.c (645B)


      1 #include <u.h>
      2 #include <libc.h>
      3 #include <mach.h>
      4 #include "macho.h"
      5 
      6 #if 0
      7 static int
      8 machosyminit(Fhdr *fp)
      9 {
     10 	/* XXX should parse dynamic symbol table here */
     11 	return 0;
     12 }
     13 #endif
     14 
     15 int
     16 symmacho(Fhdr *fp)
     17 {
     18 	int ret;
     19 	Macho *m;
     20 
     21 	m = fp->macho;
     22 	if(m == nil){
     23 		werrstr("not a macho");
     24 		return -1;
     25 	}
     26 
     27 	ret = -1;
     28 
     29 	if(machdebug)
     30 		fprint(2, "macho symbols...\n");
     31 
     32 /*
     33 	if(machosyminit(fp) < 0)
     34 		fprint(2, "initializing macho symbols: %r\n");
     35 	else
     36 		ret = 0;
     37 */
     38 
     39 	if(fp->stabs.stabbase){
     40 		if(machdebug)
     41 			fprint(2, "stabs symbols...\n");
     42 
     43 		if(symstabs(fp) < 0)
     44 			fprint(2, "initializing stabs: %r");
     45 		else
     46 			ret = 0;
     47 	}
     48 	return ret;
     49 }