OLD | NEW |
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 package main | 5 package main |
6 | 6 |
7 import ( | 7 import ( |
8 "bytes" | 8 "bytes" |
9 "debug/elf" | 9 "debug/elf" |
10 "debug/macho" | 10 "debug/macho" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 } | 141 } |
142 return | 142 return |
143 } | 143 } |
144 | 144 |
145 if f, err := pe.Open(obj); err == nil { | 145 if f, err := pe.Open(obj); err == nil { |
146 sym, err := f.ImportedSymbols() | 146 sym, err := f.ImportedSymbols() |
147 if err != nil { | 147 if err != nil { |
148 fatalf("cannot load imported symbols from PE file %s: %v
", obj, err) | 148 fatalf("cannot load imported symbols from PE file %s: %v
", obj, err) |
149 } | 149 } |
150 for _, s := range sym { | 150 for _, s := range sym { |
151 » » » ss := strings.Split(s, ":", -1) | 151 » » » ss := strings.Split(s, ":") |
152 fmt.Printf("#pragma dynimport %s %s %q\n", ss[0], ss[0],
strings.ToLower(ss[1])) | 152 fmt.Printf("#pragma dynimport %s %s %q\n", ss[0], ss[0],
strings.ToLower(ss[1])) |
153 } | 153 } |
154 return | 154 return |
155 } | 155 } |
156 | 156 |
157 fatalf("cannot parse %s as ELF, Mach-O or PE", obj) | 157 fatalf("cannot parse %s as ELF, Mach-O or PE", obj) |
158 } | 158 } |
159 | 159 |
160 // Construct a gcc struct matching the 6c argument frame. | 160 // Construct a gcc struct matching the 6c argument frame. |
161 // Assumes that in gcc, char is 1 byte, short 2 bytes, int 4 bytes, long long 8
bytes. | 161 // Assumes that in gcc, char is 1 byte, short 2 bytes, int 4 bytes, long long 8
bytes. |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 typedef unsigned short ushort; | 721 typedef unsigned short ushort; |
722 typedef long long int64; | 722 typedef long long int64; |
723 typedef unsigned long long uint64; | 723 typedef unsigned long long uint64; |
724 typedef __SIZE_TYPE__ uintptr; | 724 typedef __SIZE_TYPE__ uintptr; |
725 | 725 |
726 typedef struct { char *p; int n; } GoString; | 726 typedef struct { char *p; int n; } GoString; |
727 typedef void *GoMap; | 727 typedef void *GoMap; |
728 typedef void *GoChan; | 728 typedef void *GoChan; |
729 typedef struct { void *t; void *v; } GoInterface; | 729 typedef struct { void *t; void *v; } GoInterface; |
730 ` | 730 ` |
OLD | NEW |