Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(512)

Unified Diff: tests/pnacl_ld_experiments/Makefile

Issue 10268028: Intial experiment for building dynamic images without glibc under pnacl (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/pnacl_ld_experiments/fortytwo.c » ('j') | tests/pnacl_ld_experiments/fortytwo.c » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/pnacl_ld_experiments/Makefile
===================================================================
--- tests/pnacl_ld_experiments/Makefile (revision 0)
+++ tests/pnacl_ld_experiments/Makefile (revision 0)
@@ -0,0 +1,75 @@
+
+# Copyright (c) 2012 The Native Client Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# simple example that tries to build a mostly sandboxed shared lib
+# 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.
+
+ROOT=$(shell readlink -f ../../)
+TC_ROOT=$(ROOT)/toolchain/pnacl_linux_x86_64/glibc
+PNACL_CC=$(TC_ROOT)/bin/pnacl-clang
+PNACL_LD=$(TC_ROOT)/bin/pnacl-nativeld
+
+BOOTER=$(ROOT)/scons-out/opt-linux-x86-32/staging/nacl_helper_bootstrap
+LOADER=$(ROOT)/scons-out/opt-linux-x86-32/staging/sel_ldr
+LDSO=$(ROOT)/toolchain/pnacl_linux_x86_64/lib-x86-32/runnable-ld.so
+LIBPATH_SHARED=$(ROOT)/toolchain/pnacl_linux_x86_64/lib-x86-32
+PATH_CRT=$(ROOT)/toolchain/pnacl_linux_x86_64/glibc/lib
+PATH_CRT_SRC=$(ROOT)/pnacl/support
+
+COMMON_FLAGS= --pnacl-driver-verbose -save-temps
+
+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.
+ --library-path $(LIBPATH_SHARED)
+
+
+######################################################################
+
+hello1.bc: hello1.c
+ $(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.
+
+fortytwo.bc: fortytwo.c
+ $(PNACL_CC) -c -I../../.. $(DEBUG_FLAGS) -o $@ $^
+
+crtbegin.bc: $(PATH_CRT_SRC)/crtbegin.c
+ $(PNACL_CC) -c -I../../.. $(DEBUG_FLAGS) -o $@ $^
+
+crtend.bc: $(PATH_CRT_SRC)/crtend.c
+ $(PNACL_CC) -c -I../../.. $(DEBUG_FLAGS) -o $@ $^
+
+#libsimple.so: fortytwo.bc
+# $(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
+
+LIBS = -L $(LIBPATH_SHARED) -l:ld-2.9.so
+LD_FLAGS_NATIVE = --pnacl-allow-native -arch x86-32
+# NOTE: the duplication of crtbegin.bc.
+# The one here was build from $(PATH_CRT_SRC)/bitcode
+# 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
+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.
+
+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
+
+# we run this to steal the .o file
+# the nexe produced by this is unfortunately not a dynamic image
+# because of special handling of -l:ld-2.9.so which gets passed through as
+# --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
+# a dynamic image
+hello1.x86-32.nexe.dummy: hello1.bc crtend.bc crtbegin.bc
+ $(PNACL_CC) $(COMMON_FLAGS) $(LD_FLAGS_NATIVE) -nodefaultlibs -nostdlib $(INIT) hello1.bc $(LIBS) $(FINI) -o $@
+
+
+# here we steal the object file from hello1.x86-32.nexe.dummy
+hello1.x86-32.nexe: hello1.x86-32.nexe.dummy
+ $(PNACL_LD) $(COMMON_FLAGS) -arch x86-32 $(LIBS) hello1.x86-32.nexe.dummy---linked.o -o $@
+
+
+######################################################################
+
+run1: hello1.x86-32.nexe
+ ${RUNNER} ./hello1.x86-32.nexe
+
+######################################################################
+
+clean:
+ 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.
Property changes on: tests/pnacl_ld_experiments/Makefile
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « no previous file | tests/pnacl_ld_experiments/fortytwo.c » ('j') | tests/pnacl_ld_experiments/fortytwo.c » ('J')

Powered by Google App Engine
This is Rietveld 408576698