Chromium Code Reviews
|
| OLD | NEW |
|---|---|
| (Empty) | |
| 1 | |
| 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | |
| 3 # Use of this source code is governed by a BSD-style license that can be | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 # simple example that tries to build a mostly sandboxed shared lib | |
| 7 # which is then loaded by a regular (non-sandboxed) images | |
|
jvoung - send to chromium...
2012/05/01 23:30:49
Is it really "loaded by a regular (non-sandboxed)
Robert Muth (chromium)
2012/05/02 16:18:32
Done.
| |
| 8 | |
| 9 ROOT=$(shell readlink -f ../../) | |
| 10 TC_ROOT=$(ROOT)/toolchain/pnacl_linux_x86_64/glibc | |
| 11 PNACL_CC=$(TC_ROOT)/bin/pnacl-clang | |
| 12 PNACL_LD=$(TC_ROOT)/bin/pnacl-nativeld | |
| 13 | |
| 14 BOOTER=$(ROOT)/scons-out/opt-linux-x86-32/staging/nacl_helper_bootstrap | |
| 15 LOADER=$(ROOT)/scons-out/opt-linux-x86-32/staging/sel_ldr | |
| 16 LDSO=$(ROOT)/toolchain/pnacl_linux_x86_64/lib-x86-32/runnable-ld.so | |
| 17 LIBPATH_SHARED=$(ROOT)/toolchain/pnacl_linux_x86_64/lib-x86-32 | |
| 18 PATH_CRT=$(ROOT)/toolchain/pnacl_linux_x86_64/glibc/lib | |
| 19 PATH_CRT_SRC=$(ROOT)/pnacl/support | |
| 20 | |
| 21 COMMON_FLAGS= --pnacl-driver-verbose -save-temps | |
| 22 | |
| 23 RUNNER=$(BOOTER) $(LOADER) -S -E LD_DEBUG=all --r_debug=0xXXXXXXXXXXXXXXXX -a -- $(LDSO) \ | |
|
jvoung - send to chromium...
2012/05/01 23:30:49
80 col
Robert Muth (chromium)
2012/05/02 16:18:32
Done.
| |
| 24 --library-path $(LIBPATH_SHARED) | |
| 25 | |
| 26 | |
| 27 ###################################################################### | |
| 28 | |
| 29 hello1.bc: hello1.c | |
| 30 $(PNACL_CC) -c -I../../.. $(DEBUG_FLAGS) -o $@ $^ | |
|
jvoung - send to chromium...
2012/05/01 23:30:49
why that -I path? to get to "native_client/blah/bl
jvoung - send to chromium...
2012/05/01 23:30:49
I don't think DEBUG_FLAGS is set anywhere.
Robert Muth (chromium)
2012/05/02 16:18:32
Done.
| |
| 31 | |
| 32 fortytwo.bc: fortytwo.c | |
| 33 $(PNACL_CC) -c -I../../.. $(DEBUG_FLAGS) -o $@ $^ | |
| 34 | |
| 35 crtbegin.bc: $(PATH_CRT_SRC)/crtbegin.c | |
| 36 $(PNACL_CC) -c -I../../.. $(DEBUG_FLAGS) -o $@ $^ | |
| 37 | |
| 38 crtend.bc: $(PATH_CRT_SRC)/crtend.c | |
| 39 $(PNACL_CC) -c -I../../.. $(DEBUG_FLAGS) -o $@ $^ | |
| 40 | |
| 41 #libsimple.so: fortytwo.bc | |
| 42 # $(PNACL_CC) $(LD_FLAGS) -nostdlib -shared -fPIC -arch x86-32 -o $@ $^ | |
|
jvoung - send to chromium...
2012/05/01 23:30:49
Commented out stuff, but I don't think LD_FLAGS is
Robert Muth (chromium)
2012/05/02 16:18:32
I'd like to explore this in the next CL
On 2012/0
| |
| 43 | |
| 44 LIBS = -L $(LIBPATH_SHARED) -l:ld-2.9.so | |
| 45 LD_FLAGS_NATIVE = --pnacl-allow-native -arch x86-32 | |
| 46 # NOTE: the duplication of crtbegin.bc. | |
| 47 # The one here was build from $(PATH_CRT_SRC)/bitcode | |
| 48 # The one above from $(PATH_CRT_SRC) | |
|
jvoung - send to chromium...
2012/05/01 23:30:49
So, why are both crtbegins linked in?
Robert Muth (chromium)
2012/05/02 16:18:32
Good question. I think this is what we are current
jvoung - send to chromium...
2012/05/02 17:20:42
Hmm, I'm pretty sure the current driver doesn't do
| |
| 49 INIT = crtbegin.bc $(PATH_CRT)/crt1.bc $(PATH_CRT)/crti.bc $(PATH_CRT)/crtdummy .bc $(PATH_CRT)/crtbegin.bc | |
|
jvoung - send to chromium...
2012/05/01 23:30:49
80 col
robertm
2012/05/02 17:33:12
Done.
| |
| 50 | |
| 51 FINI = crtend.bc | |
|
jvoung - send to chromium...
2012/05/01 23:30:49
why is this crtend used instead?
Robert Muth (chromium)
2012/05/02 16:18:32
Just mimicking the drivers for now
| |
| 52 | |
| 53 # we run this to steal the .o file | |
| 54 # the nexe produced by this is unfortunately not a dynamic image | |
| 55 # because of special handling of -l:ld-2.9.so which gets passed through as | |
| 56 # --add-extra-dt-needed=ld-nacl-x86-32.so.1 which does not trigger the | |
|
jvoung - send to chromium...
2012/05/01 23:30:49
What happens if you build a .pexe first instead?
Robert Muth (chromium)
2012/05/02 16:18:32
IIRC this did not help - I think the problem is th
jvoung - send to chromium...
2012/05/02 17:20:42
Would it be posssible at the native link step to s
robertm
2012/05/02 17:33:12
the explore this together once the CL is in.
On 2
| |
| 57 # a dynamic image | |
| 58 hello1.x86-32.nexe.dummy: hello1.bc crtend.bc crtbegin.bc | |
| 59 $(PNACL_CC) $(COMMON_FLAGS) $(LD_FLAGS_NATIVE) -nodefaultlibs -nostdlib $(INIT) hello1.bc $(LIBS) $(FINI) -o $@ | |
| 60 | |
| 61 | |
| 62 # here we steal the object file from hello1.x86-32.nexe.dummy | |
| 63 hello1.x86-32.nexe: hello1.x86-32.nexe.dummy | |
| 64 $(PNACL_LD) $(COMMON_FLAGS) -arch x86-32 $(LIBS) hello1.x86-32.nexe.du mmy---linked.o -o $@ | |
| 65 | |
| 66 | |
| 67 ###################################################################### | |
| 68 | |
| 69 run1: hello1.x86-32.nexe | |
| 70 ${RUNNER} ./hello1.x86-32.nexe | |
| 71 | |
| 72 ###################################################################### | |
| 73 | |
| 74 clean: | |
| 75 rm -f *.bc *.o *.ll *.so main *.pso *.raw | |
|
jvoung - send to chromium...
2012/05/01 23:30:49
clean out *.nexe too.
Robert Muth (chromium)
2012/05/02 16:18:32
Done.
| |
| OLD | NEW |