LEFT | RIGHT |
(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 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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 | 487 |
488 if *gccgo { | 488 if *gccgo { |
489 p.writeGccgoOutputFunc(fgcc, n) | 489 p.writeGccgoOutputFunc(fgcc, n) |
490 return | 490 return |
491 } | 491 } |
492 | 492 |
493 ctype, _ := p.structType(n) | 493 ctype, _ := p.structType(n) |
494 | 494 |
495 // Gcc wrapper unpacks the C argument struct | 495 // Gcc wrapper unpacks the C argument struct |
496 // and calls the actual C function. | 496 // and calls the actual C function. |
497 » fmt.Fprintf(fgcc, "void\n") | 497 » fmt.Fprintf(fgcc, "__attribute__ ((visibility (\"hidden\"))) void\n") |
498 fmt.Fprintf(fgcc, "_cgo%s%s(void *v)\n", cPrefix, n.Mangle) | 498 fmt.Fprintf(fgcc, "_cgo%s%s(void *v)\n", cPrefix, n.Mangle) |
499 fmt.Fprintf(fgcc, "{\n") | 499 fmt.Fprintf(fgcc, "{\n") |
500 if n.AddError { | 500 if n.AddError { |
501 fmt.Fprintf(fgcc, "\terrno = 0;\n") | 501 fmt.Fprintf(fgcc, "\terrno = 0;\n") |
502 } | 502 } |
503 // We're trying to write a gcc struct that matches 6c/8c/5c's layout. | 503 // We're trying to write a gcc struct that matches 6c/8c/5c's layout. |
504 // Use packed attribute to force no padding in this struct in case | 504 // Use packed attribute to force no padding in this struct in case |
505 // gcc has different packing requirements. For example, | 505 // gcc has different packing requirements. For example, |
506 // on 386 Windows, gcc wants to 8-align int64s, but 8c does not. | 506 // on 386 Windows, gcc wants to 8-align int64s, but 8c does not. |
507 // Use __gcc_struct__ to work around http://gcc.gnu.org/PR52991 on x86, | 507 // Use __gcc_struct__ to work around http://gcc.gnu.org/PR52991 on x86, |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1215 typedef double GoFloat64; | 1215 typedef double GoFloat64; |
1216 typedef __complex float GoComplex64; | 1216 typedef __complex float GoComplex64; |
1217 typedef __complex double GoComplex128; | 1217 typedef __complex double GoComplex128; |
1218 | 1218 |
1219 typedef struct { char *p; GoInt n; } GoString; | 1219 typedef struct { char *p; GoInt n; } GoString; |
1220 typedef void *GoMap; | 1220 typedef void *GoMap; |
1221 typedef void *GoChan; | 1221 typedef void *GoChan; |
1222 typedef struct { void *t; void *v; } GoInterface; | 1222 typedef struct { void *t; void *v; } GoInterface; |
1223 typedef struct { void *data; GoInt len; GoInt cap; } GoSlice; | 1223 typedef struct { void *data; GoInt len; GoInt cap; } GoSlice; |
1224 ` | 1224 ` |
LEFT | RIGHT |