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

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/simple.h » ('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,77 @@
+# 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(s) for builing shared images with the pnacl TC
+# which do not require glibc
+
+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) --library-path $(LIBPATH_SHARED)
+
+
+######################################################################
+PNACL_CC_FLAGS = $(COMMON_FLAGS)
+
+hello1.bc: hello1.c
+ $(PNACL_CC) -c $(PNACL_CC_FLAGS) -o $@ $^
+
+fortytwo.bc: fortytwo.c
+ $(PNACL_CC) -c $(PNACL_CC_FLAGS) -o $@ $^
+
+crtbegin.bc: $(PATH_CRT_SRC)/crtbegin.c
+ $(PNACL_CC) -c $(PNACL_CC_FLAGS) -o $@ $^
+
+crtend.bc: $(PATH_CRT_SRC)/crtend.c
+ $(PNACL_CC) -c $(PNACL_CC_FLAGS) -o $@ $^
+
+# TODO(robertm): add soname and maybe go to pso first
+#libsimple.so: fortytwo.bc
+# $(PNACL_CC) $(COMMON_FLAGS) -nostdlib -shared -fPIC -arch x86-32 -o $@ $^
+
+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)
+INIT = crtbegin.bc $(PATH_CRT)/crt1.bc $(PATH_CRT)/crti.bc $(PATH_CRT)/crtdummy.bc $(PATH_CRT)/crtbegin.bc
+
+FINI = crtend.bc
+
+# 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
+# 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 $@
jvoung - send to chromium... 2012/05/02 17:27:27 Actually, so the crtbegin.o and crtend.o mentioned
robertm 2012/05/02 17:33:12 yes, not sure whether hello1.x86-32.nexe will stil
+
+
+######################################################################
+
+run1: hello1.x86-32.nexe
+ ${RUNNER} ./hello1.x86-32.nexe
+
+######################################################################
+
+clean:
+ rm -f *.bc *.o *.ll *.so main *.pso *.raw
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/simple.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698