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

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: diff -r 3f530b76de99 https://go.googlecode.com/hg/ 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:
Left: Side by side diff | Download
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
1 #!/usr/bin/env bash 1 #!/usr/bin/env bash
2 # Copyright 2011 The Go Authors. All rights reserved. 2 # Copyright 2011 The Go Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style 3 # Use of this source code is governed by a BSD-style
4 # license that can be found in the LICENSE file. 4 # license that can be found in the LICENSE file.
5 5
6 # This test is not part of the standard test suite, because shared library mode requires special compilation 6 # This test is not part of the standard test suite, because shared library mode requires special compilation
7 # flags on amd64 and i386. 7 # flags on amd64 and i386.
8 # 8 #
9 # To enable shared library mode on linux/amd64, build the standard library with 9 # To enable shared library mode on linux/amd64, build the standard library with
10 # 10 #
11 # GO_GCFLAGS=-largemodel GO_CCFLAGS=-largemodel ./all.bash 11 # GO_GCFLAGS=-largemodel GO_CCFLAGS=-largemodel ./all.bash
12 # 12 #
13 # and then run this test. 13 # To enable shared library mode on linux/arm, build the standard library as norm al.
14 14
15 set -e 15 set -e
16 16
17 args= 17 args=
18 dyld_envvar=LD_LIBRARY_PATH 18 dyld_envvar=LD_LIBRARY_PATH
19 ext=so 19 ext=so
20 if [ "$(uname)" == "Darwin" ]; then 20 if [ "$(uname)" == "Darwin" ]; then
21 args="-undefined suppress -flat_namespace" 21 args="-undefined suppress -flat_namespace"
22 dyld_envvar=DYLD_LIBRARY_PATH 22 dyld_envvar=DYLD_LIBRARY_PATH
23 ext=dylib 23 ext=dylib
24 fi 24 fi
25 25
26 dylibname=goshared 26 dylibname=goshared
27 dylibname2=goshared2
27 dylib="lib$dylibname.$ext" 28 dylib="lib$dylibname.$ext"
28 go build -ldflags "-shared -extldflags -L." -ccflags "-largemodel" -gcflags "-la rgemodel" -o $dylib shared.go 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
29 $(go env CC) $(go env GOGCCFLAGS) $args -o main main.c -L. -l$dylibname 33 $(go env CC) $(go env GOGCCFLAGS) $args -o main main.c -L. -l$dylibname
30 $(go env CC) $(go env GOGCCFLAGS) $args -o mainadv mainadv.c -ldl -L. -l$dylibna me 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
31 36
32 eval "$dyld_envvar"=. ./main 37 TEST_ENV=test eval "$dyld_envvar"=. ./main
33 eval "$dyld_envvar"=. ./mainadv 38 eval "$dyld_envvar"=. ./mainadv
34 rm -rf $dylib main mainadv *.dSYM 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