Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(79)

Side by Side Diff: src/cmd/cgo/out.go

Issue 7432048: code review 7432048: cmd/cgo: use explicit flag to emit dynamic linker path (Closed)
Patch Set: diff -r 16c93a202587 https://code.google.com/p/go Created 12 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/cmd/cgo/main.go ('k') | src/cmd/go/build.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 `
OLDNEW
« no previous file with comments | « src/cmd/cgo/main.go ('k') | src/cmd/go/build.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b