Index: linker/Makefile |
diff --git a/linker/Makefile b/linker/Makefile |
index 09378d7adf3a50ad32c7df8c3fd4acea7b5bf9dc..5a2cee223f3a400f0e27088cbbc0b39bb4f2d84d 100644 |
--- a/linker/Makefile |
+++ b/linker/Makefile |
@@ -1,28 +1,27 @@ |
-# Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+# Copyright (c) 2014 The Chromium Authors. All rights reserved. |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
# GNU Makefile based on shared rules provided by the Native Client SDK. |
# See README.Makefiles for more details. |
-VALID_TOOLCHAINS := nacl |
-VALID_CONFIGS := Debug Release |
-LOADER = sel_ldr |
-TARGET=hello_world |
- |
-NACL_SDK_ROOT ?= $(abspath $(CURDIR)/../..) |
-include $(NACL_SDK_ROOT)/tools/tc_common.mk |
- |
-EXTRA_INCS := -isystem $(abspath ../libc) -isystem $(abspath ../../external/safe-iop/include) |
+EXTRA_INCS := -isystem $(SRC_ROOT)/../libc -isystem $(SRC_ROOT)../safe-iop/include |
EXTRA_INCS += -Iarch/nacl |
-CFLAGS += -std=c99 -DUSES_SSE2 -DFLOATING_POINT -DINET6 -DUSG_COMPAT |
+CFLAGS += -std=c99 -DFLOATING_POINT -DINET6 -DUSG_COMPAT |
CFLAGS += -DANDROID_SMP=1 -D_GNU_SOURCE -DHAVE_MORECORE=0 -DLINKER_DEBUG=1 |
-X86_32_CFLAGS += -DANDROID_X86_LINKER |
+X86_32_CFLAGS += -DANDROID_X86_LINKER -DUSES_SSE2 |
X86_64_CFLAGS += -DANDROID_X86_64_LINKER |
ARM_CFLAGS += -DANDROID_ARM_LINKER |
+ifeq ($(NACL_ARCH),arm) |
+ARCH_FLAGS:=$(ARM_CFLAGS) |
+else |
+ARCH_FLAGS:=$(X86_CFLAGS) |
+endif |
+ |
+ |
# NEXE_ARGS := --library-path $(OUTDIR):$(LIBDIR)/nacl_$(NACL_ARCH)/Debug hello_world_$(NACL_ARCH).nexe 1 2 3 |
RUNNABLE_SOURCES = \ |
@@ -48,24 +47,42 @@ X86_32_LD_TAIL_STATIC := -T ../../arch-x86_32/lib/runnable-ld.lds -lsupc++ -lc - |
X86_64_LD_TAIL_STATIC := -T ../../arch-x86_64/lib/runnable-ld.lds -lsupc++ -lc -lgcc $(LIBDIR)/nacl_x86_64/$(CONFIG)/crtend_st.o |
ARM_LD_TAIL_STATIC := -T ../../arch-arm/lib/runnable-ld.lds -lsupc++ -lc -lgcc $(ARM_LIBGCC_A) $(LIBDIR)/nacl_arm/$(CONFIG)/crtend_st.o |
-RUNNABLE_LD:=-static -lc -Wl,-Ttext,0x20000 |
-$(foreach src,$(RUNNABLE_SOURCES),$(eval $(call COMPILE_RULE,$(src),$(CFLAGS) $(EXTRA_INCS),$(OUTDIR)))) |
-$(eval $(call STATIC_LINK_RULE,runnable-ld,$(RUNNABLE_SOURCES),$(RUNNABLE_LD),$(OUTDIR))) |
+RUNNABLE_LD:=-nostdlib -static -lc -Wl,-Ttext,0x20000 |
+RUNNABLE_OBJECTS := $(subst .c,.o,$(subst .cpp,.o,$(RUNNABLE_SOURCES))) |
+$(foreach src,$(RUNNABLE_SOURCES),$(eval $(call BASIC_COMPILE_TARGET,$(basename $(src)).o,$(SRC_ROOT)/$(src),$(CC),-std=gnu99 -g $(CFLAGS) $(EXTRA_INCS) $(ARCH_FLAGS)))) |
+$(eval $(call BASIC_LINK_TARGET,$(INS_ROOT)/runnable-ld.so,$(RUNNABLE_OBJECTS),$(CC),$(RUNNABLE_LD),,-lsupc++ -lc -lgcc_eh -lgcc)) |
-# Install Runnable into LIB directory |
-ifneq (,$(findstring x86_32,$(ARCHES))) |
-$(eval $(call INSTALL_RULE,$(LIBDIR)/nacl_x86_32/$(CONFIG)/runnable-ld.so,$(OUTDIR)/runnable-ld_x86_32.nexe,,RUNNABLE_TARGETS)) |
-endif |
+hello: $(SRC_ROOT)/hello.c |
+ $(CC) $< -g -o $@ -Wl,-Ttext-segment,0x100000 -lgcc_s |
-ifneq (,$(findstring x86_64,$(ARCHES))) |
-$(eval $(call INSTALL_RULE,$(LIBDIR)/nacl_x86_64/$(CONFIG)/runnable-ld.so,$(OUTDIR)/runnable-ld_x86_64.nexe,,RUNNABLE_TARGETS)) |
-endif |
+ |
+QEMU_PATH:=$(TOOLCHAIN_PATH)/../linux_arm-trusted |
+TOOL_PATH?=$(NACL_SDK_ROOT)/tools |
-ifneq (,$(findstring arm,$(ARCHES))) |
-$(eval $(call INSTALL_RULE,$(LIBDIR)/nacl_arm/$(CONFIG)/runnable-ld.so,$(OUTDIR)/runnable-ld_arm.nexe,,RUNNABLE_TARGETS)) |
-endif |
+QEMU_ARGS:=$(QEMU_PATH)/qemu-arm -L $(QEMU_PATH) -cpu cortex-a8 |
+SEL_LDR:= $(TOOL_PATH)/nacl_helper_bootstrap_arm $(TOOL_PATH)/sel_ldr_arm |
+HELPER_ARGS:=--r_debug=0xXXXXXXXXXXXXXXXX --reserved_at_zero=0xXXXXXXXXXXXXXXXX |
+SEL_ARGS+= -a -c -c -Q -B $(TOOL_PATH)/irt_core_arm.nexe |
+ |
+ARM_MACHINE ?= panda0.mtv |
+ARM_PATH ?= $(USER) |
+SSH_PATH ?= $(ARM_MACHINE):~/$(ARM_PATH) |
+ |
+.PHONY : test debug ssh-all ssh |
+test: hello |
+ $(QEMU_ARGS) $(SEL_LDR) $(HELPER_ARGS) $(SEL_ARGS) $(INS_ROOT)/runnable-ld.so hello 1 2 3 4 |
+ |
+debug : hello |
+ $(QEMU_ARGS) $(SEL_LDR) $(HELPER_ARGS) -g $(SEL_ARGS) $(INS_ROOT)/runnable-ld.so hello 1 2 3 4 |
+ssh : hello |
+ scp hello $(SSH_PATH) |
+ scp $(INS_ROOT)/runnable-ld.so $(SSH_PATH) |
+ scp $(SRC_ROOT)/ld.gdb |
-$(eval $(call COMPILE_RULE,hello.c,$(CFLAGS),$(OUTDIR))) |
-$(eval $(call DYNAMIC_LINK_RULE,hello_world,hello.c,,$(OUTDIR),$(RUNNABLE_TARGETS))) |
+ssh-all: ssh |
+ scp $(TOOL_PATH)/irt_core_arm.nexe $(SSH_PATH) |
+ scp $(TOOL_PATH)/sel_ldr_arm $(SSH_PATH) |
+ scp $(TOOL_PATH)/nacl_helper_bootstrap_arm $(SSH_PATH) |
+ scp $(INS_ROOT)/*.so $(SSH_PATH) |