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

Unified Diff: native_client_sdk/src/tools/nacl_llvm.mk

Issue 22766003: [NaCl SDK] Fix PNACL for debugging. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 7 years, 4 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 | « native_client_sdk/src/tools/common.mk ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/tools/nacl_llvm.mk
diff --git a/native_client_sdk/src/tools/nacl_llvm.mk b/native_client_sdk/src/tools/nacl_llvm.mk
index f829123eb84ef252e186b3150c944e318fcd8d7d..a8a310ba2217f6d0520f5c36f2e814a0586af13b 100644
--- a/native_client_sdk/src/tools/nacl_llvm.mk
+++ b/native_client_sdk/src/tools/nacl_llvm.mk
@@ -1,4 +1,4 @@
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Copyright (c) 2012 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.
@@ -17,6 +17,7 @@ PNACL_LINK ?= $(PNACL_BIN)/pnacl-clang++
PNACL_LIB ?= $(PNACL_BIN)/pnacl-ar
PNACL_STRIP ?= $(PNACL_BIN)/pnacl-strip
PNACL_FINALIZE ?= $(PNACL_BIN)/pnacl-finalize
+PNACL_TRANSLATE ?= $(PNACL_BIN)/pnacl-translate
#
# Compile Macro
@@ -93,8 +94,19 @@ endef
# $5 = List of lib dirs
# $6 = Other Linker Args
#
+# For debugging, we translate the pre-finalized .bc file.
+#
define LINKER_RULE
-all: $(1).pexe
+all: $(1).pexe
+$(1)_x86_32.nexe : $(1).bc
+ $(call LOG,TRANSLATE,$$@,$(PNACL_TRANSLATE) --allow-llvm-bitcode-input -arch x86-32 $$^ -o $$@)
+
+$(1)_x86_64.nexe : $(1).bc
+ $(call LOG,TRANSLATE,$$@,$(PNACL_TRANSLATE) --allow-llvm-bitcode-input -arch x86-64 $$^ -o $$@)
+
+$(1)_arm.nexe : $(1).bc
+ $(call LOG,TRANSLATE,$$@,$(PNACL_TRANSLATE) --allow-llvm-bitcode-input -arch arm $$^ -o $$@)
+
$(1).pexe: $(1).bc
$(call LOG,FINALIZE,$$@,$(PNACL_FINALIZE) -o $$@ $$^)
@@ -113,7 +125,15 @@ endef
# $5 = POSIX Linker Switches
# $6 = VC Linker Switches
#
+# NOTE: For Debug builds we translate the .bc file to a .nexe instead of
+# using the finalizing to a .pexe. This enables debugging.
+#
define LINK_RULE
+ifeq ($(CONFIG),Debug)
+EXECUTABLES=$(OUTDIR)/$(1)_x86_32.nexe $(OUTDIR)/$(1)_x86_64.nexe $(OUTDIR)/$(1)_arm.nexe
+else
+EXECUTABLES=$(OUTDIR)/$(1).pexe
+endif
$(call LINKER_RULE,$(OUTDIR)/$(1),$(foreach src,$(2),$(call SRC_TO_OBJ,$(src),_pnacl)),$(filter-out pthread,$(3)),$(4),$(LIB_PATHS),$(5))
endef
@@ -151,7 +171,7 @@ NMF:=python $(NACL_SDK_ROOT)/tools/create_nmf.py
define NMF_RULE
all: $(OUTDIR)/$(1).nmf
-$(OUTDIR)/$(1).nmf: $(OUTDIR)/$(1).pexe
+$(OUTDIR)/$(1).nmf: $(EXECUTABLES)
$(call LOG,CREATE_NMF,$$@,$(NMF) -o $$@ $$^ -s $(OUTDIR) $(2))
endef
@@ -162,7 +182,7 @@ CREATE_HTML := python $(NACL_SDK_ROOT)/tools/create_html.py
define HTML_RULE
all: $(OUTDIR)/$(1).html
-$(OUTDIR)/$(1).html: $(OUTDIR)/$(1).pexe
+$(OUTDIR)/$(1).html: $(EXECUTABLES)
$(call LOG,CREATE_HTML,$$@,$(CREATE_HTML) -o $$@ $$^)
endef
« no previous file with comments | « native_client_sdk/src/tools/common.mk ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698