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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 stdout := os.Stdout | 156 stdout := os.Stdout |
157 if *dynout != "" { | 157 if *dynout != "" { |
158 f, err := os.Create(*dynout) | 158 f, err := os.Create(*dynout) |
159 if err != nil { | 159 if err != nil { |
160 fatalf("%s", err) | 160 fatalf("%s", err) |
161 } | 161 } |
162 stdout = f | 162 stdout = f |
163 } | 163 } |
164 | 164 |
165 if f, err := elf.Open(obj); err == nil { | 165 if f, err := elf.Open(obj); err == nil { |
166 » » if !*importRuntimeCgo { | 166 » » if *dynlinker { |
167 » » » // We are runtime/cgo, so emit the cgo_dynamic_linker li
ne. | 167 » » » // Emit the cgo_dynamic_linker line. |
168 if sec := f.Section(".interp"); sec != nil { | 168 if sec := f.Section(".interp"); sec != nil { |
169 if data, err := sec.Data(); err == nil && len(da
ta) > 1 { | 169 if data, err := sec.Data(); err == nil && len(da
ta) > 1 { |
170 // skip trailing \0 in data | 170 // skip trailing \0 in data |
171 fmt.Fprintf(stdout, "#pragma cgo_dynamic
_linker %q\n", string(data[:len(data)-1])) | 171 fmt.Fprintf(stdout, "#pragma cgo_dynamic
_linker %q\n", string(data[:len(data)-1])) |
172 } | 172 } |
173 } | 173 } |
174 } | 174 } |
175 sym, err := f.ImportedSymbols() | 175 sym, err := f.ImportedSymbols() |
176 if err != nil { | 176 if err != nil { |
177 fatalf("cannot load imported symbols from ELF file %s: %
v", obj, err) | 177 fatalf("cannot load imported symbols from ELF file %s: %
v", obj, err) |
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1126 typedef double GoFloat64; | 1126 typedef double GoFloat64; |
1127 typedef __complex float GoComplex64; | 1127 typedef __complex float GoComplex64; |
1128 typedef __complex double GoComplex128; | 1128 typedef __complex double GoComplex128; |
1129 | 1129 |
1130 typedef struct { char *p; int n; } GoString; | 1130 typedef struct { char *p; int n; } GoString; |
1131 typedef void *GoMap; | 1131 typedef void *GoMap; |
1132 typedef void *GoChan; | 1132 typedef void *GoChan; |
1133 typedef struct { void *t; void *v; } GoInterface; | 1133 typedef struct { void *t; void *v; } GoInterface; |
1134 typedef struct { void *data; int len; int cap; } GoSlice; | 1134 typedef struct { void *data; int len; int cap; } GoSlice; |
1135 ` | 1135 ` |
OLD | NEW |