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

Delta Between Two Patch Sets: misc/cgo/testshared/test.bash

Issue 9738047: code review 9738047: runtime: Add shared library support (linux/amd64)
Left Patch Set: Created 10 years, 10 months ago
Right Patch Set: diff -r 3833ddddde2b1a2741a396c4e965b04d525a133b https://go.googlecode.com/hg/ Created 10 years, 7 months 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:
Right: Side by side diff | Download
« no previous file with change/comment | « misc/cgo/testshared/shared2.go ('k') | src/cmd/cgo/out.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 #!/usr/bin/env bash
2 # Copyright 2011 The Go Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style
4 # license that can be found in the LICENSE file.
5
6 # This test is not part of the standard test suite, because shared library mode requires special compilation
7 # flags on amd64 and i386.
8 #
9 # To enable shared library mode on linux/amd64, build the standard library with
10 #
11 # GO_GCFLAGS=-largemodel GO_CCFLAGS=-largemodel ./all.bash
12 #
13 # To enable shared library mode on linux/arm, build the standard library as norm al.
14
15 set -e
16
17 args=
18 dyld_envvar=LD_LIBRARY_PATH
19 ext=so
20 if [ "$(uname)" == "Darwin" ]; then
21 args="-undefined suppress -flat_namespace"
22 dyld_envvar=DYLD_LIBRARY_PATH
23 ext=dylib
24 fi
25
26 dylibname=goshared
27 dylibname2=goshared2
28 dylib="lib$dylibname.$ext"
29 dylib2="lib$dylibname2.$ext"
30 [ `go env GOARCH` == "amd64" ] && go_flags='-ccflags "-largemodel" -gcflags "-la rgemodel"'
31 go build -ldflags "-shared -extldflags -L." $go_flags -o $dylib shared.go
32 go build -ldflags "-shared -extldflags -L." $go_flags -o $dylib2 shared2.go
33 $(go env CC) $(go env GOGCCFLAGS) $args -o main main.c -L. -l$dylibname
34 $(go env CC) $(go env GOGCCFLAGS) $args -o mainmult mainmult.c -ldl -L. -l$dylib name -l$dylibname2
35 $(go env CC) $(go env GOGCCFLAGS) $args -o mainadv mainadv.c -ldl
36
37 TEST_ENV=test eval "$dyld_envvar"=. ./main
38 eval "$dyld_envvar"=. ./mainadv
39 if eval "$dyld_envvar"=. ./mainmult; then
40 exit 1;
41 fi
42 rm -rf $dylib $dylib2 mainmult main mainadv *.dSYM
LEFTRIGHT

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