[Pkg-virtualbox-commits] [kbuild] 02/04: Imported Upstream version 0.1.9998svn2898+dfsg
Gianfranco Costamagna
locutusofborg at moszumanska.debian.org
Fri Sep 9 08:09:30 UTC 2016
This is an automated email from the git hooks/post-receive script.
locutusofborg pushed a commit to branch experimental
in repository kbuild.
commit 84707e053ef2b6b8ac5c99e0014119dfdf56006d
Author: Gianfranco Costamagna <locutusofborg at debian.org>
Date: Fri Sep 9 10:08:40 2016 +0200
Imported Upstream version 0.1.9998svn2898+dfsg
---
kBuild/header.kmk | 8 +-
kBuild/tools/NASM.kmk | 16 +-
kBuild/tools/OPENWATCOM-16.kmk | 65 +++++--
kBuild/tools/OPENWATCOM.kmk | 74 +++++--
kBuild/tools/VCC100AMD64.kmk | 34 +++-
kBuild/tools/VCC100X86.kmk | 32 ++-
kBuild/tools/YASM.kmk | 12 +-
src/kWorker/Makefile.kmk | 13 +-
src/kWorker/kWorker.c | 202 +++++++++++++++++--
src/kWorker/tst-1-c1xx-xcpt.cpp | 345 ---------------------------------
src/kmk/kmkbuiltin/kDepObj.c | 194 ++++++++++++------
src/kmk/kmkbuiltin/kSubmit.c | 62 +++++-
src/kmk/variable.c | 134 ++++++++++++-
src/lib/kStuff/include/k/kLdrFmts/pe.h | 64 +++++-
src/lib/kStuff/kLdr/kLdrModLX.c | 34 ++--
src/lib/kStuff/kLdr/kLdrModMachO.c | 64 +++---
src/lib/kStuff/kLdr/kLdrModPE.c | 39 ++--
src/lib/quote_argv.c | 4 +-
18 files changed, 838 insertions(+), 558 deletions(-)
diff --git a/kBuild/header.kmk b/kBuild/header.kmk
index 63ff90d..462213a 100644
--- a/kBuild/header.kmk
+++ b/kBuild/header.kmk
@@ -1,4 +1,4 @@
-# $Id: header.kmk 2887 2016-09-06 14:33:15Z bird $
+# $Id: header.kmk 2895 2016-09-08 13:28:37Z bird $
## @file
# kBuild - File included at top of a makefile.
#
@@ -79,7 +79,7 @@ endif
# The revision in which this file was last modified.
# This can be useful when using development versions of kBuild.
#
-KMK_REVISION := $(patsubst %:,, $Rev: 2887 $ )
+KMK_REVISION := $(patsubst %:,, $Rev: 2895 $ )
#
@@ -636,6 +636,10 @@ DEP_IDB_EXT := $(KBUILD_BIN_PATH)/kDepIDB$(HOSTSUFF_EXE)
DEP_IDB_INT := kmk_builtin_kDepIDB
DEP_IDB := $(DEP_IDB_INT)
+DEP_OBJ_EXT := $(KBUILD_BIN_PATH)/kDepObj$(HOSTSUFF_EXE)
+DEP_OBJ_INT := kmk_builtin_kDepObj
+DEP_OBJ := $(DEP_OBJ_INT)
+
DEP_PRE := $(KBUILD_BIN_PATH)/kDepPre$(HOSTSUFF_EXE)
KOBJCACHE_EXT := $(KBUILD_BIN_PATH)/kObjCache$(HOSTSUFF_EXE)
diff --git a/kBuild/tools/NASM.kmk b/kBuild/tools/NASM.kmk
index c4941c9..4846033 100644
--- a/kBuild/tools/NASM.kmk
+++ b/kBuild/tools/NASM.kmk
@@ -1,4 +1,4 @@
-# $Id: NASM.kmk 2873 2016-09-04 19:13:12Z bird $
+# $Id: NASM.kmk 2890 2016-09-07 23:39:29Z bird $
## @file
# kBuild Tool Config - Netwide Assembler v0.98+.
#
@@ -83,25 +83,15 @@ ifdef TOOL_NASM_KSUBMIT
$(flags) $(addsuffix /,$(addprefix -i, $(incs))) $(addprefix -D, $(defs))\
-l $(outbase).lst\
-o $(obj)\
+ -MD "$(dep)" -MP\
$(abspath $(source))
- $(QUIET)$(call TOOL_NASM_KSUBMIT, -C $(PATH_OUT_BASE)) $(TOOL_NASM_AS) -DKBUILD_GENERATING_MAKEFILE_DEPENDENCIES\
- $(flags) $(addsuffix /,$(addprefix -i, $(incs))) $(addprefix -D, $(defs))\
- -l $(outbase).lst\
- -o $(obj)\
- $(abspath $(source)) \
- -MF "$(dep)" -MP
else
$(QUIET)$(REDIRECT) -C $(PATH_OUT_BASE) $(TOOL_NASM_AS)\
$(flags) $(addsuffix /,$(addprefix -i, $(incs))) $(addprefix -D, $(defs))\
-l $(outbase).lst\
-o $(obj)\
+ -MD "$(dep)" -MP\
$(abspath $(source))
- $(QUIET)$(REDIRECT) -C $(PATH_OUT_BASE) -- $(TOOL_NASM_AS) -DKBUILD_GENERATING_MAKEFILE_DEPENDENCIES\
- $(flags) $(addsuffix /,$(addprefix -i, $(incs))) $(addprefix -D, $(defs))\
- -l $(outbase).lst\
- -o $(obj)\
- $(abspath $(source)) \
- -MF "$(dep)" -MP
endif
endef
diff --git a/kBuild/tools/OPENWATCOM-16.kmk b/kBuild/tools/OPENWATCOM-16.kmk
index 153b871..ee02835 100644
--- a/kBuild/tools/OPENWATCOM-16.kmk
+++ b/kBuild/tools/OPENWATCOM-16.kmk
@@ -1,4 +1,4 @@
-# $Id: OPENWATCOM-16.kmk 2749 2015-01-23 01:01:02Z bird $
+# $Id: OPENWATCOM-16.kmk 2897 2016-09-08 15:38:43Z bird $
## @file
# kBuild Tool Config - Open Watcom v1.4 and later, 16-bit targets.
#
@@ -43,7 +43,20 @@ TOOL_OPENWATCOM-16_LDFLAGS.win ?= -bt=windows
TOOL_OPENWATCOM-16_COMPILE_AS_DEPEND =
TOOL_OPENWATCOM-16_COMPILE_AS_DEPORD =
-TOOL_OPENWATCOM-16_COMPILE_AS_OUTPUT = $(obj).err
+TOOL_OPENWATCOM-16_COMPILE_AS_OUTPUT =
+TOOL_OPENWATCOM-16_COMPILE_AS_OUTPUT_MAYBE = $(obj).err
+ifdef TOOL_OPENWATCOM_USE_KSUBMIT
+define TOOL_OPENWATCOM-16_COMPILE_AS_CMDS
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP_BD,, -P $(DEP_OBJ_INT) -s -f -q -o "$(dep)" -t "$(obj)" "$(obj)") \
+ $(TOOL_OPENWATCOM_AS) \
+ $(flags) \
+ $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \
+ $(addprefix -d, $(defs)) \
+ -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
+ -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
+endef
+else
define TOOL_OPENWATCOM-16_COMPILE_AS_CMDS
$(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP_BD) $(TOOL_OPENWATCOM_AS) \
$(flags) \
@@ -52,45 +65,71 @@ define TOOL_OPENWATCOM-16_COMPILE_AS_CMDS
-fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
-fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
$(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
- $(QUIET)$(APPEND) -n $(obj).err
-## @todo dependencies
+ $(QUIET)$(DEP_OBJ) -s -f -q -o "$(dep)" -t "$(obj)" "$(obj)"
endef
+endif
TOOL_OPENWATCOM-16_COMPILE_C_DEPEND =
TOOL_OPENWATCOM-16_COMPILE_C_DEPORD =
-TOOL_OPENWATCOM-16_COMPILE_C_OUTPUT = $(obj).err
+TOOL_OPENWATCOM-16_COMPILE_C_OUTPUT =
+TOOL_OPENWATCOM-16_COMPILE_C_OUTPUT_MAYBE = $(obj).err
+ifdef TOOL_OPENWATCOM_USE_KSUBMIT
+define TOOL_OPENWATCOM-16_COMPILE_C_CMDS
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP_BD,, -P $(DEP_OBJ_INT) -s -f -q -o "$(dep)" -t "$(obj)" "$(obj)") \
+ $(TOOL_OPENWATCOM_CC16) \
+ $(flags) \
+ $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \
+ $(addprefix -d, $(defs)) \
+ -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
+ -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
+endef
+else
define TOOL_OPENWATCOM-16_COMPILE_C_CMDS
- $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP_BD) $(TOOL_OPENWATCOM_CC16) \
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP_BD) $(TOOL_OPENWATCOM_CC16) \
$(flags) \
$(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \
$(addprefix -d, $(defs)) \
-fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
-fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
$(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
- $(QUIET)$(APPEND) -n $(obj).err
-## @todo dependencies
+ $(QUIET)$(DEP_OBJ) -s -f -q -o "$(dep)" -t "$(obj)" "$(obj)"
endef
+endif
TOOL_OPENWATCOM-16_COMPILE_CXX_DEPEND =
TOOL_OPENWATCOM-16_COMPILE_CXX_DEPORD =
-TOOL_OPENWATCOM-16_COMPILE_CXX_OUTPUT = $(obj).err
+TOOL_OPENWATCOM-16_COMPILE_CXX_OUTPUT =
+TOOL_OPENWATCOM-16_COMPILE_CXX_OUTPUT_MAYBE = $(obj).err
+ifdef TOOL_OPENWATCOM_USE_KSUBMIT
+define TOOL_OPENWATCOM-16_COMPILE_CXX_CMDS
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP_BD,, -P $(DEP_OBJ_INT) -s -f -q -o "$(dep)" -t "$(obj)" "$(obj)") \
+ $(TOOL_OPENWATCOM_CXX16) \
+ $(flags) \
+ $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \
+ $(addprefix -d, $(defs)) \
+ -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
+ -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
+endef
+else
define TOOL_OPENWATCOM-16_COMPILE_CXX_CMDS
- $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP_BD) $(TOOL_OPENWATCOM_CXX16) \
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP_BD) $(TOOL_OPENWATCOM_CXX16) \
$(flags) \
$(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \
$(addprefix -d, $(defs)) \
-fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
-fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
$(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
- $(QUIET)$(APPEND) -n $(obj).err
-## @todo dependencies
+ $(QUIET)$(DEP_OBJ) -s -f -q -o "$(dep)" -t "$(obj)" "$(obj)"
endef
+endif
TOOL_OPENWATCOM-16_COMPILE_RC_OUTPUT =
TOOL_OPENWATCOM-16_COMPILE_RC_DEPEND =
TOOL_OPENWATCOM-16_COMPILE_RC_DEPORD =
define TOOL_OPENWATCOM-16_COMPILE_RC_CMDS
- $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) \
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \
$(TOOL_OPENWATCOM_RC) -r\
$(flags) \
$(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs))) \
diff --git a/kBuild/tools/OPENWATCOM.kmk b/kBuild/tools/OPENWATCOM.kmk
index 2b33a5b..b7bae08 100644
--- a/kBuild/tools/OPENWATCOM.kmk
+++ b/kBuild/tools/OPENWATCOM.kmk
@@ -1,4 +1,4 @@
-# $Id: OPENWATCOM.kmk 2882 2016-09-05 23:54:45Z bird $
+# $Id: OPENWATCOM.kmk 2897 2016-09-08 15:38:43Z bird $
## @file
# kBuild Tool Config - Open Watcom v1.4 and later.
#
@@ -55,6 +55,13 @@ else
PATH_TOOL_OPENWATCOM := $(PATH_TOOL_OPENWATCOM)
endif
+# Clear the feature indicator if not available on the current host.
+ifdef TOOL_OPENWATCOM_USE_KSUBMIT
+ ifneq ($(KBUILD_HOST),win)
+ override TOOL_OPENWATCOM_USE_KSUBMIT :=
+ endif
+endif
+
ifneq ($(PATH_TOOL_OPENWATCOM),)
TOOL_OPENWATCOM_PATHLESS := no
@@ -148,7 +155,7 @@ else
endif
if $(KBUILD_KMK_REVISION) >= 2747
- TOOL_OPENWATCOM_ENV_SETUP_BD ?= $(call TOOL_OPENWATCOM_ENV_SETUP,$1,$2 --wcc-brain-damage)
+ TOOL_OPENWATCOM_ENV_SETUP_BD ?= $(call TOOL_OPENWATCOM_ENV_SETUP,$1, --wcc-brain-damage $2)
else
TOOL_OPENWATCOM_ENV_SETUP_BD ?= $(call TOOL_OPENWATCOM_ENV_SETUP,$1,$2)
endif
@@ -207,23 +214,49 @@ TOOL_OPENWATCOM_LDFLAGS.win ?= -bt=nt
TOOL_OPENWATCOM_COMPILE_AS_DEPEND =
TOOL_OPENWATCOM_COMPILE_AS_DEPORD =
-TOOL_OPENWATCOM_COMPILE_AS_OUTPUT = $(obj).err
+TOOL_OPENWATCOM_COMPILE_AS_OUTPUT =
+TOOL_OPENWATCOM_COMPILE_AS_OUTPUT_MAYBE = $(obj).err
+ifdef TOOL_OPENWATCOM_USE_KSUBMIT
define TOOL_OPENWATCOM_COMPILE_AS_CMDS
- $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP_BD) $(TOOL_OPENWATCOM_AS) \
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP_BD,, -P $(DEP_OBJ_INT) -s -f -q -o "$(dep)" -t "$(obj)" "$(obj)") \
+ $(TOOL_OPENWATCOM_AS) \
$(flags) \
$(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \
$(addprefix -d, $(defs)) \
-fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
-fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
$(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
- $(QUIET)$(APPEND) -n $(obj).err
-## @todo dependencies
endef
+else
+define TOOL_OPENWATCOM_COMPILE_AS_CMDS
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP_BD) $(TOOL_OPENWATCOM_AS) \
+ $(flags) \
+ $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \
+ $(addprefix -d, $(defs)) \
+ -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
+ -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -s -f -q -o "$(dep)" -t "$(obj)" "$(obj)"
+endef
+endif
TOOL_OPENWATCOM_COMPILE_C_DEPEND =
TOOL_OPENWATCOM_COMPILE_C_DEPORD =
-TOOL_OPENWATCOM_COMPILE_C_OUTPUT = $(obj).err
+TOOL_OPENWATCOM_COMPILE_C_OUTPUT =
+TOOL_OPENWATCOM_COMPILE_C_OUTPUT_MAYBE = $(obj).err
+ifdef TOOL_OPENWATCOM_USE_KSUBMIT
+define TOOL_OPENWATCOM_COMPILE_C_CMDS
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP_BD,, -P $(DEP_OBJ_INT) -s -f -q -o "$(dep)" -t "$(obj)" "$(obj)") \
+ $(TOOL_OPENWATCOM_CC) \
+ $(flags) \
+ $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \
+ $(addprefix -d, $(defs)) \
+ -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
+ -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
+endef
+else
define TOOL_OPENWATCOM_COMPILE_C_CMDS
$(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP_BD) $(TOOL_OPENWATCOM_CC) \
$(flags) \
@@ -232,30 +265,43 @@ define TOOL_OPENWATCOM_COMPILE_C_CMDS
-fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
-fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
$(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
- $(QUIET)$(APPEND) -n $(obj).err
-## @todo dependencies
+ $(QUIET)$(DEP_OBJ) -s -f -q -o "$(dep)" -t "$(obj)" "$(obj)"
endef
+endif
TOOL_OPENWATCOM_COMPILE_CXX_DEPEND =
TOOL_OPENWATCOM_COMPILE_CXX_DEPORD =
-TOOL_OPENWATCOM_COMPILE_CXX_OUTPUT = $(obj).err
+TOOL_OPENWATCOM_COMPILE_CXX_OUTPUT =
+TOOL_OPENWATCOM_COMPILE_CXX_OUTPUT_MAYBE = $(obj).err
+ifdef TOOL_OPENWATCOM_USE_KSUBMIT
+define TOOL_OPENWATCOM_COMPILE_CXX_CMDS
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP_BD,, -P $(DEP_OBJ_INT) -s -f -q -o "$(dep)" -t "$(obj)" "$(obj)") \
+ $(TOOL_OPENWATCOM_CXX) \
+ $(flags) \
+ $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \
+ $(addprefix -d, $(defs)) \
+ -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
+ -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
+endef
+else
define TOOL_OPENWATCOM_COMPILE_CXX_CMDS
- $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP_BD) $(TOOL_OPENWATCOM_CXX) \
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP_BD) $(TOOL_OPENWATCOM_CXX) \
$(flags) \
$(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \
$(addprefix -d, $(defs)) \
-fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
-fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
$(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
- $(QUIET)$(APPEND) -n $(obj).err
-## @todo dependencies
+ $(QUIET)$(DEP_OBJ) -s -f -q -o "$(dep)" -t "$(obj)" "$(obj)"
endef
+endif
TOOL_OPENWATCOM_COMPILE_RC_OUTPUT =
TOOL_OPENWATCOM_COMPILE_RC_DEPEND =
TOOL_OPENWATCOM_COMPILE_RC_DEPORD =
define TOOL_OPENWATCOM_COMPILE_RC_CMDS
- $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) \
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \
$(TOOL_OPENWATCOM_RC) -r\
$(flags) \
$(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs))) \
diff --git a/kBuild/tools/VCC100AMD64.kmk b/kBuild/tools/VCC100AMD64.kmk
index 1239e64..5261eeb 100644
--- a/kBuild/tools/VCC100AMD64.kmk
+++ b/kBuild/tools/VCC100AMD64.kmk
@@ -1,4 +1,4 @@
-# $Id: VCC100AMD64.kmk 2870 2016-09-04 13:52:39Z bird $
+# $Id: VCC100AMD64.kmk 2895 2016-09-08 13:28:37Z bird $
## @file
# kBuild Tool Config - Visual C++ 10.0 (aka Visual 2010 and MSC v16), targeting AMD64.
#
@@ -77,9 +77,9 @@ TOOL_VCC100AMD64_MT ?= $(EXEC_X86_WIN32) $(call TOOL_VCC100_FN_FIND_SDK_TOOL,mt
ifdef TOOL_VCC100AMD64_USE_KSUBMIT
ifeq ($(KBUILD_HOST),win)
ifneq ($(substr $(PATH_TOOL_VCC100AMD64_BIN),-9),x86_amd64)
- TOOL_VCC100AMD64_KSUBMIT ?= kmk_builtin_kSubmit --64-bit --
+ TOOL_VCC100AMD64_KSUBMIT ?= kmk_builtin_kSubmit --64-bit
else
- TOOL_VCC100AMD64_KSUBMIT ?= kmk_builtin_kSubmit --32-bit --
+ TOOL_VCC100AMD64_KSUBMIT ?= kmk_builtin_kSubmit --32-bit
endif
endif
endif
@@ -171,8 +171,19 @@ endef
else # !KBUILD_USE_KOBJCACHE
TOOL_VCC100AMD64_COMPILE_C_OUTPUT = $(call TOOL_VCC100AMD64_PDB, $(outbase)-obj,idb)
TOOL_VCC100AMD64_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC100AMD64_PDB, $(outbase)-obj,pdb)
+ ifdef TOOL_VCC100AMD64_KSUBMIT
define TOOL_VCC100AMD64_COMPILE_C_CMDS
- $(QUIET)$(TOOL_VCC100AMD64_KSUBMIT) $(TOOL_VCC100AMD64_CC) -c\
+ $(QUIET)$(TOOL_VCC100AMD64_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC100AMD64_CC) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -FD\
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+endef
+ else
+define TOOL_VCC100AMD64_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC100AMD64_CC) -c\
$(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
-Fd$(outbase)-obj.pdb \
-FD\
@@ -180,6 +191,7 @@ define TOOL_VCC100AMD64_COMPILE_C_CMDS
$(subst /,\\,$(abspath $(source)))
$(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC100AMD64_PDB,$(outbase)-obj,idb)
endef
+ endif # !TOOL_VCC100AMD64_KSUBMIT
endif # !KBUILD_USE_KOBJCACHE
@@ -219,8 +231,19 @@ endef
else # !KBUILD_USE_KOBJCACHE
TOOL_VCC100AMD64_COMPILE_CXX_OUTPUT = $(call TOOL_VCC100AMD64_PDB, $(outbase)-obj,idb)
TOOL_VCC100AMD64_COMPILE_CXX_OUTPUT_MAYBE = $(call TOOL_VCC100AMD64_PDB, $(outbase)-obj,pdb)
+ ifdef TOOL_VCC100AMD64_KSUBMIT
+define TOOL_VCC100AMD64_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC100AMD64_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC100AMD64_CXX) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -FD\
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+endef
+ else
define TOOL_VCC100AMD64_COMPILE_CXX_CMDS
- $(QUIET)$(TOOL_VCC100AMD64_KSUBMIT) $(TOOL_VCC100AMD64_CXX) -c\
+ $(QUIET)$(TOOL_VCC100AMD64_CXX) -c\
$(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
-Fd$(outbase)-obj.pdb \
-FD\
@@ -228,6 +251,7 @@ define TOOL_VCC100AMD64_COMPILE_CXX_CMDS
$(subst /,\\,$(abspath $(source)))
$(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC100AMD64_PDB,$(outbase)-obj,idb)
endef
+ endif # !TOOL_VCC100AMD64_KSUBMIT
endif # !KBUILD_USE_KOBJCACHE
## @todo configure the assembler template.
diff --git a/kBuild/tools/VCC100X86.kmk b/kBuild/tools/VCC100X86.kmk
index ed8d100..e3ad436 100644
--- a/kBuild/tools/VCC100X86.kmk
+++ b/kBuild/tools/VCC100X86.kmk
@@ -1,4 +1,4 @@
-# $Id: VCC100X86.kmk 2870 2016-09-04 13:52:39Z bird $
+# $Id: VCC100X86.kmk 2895 2016-09-08 13:28:37Z bird $
## @file
# kBuild Tool Config - Visual C++ 10.0 (aka Visual 2010 and MSC v16), targeting x86.
#
@@ -75,7 +75,7 @@ TOOL_VCC100X86_RC ?= $(EXEC_X86_WIN32) $(call TOOL_VCC100_FN_FIND_SDK_TOOL,rc.e
TOOL_VCC100X86_MT ?= $(EXEC_X86_WIN32) $(call TOOL_VCC100_FN_FIND_SDK_TOOL,mt.exe,[Mm][Tt].[Ee][Xx][Ee],TOOL_VCC100_MT_CACHED)
ifdef TOOL_VCC100X86_USE_KSUBMIT
ifeq ($(KBUILD_HOST),win)
- TOOL_VCC100X86_KSUBMIT ?= kmk_builtin_kSubmit --32-bit --
+ TOOL_VCC100X86_KSUBMIT ?= kmk_builtin_kSubmit --32-bit
endif
endif
@@ -168,8 +168,19 @@ endef
else # !KBUILD_USE_KOBJCACHE
TOOL_VCC100X86_COMPILE_C_OUTPUT = $(call TOOL_VCC100X86_PDB, $(outbase)-obj,idb)
TOOL_VCC100X86_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC100X86_PDB, $(outbase)-obj,pdb)
+ ifdef TOOL_VCC100X86_KSUBMIT
define TOOL_VCC100X86_COMPILE_C_CMDS
- $(QUIET)$(TOOL_VCC100X86_KSUBMIT) $(TOOL_VCC100X86_CC) -c\
+ $(QUIET)$(TOOL_VCC100X86_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC100X86_CC) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -FD\
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+endef
+ else
+define TOOL_VCC100X86_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC100X86_CC) -c\
$(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
-Fd$(outbase)-obj.pdb \
-FD\
@@ -177,6 +188,7 @@ define TOOL_VCC100X86_COMPILE_C_CMDS
$(subst /,\\,$(abspath $(source)))
$(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC100X86_PDB,$(outbase)-obj,idb)
endef
+ endif # !TOOL_VCC100X86_KSUBMIT
endif # !KBUILD_USE_KOBJCACHE
@@ -216,8 +228,19 @@ endef
else # !KBUILD_USE_KOBJCACHE
TOOL_VCC100X86_COMPILE_CXX_OUTPUT = $(call TOOL_VCC100X86_PDB, $(outbase)-obj,idb)
TOOL_VCC100X86_COMPILE_CXX_OUTPUT_MAYBE = $(call TOOL_VCC100X86_PDB, $(outbase)-obj,pdb)
+ ifdef TOOL_VCC100X86_KSUBMIT
+define TOOL_VCC100X86_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC100X86_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC100X86_CXX) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -FD\
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+endef
+ else
define TOOL_VCC100X86_COMPILE_CXX_CMDS
- $(QUIET)$(TOOL_VCC100X86_KSUBMIT) $(TOOL_VCC100X86_CXX) -c\
+ $(QUIET)$(TOOL_VCC100X86_CXX) -c\
$(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
-Fd$(outbase)-obj.pdb \
-FD\
@@ -225,6 +248,7 @@ define TOOL_VCC100X86_COMPILE_CXX_CMDS
$(subst /,\\,$(abspath $(source)))
$(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC100X86_PDB,$(outbase)-obj,idb)
endef
+ endif # !TOOL_VCC100X86_KSUBMIT
endif # !KBUILD_USE_KOBJCACHE
## @todo configure the assembler template.
diff --git a/kBuild/tools/YASM.kmk b/kBuild/tools/YASM.kmk
index ed06adb..8942978 100644
--- a/kBuild/tools/YASM.kmk
+++ b/kBuild/tools/YASM.kmk
@@ -1,4 +1,4 @@
-# $Id: YASM.kmk 2873 2016-09-04 19:13:12Z bird $
+# $Id: YASM.kmk 2891 2016-09-08 03:02:58Z bird $
## @file
# kBuild Tool Config - YASM 0.4.0 or later.
#
@@ -78,11 +78,20 @@ TOOL_YASM_COMPILE_AS_OUTPUT_MAYBE = $(obj).map
TOOL_YASM_COMPILE_AS_DEPEND =
TOOL_YASM_COMPILE_AS_DEPORD =
define TOOL_YASM_COMPILE_AS_CMDS
+ifdef TOOL_YASM_KSUBMIT # yasm 1.3.0 w/ patches.
$(QUIET)$(TOOL_YASM_KSUBMIT) $(TOOL_YASM_AS)\
$(patsubst --mapfile%,--mapfile=$(obj).map,$(flags))\
$(addsuffix /,$(addprefix -I, $(incs))) $(addprefix -D, $(defs))\
-l $(outbase).lst\
-o $(obj)\
+ -MD="$(dep)" -MP --makedep-dos2unix-slash\
+ $(abspath $(source))
+else
+ $(QUIET)$(TOOL_YASM_AS)\
+ $(patsubst --mapfile%,--mapfile=$(obj).map,$(flags))\
+ $(addsuffix /,$(addprefix -I, $(incs))) $(addprefix -D, $(defs))\
+ -l $(outbase).lst\
+ -o $(obj)\
$(abspath $(source))
$(QUIET)$(REDIRECT) -wo $(dep) -- $(TOOL_YASM_AS) -DKBUILD_GENERATING_MAKEFILE_DEPENDENCIES\
$(patsubst --mapfile%,--mapfile=$(obj).map,$(flags))\
@@ -105,5 +114,6 @@ define TOOL_YASM_COMPILE_AS_CMDS
--append "$(dep).tmp"\
"$(dep)"
$(QUIET)$(MV) -f -- "$(dep).tmp" "$(dep)"
+endif
endef
diff --git a/src/kWorker/Makefile.kmk b/src/kWorker/Makefile.kmk
index 4f362f5..2016bb8 100644
--- a/src/kWorker/Makefile.kmk
+++ b/src/kWorker/Makefile.kmk
@@ -1,4 +1,4 @@
-# $Id: Makefile.kmk 2878 2016-09-05 19:54:49Z bird $
+# $Id: Makefile.kmk 2894 2016-09-08 13:27:56Z bird $
## @file
# Sub-makefile for kWorker.
#
@@ -32,7 +32,12 @@ PROGRAMS += kWorker
kWorker_TEMPLATE = BIN-STATIC-THREADED
kWorker_DEFS.debug = K_STRICT
kWorker_DEFS.release = NASSERT
-kWorker_SOURCES = kWorker.c
+kWorker_SOURCES = \
+ kWorker.c \
+ ../kmk/kmkbuiltin/kDepObj.c
+kWorker_INCS = \
+ ../kmk/ \
+ ../kmk/kmkbuiltin
kWorker_LIBS = \
$(kStuff_1_TARGET) \
$(kWorkerLib_1_TARGET)
@@ -55,9 +60,11 @@ kWorkerLib_DEFPATH := $(PATH_SUB_CURRENT)/../lib
kWorkerLib_SOURCES = \
crc32.c \
md5.c \
- kbuild_version.c
+ kbuild_version.c \
+ kDep.c
kWorkerLib_SOURCES.win = \
nt_fullpath.c \
+ nt_fullpath_cached.c \
quoted_spawn.c \
nt/nthlpcore.c \
nt/nthlpfs.c \
diff --git a/src/kWorker/kWorker.c b/src/kWorker/kWorker.c
index fb46d62..d4add04 100644
--- a/src/kWorker/kWorker.c
+++ b/src/kWorker/kWorker.c
@@ -1,4 +1,4 @@
-/* $Id: kWorker.c 2888 2016-09-06 15:02:20Z bird $ */
+/* $Id: kWorker.c 2898 2016-09-08 15:38:50Z bird $ */
/** @file
* kWorker - experimental process reuse worker for Windows.
*
@@ -53,6 +53,8 @@ extern void nt_fullpath(const char *pszPath, char *pszFull, size_t cchFull);
#include "quote_argv.h"
#include "md5.h"
+#include "../kmk/kmkbuiltin.h"
+
/*********************************************************************************************************************************
* Defined Constants And Macros *
@@ -2526,6 +2528,14 @@ static void __cdecl kwSandbox_msvcrt_terminate(void)
}
+/** Kernel32 - SetConsoleCtrlHandler(). */
+static BOOL WINAPI kwSandbox_Kernel32_SetConsoleCtrlHandler(PHANDLER_ROUTINE pfnHandler, BOOL fAdd)
+{
+ KW_LOG(("SetConsoleCtrlHandler(%p, %d) - ignoring\n"));
+ return TRUE;
+}
+
+
/** The CRT internal __getmainargs() API. */
static int __cdecl kwSandbox_msvcrt___getmainargs(int *pargc, char ***pargv, char ***penvp,
int dowildcard, int const *piNewMode)
@@ -4179,7 +4189,6 @@ static KBOOL kwFsIsCachableExtensionA(const char *pszExt, KBOOL fAttrQuery)
&& (chThird == 'x' || chThird == 'X')
&& pszExt[3] == '\0')
return K_TRUE;
-
}
/* Misc starting with i. */
else if (chFirst == 'i' || chFirst == 'I')
@@ -4203,6 +4212,18 @@ static KBOOL kwFsIsCachableExtensionA(const char *pszExt, KBOOL fAttrQuery)
}
}
}
+ /* Assembly header: .mac */
+ else if (chFirst == 'm' || chFirst == 'M')
+ {
+ char const chSecond = pszExt[1];
+ if (chSecond == 'a' || chSecond == 'A')
+ {
+ char const chThird = pszExt[2];
+ if ( (chThird == 'c' || chThird == 'C')
+ && pszExt[3] == '\0')
+ return K_TRUE;
+ }
+ }
else if (fAttrQuery)
{
/* Dynamic link library: .dll */
@@ -4465,6 +4486,20 @@ static HANDLE WINAPI kwSandbox_Kernel32_CreateFileA(LPCSTR pszFilename, DWORD dw
return hFile;
}
}
+ /* These are for nasm and yasm header searching. Cache will already
+ have checked the directories for the file, no need to call
+ CreateFile to do it again. */
+ else if (enmError == KFSLOOKUPERROR_NOT_FOUND)
+ {
+ KWFS_LOG(("CreateFileA(%s) -> INVALID_HANDLE_VALUE, ERROR_FILE_NOT_FOUND\n", pszFilename));
+ return INVALID_HANDLE_VALUE;
+ }
+ else if ( enmError == KFSLOOKUPERROR_PATH_COMP_NOT_FOUND
+ || enmError == KFSLOOKUPERROR_PATH_COMP_NOT_DIR)
+ {
+ KWFS_LOG(("CreateFileA(%s) -> INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND\n", pszFilename));
+ return INVALID_HANDLE_VALUE;
+ }
/* fallback */
hFile = CreateFileA(pszFilename, dwDesiredAccess, dwShareMode, pSecAttrs,
@@ -6097,6 +6132,8 @@ KWREPLACEMENTFUNCTION const g_aSandboxReplacements[] =
{ TUPLE("FlsAlloc"), NULL, (KUPTR)kwSandbox_Kernel32_FlsAlloc },
{ TUPLE("FlsFree"), NULL, (KUPTR)kwSandbox_Kernel32_FlsFree },
+ { TUPLE("SetConsoleCtrlHandler"), NULL, (KUPTR)kwSandbox_Kernel32_SetConsoleCtrlHandler },
+
#ifdef WITH_HASH_MD5_CACHE
{ TUPLE("CryptCreateHash"), NULL, (KUPTR)kwSandbox_Advapi32_CryptCreateHash },
{ TUPLE("CryptHashData"), NULL, (KUPTR)kwSandbox_Advapi32_CryptHashData },
@@ -6201,6 +6238,7 @@ KWREPLACEMENTFUNCTION const g_aSandboxNativeReplacements[] =
#ifdef WITH_TEMP_MEMORY_FILES
{ TUPLE("DeleteFileW"), NULL, (KUPTR)kwSandbox_Kernel32_DeleteFileW },
#endif
+ { TUPLE("SetConsoleCtrlHandler"), NULL, (KUPTR)kwSandbox_Kernel32_SetConsoleCtrlHandler },
#ifdef WITH_HASH_MD5_CACHE
{ TUPLE("CryptCreateHash"), NULL, (KUPTR)kwSandbox_Advapi32_CryptCreateHash },
@@ -6211,6 +6249,7 @@ KWREPLACEMENTFUNCTION const g_aSandboxNativeReplacements[] =
{ TUPLE("RtlPcToFileHeader"), NULL, (KUPTR)kwSandbox_ntdll_RtlPcToFileHeader },
+
/*
* MS Visual C++ CRTs.
*/
@@ -6231,6 +6270,49 @@ KU32 const g_cSandboxNativeReplacements = K_ELEMENTS(g_aSandbox
/**
+ * Control handler.
+ *
+ * @returns TRUE if handled, FALSE if not.
+ * @param dwCtrlType The signal.
+ */
+static BOOL WINAPI kwSandboxCtrlHandler(DWORD dwCtrlType)
+{
+ switch (dwCtrlType)
+ {
+ case CTRL_C_EVENT:
+ fprintf(stderr, "kWorker: Ctrl-C\n");
+ exit(9);
+ break;
+
+ case CTRL_BREAK_EVENT:
+ fprintf(stderr, "kWorker: Ctrl-Break\n");
+ exit(10);
+ break;
+
+ case CTRL_CLOSE_EVENT:
+ fprintf(stderr, "kWorker: console closed\n");
+ exit(11);
+ break;
+
+ case CTRL_LOGOFF_EVENT:
+ fprintf(stderr, "kWorker: logoff event\n");
+ exit(11);
+ break;
+
+ case CTRL_SHUTDOWN_EVENT:
+ fprintf(stderr, "kWorker: shutdown event\n");
+ exit(11);
+ break;
+
+ default:
+ fprintf(stderr, "kwSandboxCtrlHandler: %#x\n", dwCtrlType);
+ break;
+ }
+ return TRUE;
+}
+
+
+/**
* Used by kwSandboxExec to reset the state of the module tree.
*
* This is done recursively.
@@ -6813,20 +6895,47 @@ static int kwSandboxExec(PKWSANDBOX pSandbox, PKWTOOL pTool, KU32 cArgs, const c
/**
+ * Does the post command part of a job (optional).
+ *
+ * @returns The exit code of the job.
+ * @param cPostCmdArgs Number of post command arguments (includes cmd).
+ * @param papszPostCmdArgs The post command and its argument.
+ */
+static int kSubmitHandleJobPostCmd(KU32 cPostCmdArgs, const char **papszPostCmdArgs)
+{
+ const char *pszCmd = papszPostCmdArgs[0];
+
+ /* Allow the kmk builtin prefix. */
+ static const char s_szKmkBuiltinPrefix[] = "kmk_builtin_";
+ if (kHlpStrNComp(pszCmd, s_szKmkBuiltinPrefix, sizeof(s_szKmkBuiltinPrefix) - 1) == 0)
+ pszCmd += sizeof(s_szKmkBuiltinPrefix) - 1;
+
+ /* Command switch. */
+ if (kHlpStrComp(pszCmd, "kDepObj") == 0)
+ return kmk_builtin_kDepObj(cPostCmdArgs, (char **)papszPostCmdArgs, NULL);
+
+ return kwErrPrintfRc(42 + 5 , "Unknown post command: '%s'\n", pszCmd);
+}
+
+
+/**
* Part 2 of the "JOB" command handler.
*
* @returns The exit code of the job.
- * @param pszExecutable The executable to execute.
- * @param pszCwd The current working directory of the job.
- * @param cArgs The number of arguments.
- * @param papszArgs The argument vector.
+ * @param pszExecutable The executable to execute.
+ * @param pszCwd The current working directory of the job.
+ * @param cArgs The number of arguments.
+ * @param papszArgs The argument vector.
* @param fWatcomBrainDamange Whether to apply watcom rules while quoting.
- * @param cEnvVars The number of environment variables.
- * @param papszEnvVars The enviornment vector.
+ * @param cEnvVars The number of environment variables.
+ * @param papszEnvVars The enviornment vector.
+ * @param cPostCmdArgs Number of post command arguments (includes cmd).
+ * @param papszPostCmdArgs The post command and its argument.
*/
static int kSubmitHandleJobUnpacked(const char *pszExecutable, const char *pszCwd,
KU32 cArgs, const char **papszArgs, KBOOL fWatcomBrainDamange,
- KU32 cEnvVars, const char **papszEnvVars)
+ KU32 cEnvVars, const char **papszEnvVars,
+ KU32 cPostCmdArgs, const char **papszPostCmdArgs)
{
int rcExit;
PKWTOOL pTool;
@@ -6891,6 +7000,12 @@ static int kSubmitHandleJobUnpacked(const char *pszExecutable, const char *pszCw
g_fRestart = K_TRUE;
break;
}
+
+ /*
+ * Do the post command, if present.
+ */
+ if (cPostCmdArgs && rcExit == 0)
+ rcExit = kSubmitHandleJobPostCmd(cPostCmdArgs, papszPostCmdArgs);
}
else
rcExit = 42 + 1;
@@ -6982,7 +7097,6 @@ static int kSubmitHandleJob(const char *pszMsg, KSIZE cbMsg)
char const **papszEnvVars = kHlpAlloc((cEnvVars + 1) * sizeof(papszEnvVars[0]));
if (papszEnvVars)
{
- KU32 i;
for (i = 0; i < cEnvVars; i++)
{
papszEnvVars[i] = pszMsg;
@@ -6997,21 +7111,60 @@ static int kSubmitHandleJob(const char *pszMsg, KSIZE cbMsg)
}
}
papszEnvVars[cEnvVars] = 0;
+
+ /* Flags (currently just watcom argument brain damanage). */
if (cbMsg >= sizeof(KU8))
{
KBOOL fWatcomBrainDamange = *pszMsg++;
cbMsg--;
- if (cbMsg == 0)
+
+ /* Post command argument count (can be zero). */
+ if (cbMsg >= sizeof(KU32))
{
- /*
- * The next step.
- */
- rcExit = kSubmitHandleJobUnpacked(pszExecutable, pszCwd,
- cArgs, papszArgs, fWatcomBrainDamange,
- cEnvVars, papszEnvVars);
+ KU32 cPostCmdArgs;
+ kHlpMemCopy(&cPostCmdArgs, pszMsg, sizeof(cPostCmdArgs));
+ pszMsg += sizeof(cPostCmdArgs);
+ cbMsg -= sizeof(cPostCmdArgs);
+
+ if (cPostCmdArgs >= 0 && cPostCmdArgs < 32)
+ {
+ char const *apszPostCmdArgs[32+1];
+ for (i = 0; i < cPostCmdArgs; i++)
+ {
+ apszPostCmdArgs[i] = pszMsg;
+ cbTmp = kHlpStrLen(pszMsg) + 1;
+ pszMsg += cbTmp;
+ if ( cbTmp < cbMsg
+ || (cbTmp == cbMsg && i + 1 == cPostCmdArgs))
+ cbMsg -= cbTmp;
+ else
+ {
+ cbMsg = KSIZE_MAX;
+ break;
+ }
+ }
+ if (cbMsg == 0)
+ {
+ apszPostCmdArgs[cPostCmdArgs] = NULL;
+
+ /*
+ * The next step.
+ */
+ rcExit = kSubmitHandleJobUnpacked(pszExecutable, pszCwd,
+ cArgs, papszArgs, fWatcomBrainDamange,
+ cEnvVars, papszEnvVars,
+ cPostCmdArgs, apszPostCmdArgs);
+ }
+ else if (cbMsg == KSIZE_MAX)
+ kwErrPrintf("Detected bogus message unpacking post command and its arguments!\n");
+ else
+ kwErrPrintf("Message has %u bytes unknown trailing bytes\n", cbMsg);
+ }
+ else
+ kwErrPrintf("Bogus post command argument count: %u %#x\n", cPostCmdArgs, cPostCmdArgs);
}
else
- kwErrPrintf("Message has %u bytes unknown trailing bytes\n", cbMsg);
+ kwErrPrintf("Detected bogus message looking for the post command argument count!\n");
}
else
kwErrPrintf("Detected bogus message unpacking environment variables!\n");
@@ -7200,7 +7353,8 @@ static int kwTestRun(int argc, char **argv)
{
rcExit = kSubmitHandleJobUnpacked(argv[i], pszCwd,
argc - i, &argv[i], fWatcomBrainDamange,
- cEnvVars, environ);
+ cEnvVars, environ,
+ 0, NULL);
KW_LOG(("rcExit=%d\n", rcExit));
kwSandboxCleanupLate(&g_Sandbox);
}
@@ -7223,6 +7377,12 @@ int main(int argc, char **argv)
#endif
/*
+ * Register our Control-C and Control-Break handlers.
+ */
+ if (!SetConsoleCtrlHandler(kwSandboxCtrlHandler, TRUE /*fAdd*/))
+ return kwErrPrintfRc(3, "SetConsoleCtrlHandler failed: %u\n", GetLastError());
+
+ /*
* Create the cache and mark the temporary directory as using the custom revision.
*/
g_pFsCache = kFsCacheCreate(KFSCACHE_F_MISSING_OBJECTS | KFSCACHE_F_MISSING_PATHS);
@@ -7434,7 +7594,9 @@ int main(int argc, char **argv)
// with: 1m15.165069s = 75.165069 s => 120.016388s - 75.165069s = 44.851319s => 44.85/120.02 = 37% speed up.
// r2884 building vbox/debug (r110512):
// without: 11m14.446609s = 674.446609 s
-// with: 9m01.017344s = 540.017344 s => 674.446609s - 540.017344s = 134.429265s => 134.43/674.45 = 20% speed up
+// with: 9m01.017344s = 541.017344 s => 674.446609s - 541.017344s = 133.429265 => 133.43/674.45 = 19% speed up
+// r2896 building vbox/debug (r110577):
+// with: 8m31.182384s = 511.182384 s => 674.446609s - 511.182384s = 163.264225 = 163.26/674.45 = 24% speed up
//
// Dell (W7/amd64, infected by mcafee):
// kmk 1: 285.278/1024 = 0x0 (0.278591796875)
diff --git a/src/kWorker/tst-1-c1xx-xcpt.cpp b/src/kWorker/tst-1-c1xx-xcpt.cpp
deleted file mode 100644
index 31540f1..0000000
--- a/src/kWorker/tst-1-c1xx-xcpt.cpp
+++ /dev/null
@@ -1,345 +0,0 @@
-/* $Id: tst-1-c1xx-xcpt.cpp 2865 2016-09-02 22:17:13Z bird $ */
-
-/*
- * kWorker testcase.
- *
- * This is a testcase sitched together from bits of iprt/cdefs.h,
- * iprt/assert.h and VBox/vmm/hm_vmx.h.
- *
- * It triggers an 0xc0000005 exception (#PF) via RT_BF_ASSERT_COMPILE_CHECKS,
- * guess this is due to deep preprocessor expansion nesting (around 32 levels).
- *
- * This doesn't work if we haven't got the exception handling right,
- * like the RtlAddFunctionTable and RtlDeleteFunctionTable calls.
- *
- */
-
-/* glue */
-#define UINT32_C(x) x##U
-#define UINT32_MAX 0xffffffffU
-
-
-/** @file
- * IPRT - Common C and C++ definitions.
- */
-
-/*
- * Copyright (C) 2006-2016 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * The contents of this file may alternatively be used under the terms
- * of the Common Development and Distribution License Version 1.0
- * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
- * VirtualBox OSE distribution, in which case the provisions of the
- * CDDL are applicable instead of those of the GPL.
- *
- * You may elect to license modified versions of this file under the
- * terms and conditions of either the GPL or the CDDL or both.
- */
-
-/** @def RT_EXPAND_2
- * Helper for RT_EXPAND. */
-#define RT_EXPAND_2(a_Expr) a_Expr
-/** @def RT_EXPAND
- * Returns the expanded expression.
- * @param a_Expr The expression to expand. */
-#define RT_EXPAND(a_Expr) RT_EXPAND_2(a_Expr)
-
-
-/** @def RT_UNPACK_CALL
- * Unpacks the an argument list inside an extra set of parenthesis and turns it
- * into a call to @a a_Fn.
- *
- * @param a_Fn Function/macro to call.
- * @param a_Args Parameter list in parenthesis.
- */
-#define RT_UNPACK_CALL(a_Fn, a_Args) a_Fn a_Args
-
-
-/** @def RT_UNPACK_ARGS
- * Returns the arguments without parenthesis.
- *
- * @param ... Parameter list in parenthesis.
- * @remarks Requires RT_COMPILER_SUPPORTS_VA_ARGS.
- */
-# define RT_UNPACK_ARGS(...) __VA_ARGS__
-
-/** @def RT_COUNT_VA_ARGS_HLP
- * Helper for RT_COUNT_VA_ARGS that picks out the argument count from
- * RT_COUNT_VA_ARGS_REV_SEQ. */
-#define RT_COUNT_VA_ARGS_HLP( \
- c69, c68, c67, c66, c65, c64, c63, c62, c61, c60, \
- c59, c58, c57, c56, c55, c54, c53, c52, c51, c50, \
- c49, c48, c47, c46, c45, c44, c43, c42, c41, c40, \
- c39, c38, c37, c36, c35, c34, c33, c32, c31, c30, \
- c29, c28, c27, c26, c25, c24, c23, c22, c21, c20, \
- c19, c18, c17, c16, c15, c14, c13, c12, c11, c10, \
- c9, c8, c7, c6, c5, c4, c3, c2, c1, cArgs, ...) cArgs
-/** Argument count sequence. */
-#define RT_COUNT_VA_ARGS_REV_SEQ \
- 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, \
- 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, \
- 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, \
- 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, \
- 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, \
- 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, \
- 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
-/** This is for zero arguments. At least Visual C++ requires it. */
-#define RT_COUNT_VA_ARGS_PREFIX_RT_NOTHING RT_COUNT_VA_ARGS_REV_SEQ
-/**
- * Counts the number of arguments given to the variadic macro.
- *
- * Max is 69.
- *
- * @returns Number of arguments in the ellipsis
- * @param ... Arguments to count.
- * @remarks Requires RT_COMPILER_SUPPORTS_VA_ARGS.
- */
-#define RT_COUNT_VA_ARGS(...) \
- RT_UNPACK_CALL(RT_COUNT_VA_ARGS_HLP, (RT_COUNT_VA_ARGS_PREFIX_ ## __VA_ARGS__ ## RT_NOTHING, \
- RT_COUNT_VA_ARGS_REV_SEQ))
-/** @def RT_CONCAT
- * Concatenate the expanded arguments without any extra spaces in between.
- *
- * @param a The first part.
- * @param b The second part.
- */
-#define RT_CONCAT(a,b) RT_CONCAT_HLP(a,b)
-/** RT_CONCAT helper, don't use. */
-#define RT_CONCAT_HLP(a,b) a##b
-
-/** @def RT_CONCAT3
- * Concatenate the expanded arguments without any extra spaces in between.
- *
- * @param a The 1st part.
- * @param b The 2nd part.
- * @param c The 3rd part.
- */
-#define RT_CONCAT3(a,b,c) RT_CONCAT3_HLP(a,b,c)
-/** RT_CONCAT3 helper, don't use. */
-#define RT_CONCAT3_HLP(a,b,c) a##b##c
-
-/** Bit field compile time check helper
- * @internal */
-#define RT_BF_CHECK_DO_XOR_MASK(a_uLeft, a_RightPrefix, a_FieldNm) ((a_uLeft) ^ RT_CONCAT3(a_RightPrefix, a_FieldNm, _MASK))
-/** Bit field compile time check helper
- * @internal */
-#define RT_BF_CHECK_DO_OR_MASK(a_uLeft, a_RightPrefix, a_FieldNm) ((a_uLeft) | RT_CONCAT3(a_RightPrefix, a_FieldNm, _MASK))
-/** Bit field compile time check helper
- * @internal */
-#define RT_BF_CHECK_DO_1ST_MASK_BIT(a_uLeft, a_RightPrefix, a_FieldNm) \
- ((a_uLeft) && ( (RT_CONCAT3(a_RightPrefix, a_FieldNm, _MASK) >> RT_CONCAT3(a_RightPrefix, a_FieldNm, _SHIFT)) & 1U ) )
-/** Used to check that a bit field mask does not start too early.
- * @internal */
-#define RT_BF_CHECK_DO_MASK_START(a_uLeft, a_RightPrefix, a_FieldNm) \
- ( (a_uLeft) \
- && ( RT_CONCAT3(a_RightPrefix, a_FieldNm, _SHIFT) == 0 \
- || ( ( ( ((RT_CONCAT3(a_RightPrefix, a_FieldNm, _MASK) >> RT_CONCAT3(a_RightPrefix, a_FieldNm, _SHIFT)) & 1U) \
- << RT_CONCAT3(a_RightPrefix, a_FieldNm, _SHIFT)) /* => single bit mask, correct type */ \
- - 1U) /* => mask of all bits below the field */ \
- & RT_CONCAT3(a_RightPrefix, a_FieldNm, _MASK)) == 0 ) )
-/** @name Bit field compile time check recursion workers.
- * @internal
- * @{ */
-#define RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix, f1) \
- a_DoThis(a_uLeft, a_RightPrefix, f1)
-#define RT_BF_CHECK_DO_2(a_DoThis, a_uLeft, a_RightPrefix, f1, f2) \
- RT_BF_CHECK_DO_1(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2)
-#define RT_BF_CHECK_DO_3(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3) \
- RT_BF_CHECK_DO_2(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3)
-#define RT_BF_CHECK_DO_4(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4) \
- RT_BF_CHECK_DO_3(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4)
-#define RT_BF_CHECK_DO_5(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5) \
- RT_BF_CHECK_DO_4(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5)
-#define RT_BF_CHECK_DO_6(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6) \
- RT_BF_CHECK_DO_5(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6)
-#define RT_BF_CHECK_DO_7(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7) \
- RT_BF_CHECK_DO_6(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7)
-#define RT_BF_CHECK_DO_8(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8) \
- RT_BF_CHECK_DO_7(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8)
-#define RT_BF_CHECK_DO_9(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9) \
- RT_BF_CHECK_DO_8(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9)
-#define RT_BF_CHECK_DO_10(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10) \
- RT_BF_CHECK_DO_9(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10)
-#define RT_BF_CHECK_DO_11(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11) \
- RT_BF_CHECK_DO_10(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11)
-#define RT_BF_CHECK_DO_12(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12) \
- RT_BF_CHECK_DO_11(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12)
-#define RT_BF_CHECK_DO_13(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13) \
- RT_BF_CHECK_DO_12(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13)
-#define RT_BF_CHECK_DO_14(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14) \
- RT_BF_CHECK_DO_13(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14)
-#define RT_BF_CHECK_DO_15(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15) \
- RT_BF_CHECK_DO_14(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15)
-#define RT_BF_CHECK_DO_16(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16) \
- RT_BF_CHECK_DO_15(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16)
-#define RT_BF_CHECK_DO_17(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17) \
- RT_BF_CHECK_DO_16(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17)
-#define RT_BF_CHECK_DO_18(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18) \
- RT_BF_CHECK_DO_17(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18)
-#define RT_BF_CHECK_DO_19(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19) \
- RT_BF_CHECK_DO_18(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19)
-#define RT_BF_CHECK_DO_20(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20) \
- RT_BF_CHECK_DO_19(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20)
-#define RT_BF_CHECK_DO_21(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21) \
- RT_BF_CHECK_DO_20(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21)
-#define RT_BF_CHECK_DO_22(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22) \
- RT_BF_CHECK_DO_21(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22)
-#define RT_BF_CHECK_DO_23(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23) \
- RT_BF_CHECK_DO_22(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23)
-#define RT_BF_CHECK_DO_24(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24) \
- RT_BF_CHECK_DO_23(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24)
-#define RT_BF_CHECK_DO_25(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25) \
- RT_BF_CHECK_DO_24(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25)
-#define RT_BF_CHECK_DO_26(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26) \
- RT_BF_CHECK_DO_25(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26)
-#define RT_BF_CHECK_DO_27(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27) \
- RT_BF_CHECK_DO_26(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27)
-#define RT_BF_CHECK_DO_28(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28) \
- RT_BF_CHECK_DO_27(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28)
-#define RT_BF_CHECK_DO_29(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29) \
- RT_BF_CHECK_DO_28(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29)
-#define RT_BF_CHECK_DO_30(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30) \
- RT_BF_CHECK_DO_29(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30)
-#define RT_BF_CHECK_DO_31(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31) \
- RT_BF_CHECK_DO_30(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31)
-#define RT_BF_CHECK_DO_32(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32) \
- RT_BF_CHECK_DO_31(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32)
-#define RT_BF_CHECK_DO_33(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33) \
- RT_BF_CHECK_DO_32(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33)
-/** @} */
-
-/** @def RT_BF_ASSERT_COMPILE_CHECKS
- * Emits a series of AssertCompile statements checking that the bit-field
- * declarations doesn't overlap, has holes, and generally makes some sense.
- *
- * This requires variadic macros because its too much to type otherwise.
- */
-#define RT_BF_ASSERT_COMPILE_CHECKS(a_Prefix, a_uZero, a_uCovered, a_Fields) \
- AssertCompile(RT_BF_CHECK_DO_N(RT_BF_CHECK_DO_OR_MASK, a_uZero, a_Prefix, RT_UNPACK_ARGS a_Fields ) == a_uCovered); \
- AssertCompile(RT_BF_CHECK_DO_N(RT_BF_CHECK_DO_XOR_MASK, a_uCovered, a_Prefix, RT_UNPACK_ARGS a_Fields ) == 0); \
- AssertCompile(RT_BF_CHECK_DO_N(RT_BF_CHECK_DO_1ST_MASK_BIT, true, a_Prefix, RT_UNPACK_ARGS a_Fields ) == true); \
- AssertCompile(RT_BF_CHECK_DO_N(RT_BF_CHECK_DO_MASK_START, true, a_Prefix, RT_UNPACK_ARGS a_Fields ) == true)
-/** Bit field compile time check helper
- * @internal */
-#define RT_BF_CHECK_DO_N(a_DoThis, a_uLeft, a_RightPrefix, ...) \
- RT_UNPACK_CALL(RT_CONCAT(RT_BF_CHECK_DO_, RT_EXPAND(RT_COUNT_VA_ARGS(__VA_ARGS__))), (a_DoThis, a_uLeft, a_RightPrefix, __VA_ARGS__))
-
-
-/** @file
- * IPRT - Assertions.
- */
-
-/*
- * Copyright (C) 2006-2016 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * The contents of this file may alternatively be used under the terms
- * of the Common Development and Distribution License Version 1.0
- * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
- * VirtualBox OSE distribution, in which case the provisions of the
- * CDDL are applicable instead of those of the GPL.
- *
- * You may elect to license modified versions of this file under the
- * terms and conditions of either the GPL or the CDDL or both.
- */
-
-/** @def AssertCompile
- * Asserts that a C++0x compile-time expression is true. If it's not break the
- * build.
- * @param expr Expression which should be true.
- */
-#define AssertCompile(expr) static_assert(!!(expr), #expr)
-
-
-
-
-/** @file
- * HM - VMX Structures and Definitions. (VMM)
- */
-
-/*
- * Copyright (C) 2006-2016 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * The contents of this file may alternatively be used under the terms
- * of the Common Development and Distribution License Version 1.0
- * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
- * VirtualBox OSE distribution, in which case the provisions of the
- * CDDL are applicable instead of those of the GPL.
- *
- * You may elect to license modified versions of this file under the
- * terms and conditions of either the GPL or the CDDL or both.
- */
-
-/** Address calculation scaling field (powers of two). */
-#define VMX_XDTR_INSINFO_SCALE_SHIFT 0
-#define VMX_XDTR_INSINFO_SCALE_MASK UINT32_C(0x00000003)
-/** Bits 2 thru 6 are undefined. */
-#define VMX_XDTR_INSINFO_UNDEF_2_6_SHIFT 2
-#define VMX_XDTR_INSINFO_UNDEF_2_6_MASK UINT32_C(0x0000007c)
-/** Address size, only 0(=16), 1(=32) and 2(=64) are defined.
- * @remarks anyone's guess why this is a 3 bit field... */
-#define VMX_XDTR_INSINFO_ADDR_SIZE_SHIFT 7
-#define VMX_XDTR_INSINFO_ADDR_SIZE_MASK UINT32_C(0x00000380)
-/** Bit 10 is defined as zero. */
-#define VMX_XDTR_INSINFO_ZERO_10_SHIFT 10
-#define VMX_XDTR_INSINFO_ZERO_10_MASK UINT32_C(0x00000400)
-/** Operand size, either (1=)32-bit or (0=)16-bit, but get this, it's undefined
- * for exits from 64-bit code as the operand size there is fixed. */
-#define VMX_XDTR_INSINFO_OP_SIZE_SHIFT 11
-#define VMX_XDTR_INSINFO_OP_SIZE_MASK UINT32_C(0x00000800)
-/** Bits 12 thru 14 are undefined. */
-#define VMX_XDTR_INSINFO_UNDEF_12_14_SHIFT 12
-#define VMX_XDTR_INSINFO_UNDEF_12_14_MASK UINT32_C(0x00007000)
-/** Applicable segment register (X86_SREG_XXX values). */
-#define VMX_XDTR_INSINFO_SREG_SHIFT 15
-#define VMX_XDTR_INSINFO_SREG_MASK UINT32_C(0x00038000)
-/** Index register (X86_GREG_XXX values). Undefined if HAS_INDEX_REG is clear. */
-#define VMX_XDTR_INSINFO_INDEX_REG_SHIFT 18
-#define VMX_XDTR_INSINFO_INDEX_REG_MASK UINT32_C(0x003c0000)
-/** Is VMX_XDTR_INSINFO_INDEX_REG_XXX valid (=1) or not (=0). */
-#define VMX_XDTR_INSINFO_HAS_INDEX_REG_SHIFT 22
-#define VMX_XDTR_INSINFO_HAS_INDEX_REG_MASK UINT32_C(0x00400000)
-/** Base register (X86_GREG_XXX values). Undefined if HAS_BASE_REG is clear. */
-#define VMX_XDTR_INSINFO_BASE_REG_SHIFT 23
-#define VMX_XDTR_INSINFO_BASE_REG_MASK UINT32_C(0x07800000)
-/** Is VMX_XDTR_INSINFO_BASE_REG_XXX valid (=1) or not (=0). */
-#define VMX_XDTR_INSINFO_HAS_BASE_REG_SHIFT 27
-#define VMX_XDTR_INSINFO_HAS_BASE_REG_MASK UINT32_C(0x08000000)
-/** The instruction identity (VMX_XDTR_INSINFO_II_XXX values) */
-#define VMX_XDTR_INSINFO_INSTR_ID_SHIFT 28
-#define VMX_XDTR_INSINFO_INSTR_ID_MASK UINT32_C(0x30000000)
-#define VMX_XDTR_INSINFO_II_SGDT 0 /**< Instruction ID: SGDT */
-#define VMX_XDTR_INSINFO_II_SIDT 1 /**< Instruction ID: SIDT */
-#define VMX_XDTR_INSINFO_II_LGDT 2 /**< Instruction ID: LGDT */
-#define VMX_XDTR_INSINFO_II_LIDT 3 /**< Instruction ID: LIDT */
-/** Bits 30 & 31 are undefined. */
-#define VMX_XDTR_INSINFO_UNDEF_30_31_SHIFT 30
-#define VMX_XDTR_INSINFO_UNDEF_30_31_MASK UINT32_C(0xc0000000)
-RT_BF_ASSERT_COMPILE_CHECKS(VMX_XDTR_INSINFO_, UINT32_C(0), UINT32_MAX,
- (SCALE, UNDEF_2_6, ADDR_SIZE, ZERO_10, OP_SIZE, UNDEF_12_14, SREG, INDEX_REG, HAS_INDEX_REG,
- BASE_REG, HAS_BASE_REG, INSTR_ID, UNDEF_30_31));
-
-
diff --git a/src/kmk/kmkbuiltin/kDepObj.c b/src/kmk/kmkbuiltin/kDepObj.c
index 910ee5f..96076c0 100644
--- a/src/kmk/kmkbuiltin/kDepObj.c
+++ b/src/kmk/kmkbuiltin/kDepObj.c
@@ -1,4 +1,4 @@
-/* $Id: kDepObj.c 2856 2016-09-01 02:42:08Z bird $ */
+/* $Id: kDepObj.c 2896 2016-09-08 15:32:09Z bird $ */
/** @file
* kDepObj - Extract dependency information from an object file.
*/
@@ -27,7 +27,6 @@
* Header Files *
*******************************************************************************/
#define MSCFAKES_NO_WINDOWS_H
-#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
@@ -35,9 +34,6 @@
#include <errno.h>
#include <ctype.h>
#include <stdarg.h>
-#ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-#endif
#if !defined(_MSC_VER)
# include <unistd.h>
#else
@@ -53,8 +49,7 @@
/*******************************************************************************
* Defined Constants And Macros *
*******************************************************************************/
-/*#define DEBUG*/
-#ifdef DEBUG
+#if 0
# define dprintf(a) printf a
# define dump(pb, cb, offBase) depHexDump(pb,cb,offBase)
#else
@@ -575,7 +570,7 @@ KBOOL kDepObjOMFTest(const KU8 *pbFile, KSIZE cbFile)
* @param pbSyms Pointer to the start of the symbol section.
* @param cbSyms Size of the symbol section.
*/
-int kDepObjCOFFParseCV8SymbolSection(const KU8 *pbSyms, KSIZE cbSyms)
+int kDepObjCOFFParseCV8SymbolSection(const KU8 *pbSyms, KU32 cbSyms)
{
char const * pchStrTab = NULL;
KU32 cbStrTab = 0;
@@ -756,15 +751,29 @@ int kDepObjCOFFParseCV8SymbolSection(const KU8 *pbSyms, KSIZE cbSyms)
*/
int kDepObjCOFFParse(const KU8 *pbFile, KSIZE cbFile)
{
- IMAGE_FILE_HEADER const *pFileHdr = (IMAGE_FILE_HEADER const *)pbFile;
- IMAGE_SECTION_HEADER const *paSHdrs = (IMAGE_SECTION_HEADER const *)((KU8 const *)(pFileHdr + 1) + pFileHdr->SizeOfOptionalHeader);
- unsigned cSHdrs = pFileHdr->NumberOfSections;
- unsigned iSHdr;
- KPCUINT u;
- int rcRet = 2;
- int rc;
+ IMAGE_FILE_HEADER const *pFileHdr = (IMAGE_FILE_HEADER const *)pbFile;
+ ANON_OBJECT_HEADER_BIGOBJ const *pBigObjHdr = (ANON_OBJECT_HEADER_BIGOBJ const *)pbFile;
+ IMAGE_SECTION_HEADER const *paSHdrs;
+ KU32 cSHdrs;
+ unsigned iSHdr;
+ KPCUINT u;
+ int rcRet = 2;
+ int rc;
+
+ if ( pBigObjHdr->Sig1 == 0
+ && pBigObjHdr->Sig2 == KU16_MAX)
+ {
+ paSHdrs = (IMAGE_SECTION_HEADER const *)(pBigObjHdr + 1);
+ cSHdrs = pBigObjHdr->NumberOfSections;
+ }
+ else
+ {
+ paSHdrs = (IMAGE_SECTION_HEADER const *)((KU8 const *)(pFileHdr + 1) + pFileHdr->SizeOfOptionalHeader);
+ cSHdrs = pFileHdr->NumberOfSections;
+ }
- printf("COFF file!\n");
+
+ dprintf(("COFF file!\n"));
for (iSHdr = 0; iSHdr < cSHdrs; iSHdr++)
{
@@ -783,7 +792,7 @@ int kDepObjCOFFParse(const KU8 *pbFile, KSIZE cbFile)
if (rcRet != 2)
return rc;
}
- printf("#%d: %.8s\n", iSHdr, paSHdrs[iSHdr].Name);
+ dprintf(("#%d: %.8s\n", iSHdr, paSHdrs[iSHdr].Name));
}
return rcRet;
}
@@ -799,60 +808,127 @@ int kDepObjCOFFParse(const KU8 *pbFile, KSIZE cbFile)
*/
KBOOL kDepObjCOFFTest(const KU8 *pbFile, KSIZE cbFile)
{
- IMAGE_FILE_HEADER const *pFileHdr = (IMAGE_FILE_HEADER const *)pbFile;
- IMAGE_SECTION_HEADER const *paSHdrs = (IMAGE_SECTION_HEADER const *)((KU8 const *)(pFileHdr + 1) + pFileHdr->SizeOfOptionalHeader);
- unsigned cSHdrs = pFileHdr->NumberOfSections;
- unsigned iSHdr;
- KSIZE cbHdrs = (const KU8 *)&paSHdrs[cSHdrs] - (const KU8 *)pbFile;
+ IMAGE_FILE_HEADER const *pFileHdr = (IMAGE_FILE_HEADER const *)pbFile;
+ ANON_OBJECT_HEADER_BIGOBJ const *pBigObjHdr = (ANON_OBJECT_HEADER_BIGOBJ const *)pbFile;
+ IMAGE_SECTION_HEADER const *paSHdrs;
+ KU32 cSHdrs;
+ KU32 iSHdr;
+ KSIZE cbHdrs;
if (cbFile <= sizeof(*pFileHdr))
return K_FALSE;
- if ( pFileHdr->Machine != IMAGE_FILE_MACHINE_I386
- && pFileHdr->Machine != IMAGE_FILE_MACHINE_AMD64)
- return K_FALSE;
- if (pFileHdr->SizeOfOptionalHeader != 0)
- return K_FALSE; /* COFF files doesn't have an optional header */
- if ( pFileHdr->NumberOfSections <= 1
- || pFileHdr->NumberOfSections > cbFile)
- return K_FALSE;
+ /*
+ * Deal with -bigobj output first.
+ */
+ if ( pBigObjHdr->Sig1 == 0
+ && pBigObjHdr->Sig2 == KU16_MAX)
+ {
+ static const KU8 s_abClsId[16] = { ANON_OBJECT_HEADER_BIGOBJ_CLS_ID_BYTES };
- if (cbHdrs >= cbFile)
- return K_FALSE;
+ paSHdrs = (IMAGE_SECTION_HEADER const *)(pBigObjHdr + 1);
+ cSHdrs = pBigObjHdr->NumberOfSections;
+ cbHdrs = sizeof(IMAGE_SECTION_HEADER) * cSHdrs;
- if ( pFileHdr->PointerToSymbolTable != 0
- && ( pFileHdr->PointerToSymbolTable < cbHdrs
- || pFileHdr->PointerToSymbolTable > cbFile))
- return K_FALSE;
- if ( pFileHdr->PointerToSymbolTable == 0
- && pFileHdr->NumberOfSymbols != 0)
+ if (cbFile <= sizeof(*pBigObjHdr))
+ return K_FALSE;
+
+ if (pBigObjHdr->Version != 2)
+ return K_FALSE;
+ if (memcmp(&pBigObjHdr->ClassID[0], s_abClsId, sizeof(pBigObjHdr->ClassID)) != 0)
+ return K_FALSE;
+
+ if ( pBigObjHdr->Machine != IMAGE_FILE_MACHINE_I386
+ && pBigObjHdr->Machine != IMAGE_FILE_MACHINE_AMD64
+ && pBigObjHdr->Machine != IMAGE_FILE_MACHINE_ARM
+ && pBigObjHdr->Machine != IMAGE_FILE_MACHINE_ARMNT
+ && pBigObjHdr->Machine != IMAGE_FILE_MACHINE_ARM64
+ && pBigObjHdr->Machine != IMAGE_FILE_MACHINE_EBC)
+ {
+ fprintf(stderr, "kDepObj: error: bigobj Machine not supported: %#x\n", pBigObjHdr->Machine);
+ return K_FALSE;
+ }
+ if (pBigObjHdr->Flags != 0)
+ {
+ fprintf(stderr, "kDepObj: error: bigobj Flags field is non-zero: %#x\n", pBigObjHdr->Flags);
+ return K_FALSE;
+ }
+ if (pBigObjHdr->SizeOfData != 0)
+ {
+ fprintf(stderr, "kDepObj: error: bigobj SizeOfData field is non-zero: %#x\n", pBigObjHdr->SizeOfData);
+ return K_FALSE;
+ }
+
+ if ( pBigObjHdr->PointerToSymbolTable != 0
+ && ( pBigObjHdr->PointerToSymbolTable < cbHdrs
+ || pBigObjHdr->PointerToSymbolTable > cbFile))
+ return K_FALSE;
+ if ( pBigObjHdr->PointerToSymbolTable == 0
+ && pBigObjHdr->NumberOfSymbols != 0)
+ return K_FALSE;
+ }
+ /*
+ * Look for normal COFF object.
+ */
+ else
+ {
+ paSHdrs = (IMAGE_SECTION_HEADER const *)((KU8 const *)(pFileHdr + 1) + pFileHdr->SizeOfOptionalHeader);
+ cSHdrs = pFileHdr->NumberOfSections;
+ cbHdrs = (const KU8 *)&paSHdrs[cSHdrs] - (const KU8 *)pbFile;
+
+ if ( pFileHdr->Machine != IMAGE_FILE_MACHINE_I386
+ && pFileHdr->Machine != IMAGE_FILE_MACHINE_AMD64
+ && pFileHdr->Machine != IMAGE_FILE_MACHINE_ARM
+ && pFileHdr->Machine != IMAGE_FILE_MACHINE_ARMNT
+ && pFileHdr->Machine != IMAGE_FILE_MACHINE_ARM64
+ && pFileHdr->Machine != IMAGE_FILE_MACHINE_EBC)
+ return K_FALSE;
+
+ if (pFileHdr->SizeOfOptionalHeader != 0)
+ return K_FALSE; /* COFF files doesn't have an optional header */
+
+ if ( pFileHdr->PointerToSymbolTable != 0
+ && ( pFileHdr->PointerToSymbolTable < cbHdrs
+ || pFileHdr->PointerToSymbolTable > cbFile))
+ return K_FALSE;
+ if ( pFileHdr->PointerToSymbolTable == 0
+ && pFileHdr->NumberOfSymbols != 0)
+ return K_FALSE;
+ if ( pFileHdr->Characteristics
+ & ( IMAGE_FILE_DLL
+ | IMAGE_FILE_SYSTEM
+ | IMAGE_FILE_UP_SYSTEM_ONLY
+ | IMAGE_FILE_NET_RUN_FROM_SWAP
+ | IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP
+ | IMAGE_FILE_EXECUTABLE_IMAGE
+ | IMAGE_FILE_RELOCS_STRIPPED))
+ return K_FALSE;
+ }
+ if ( cSHdrs <= 1
+ || cSHdrs > cbFile)
return K_FALSE;
- if ( pFileHdr->Characteristics
- & ( IMAGE_FILE_DLL
- | IMAGE_FILE_SYSTEM
- | IMAGE_FILE_UP_SYSTEM_ONLY
- | IMAGE_FILE_NET_RUN_FROM_SWAP
- | IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP
- | IMAGE_FILE_EXECUTABLE_IMAGE
- | IMAGE_FILE_RELOCS_STRIPPED))
+ if (cbHdrs >= cbFile)
return K_FALSE;
+ /*
+ * Check the section headers.
+ */
for (iSHdr = 0; iSHdr < cSHdrs; iSHdr++)
{
- if ( paSHdrs[iSHdr].PointerToRawData != 0
- && ( paSHdrs[iSHdr].PointerToRawData < cbHdrs
- || paSHdrs[iSHdr].PointerToRawData >= cbFile
- || paSHdrs[iSHdr].PointerToRawData + paSHdrs[iSHdr].SizeOfRawData > cbFile))
+ if ( paSHdrs[iSHdr].PointerToRawData != 0
+ && ( paSHdrs[iSHdr].PointerToRawData < cbHdrs
+ || paSHdrs[iSHdr].PointerToRawData >= cbFile
+ || paSHdrs[iSHdr].PointerToRawData + paSHdrs[iSHdr].SizeOfRawData > cbFile))
return K_FALSE;
- if ( paSHdrs[iSHdr].PointerToRelocations != 0
- && ( paSHdrs[iSHdr].PointerToRelocations < cbHdrs
- || paSHdrs[iSHdr].PointerToRelocations >= cbFile
- || paSHdrs[iSHdr].PointerToRelocations + paSHdrs[iSHdr].NumberOfRelocations * 10 > cbFile)) /* IMAGE_RELOCATION */
+ if ( paSHdrs[iSHdr].PointerToRelocations != 0
+ && ( paSHdrs[iSHdr].PointerToRelocations < cbHdrs
+ || paSHdrs[iSHdr].PointerToRelocations >= cbFile
+ || paSHdrs[iSHdr].PointerToRelocations + paSHdrs[iSHdr].NumberOfRelocations * 10 > cbFile)) /* IMAGE_RELOCATION */
return K_FALSE;
- if ( paSHdrs[iSHdr].PointerToLinenumbers != 0
- && ( paSHdrs[iSHdr].PointerToLinenumbers < cbHdrs
- || paSHdrs[iSHdr].PointerToLinenumbers >= cbFile
- || paSHdrs[iSHdr].PointerToLinenumbers + paSHdrs[iSHdr].NumberOfLinenumbers * 6 > cbFile)) /* IMAGE_LINENUMBER */
+ if ( paSHdrs[iSHdr].PointerToLinenumbers != 0
+ && ( paSHdrs[iSHdr].PointerToLinenumbers < cbHdrs
+ || paSHdrs[iSHdr].PointerToLinenumbers >= cbFile
+ || paSHdrs[iSHdr].PointerToLinenumbers + paSHdrs[iSHdr].NumberOfLinenumbers * 6 > cbFile)) /* IMAGE_LINENUMBER */
return K_FALSE;
}
@@ -886,7 +962,7 @@ static int kDepObjProcessFile(FILE *pInput)
rc = kDepObjCOFFParse(pbFile, cbFile);
else
{
- fprintf(stderr, "%s: error: Doesn't recognize the header of the OMF file.\n", argv0);
+ fprintf(stderr, "%s: error: Doesn't recognize the header of the OMF/COFF file.\n", argv0);
rc = 1;
}
diff --git a/src/kmk/kmkbuiltin/kSubmit.c b/src/kmk/kmkbuiltin/kSubmit.c
index b69709d..fde8e7c 100644
--- a/src/kmk/kmkbuiltin/kSubmit.c
+++ b/src/kmk/kmkbuiltin/kSubmit.c
@@ -1,4 +1,4 @@
-/* $Id: kSubmit.c 2884 2016-09-06 03:11:19Z bird $ */
+/* $Id: kSubmit.c 2894 2016-09-08 13:27:56Z bird $ */
/** @file
* kMk Builtin command - submit job to a kWorker.
*/
@@ -573,10 +573,14 @@ static PWORKERINSTANCE kSubmitSelectWorkSpawnNewIfNecessary(unsigned cBitsWorker
* @param papszEnvVars The environment vector.
* @param pszCwd The current directory.
* @param fWatcomBrainDamage The wcc/wcc386 workaround.
+ * @param papszPostCmdArgs The post command and it's arguments.
+ * @param cPostCmdArgs Number of post command argument, including the
+ * command. Zero if no post command scheduled.
* @param pcbMsg Where to return the message length.
*/
static void *kSubmitComposeJobMessage(const char *pszExecutable, char **papszArgs, char **papszEnvVars,
- const char *pszCwd, int fWatcomBrainDamage, uint32_t *pcbMsg)
+ const char *pszCwd, int fWatcomBrainDamage,
+ char **papszPostCmdArgs, uint32_t cPostCmdArgs, uint32_t *pcbMsg)
{
size_t cbTmp;
uint32_t i;
@@ -612,24 +616,32 @@ static void *kSubmitComposeJobMessage(const char *pszExecutable, char **papszArg
cbMsg += 1;
+ cbMsg += sizeof(cPostCmdArgs);
+ for (i = 0; i < cPostCmdArgs; i++)
+ cbMsg += strlen(papszPostCmdArgs[i]) + 1;
+
/*
* Compose the message.
*/
pbMsg = pbCursor = xmalloc(cbMsg);
+ /* header */
memcpy(pbCursor, &cbMsg, sizeof(cbMsg));
pbCursor += sizeof(cbMsg);
memcpy(pbCursor, "JOB", sizeof("JOB"));
pbCursor += sizeof("JOB");
+ /* executable. */
cbTmp = strlen(pszExecutable) + 1;
memcpy(pbCursor, pszExecutable, cbTmp);
pbCursor += cbTmp;
+ /* cwd */
cbTmp = strlen(pszCwd) + 1;
memcpy(pbCursor, pszCwd, cbTmp);
pbCursor += cbTmp;
+ /* argument */
memcpy(pbCursor, &cArgs, sizeof(cArgs));
pbCursor += sizeof(cArgs);
for (i = 0; papszArgs[i] != NULL; i++)
@@ -641,6 +653,7 @@ static void *kSubmitComposeJobMessage(const char *pszExecutable, char **papszArg
}
assert(i == cArgs);
+ /* environment */
memcpy(pbCursor, &cEnvVars, sizeof(cEnvVars));
pbCursor += sizeof(cEnvVars);
for (i = 0; papszEnvVars[i] != NULL; i++)
@@ -651,11 +664,25 @@ static void *kSubmitComposeJobMessage(const char *pszExecutable, char **papszArg
}
assert(i == cEnvVars);
+ /* flags */
*pbCursor++ = fWatcomBrainDamage != 0;
+ /* post command */
+ memcpy(pbCursor, &cPostCmdArgs, sizeof(cPostCmdArgs));
+ pbCursor += sizeof(cPostCmdArgs);
+ for (i = 0; i < cPostCmdArgs; i++)
+ {
+ cbTmp = strlen(papszPostCmdArgs[i]) + 1;
+ memcpy(pbCursor, papszPostCmdArgs[i], cbTmp);
+ pbCursor += cbTmp;
+ }
+ assert(i == cPostCmdArgs);
+
assert(pbCursor - pbMsg == (size_t)cbMsg);
- /* done */
+ /*
+ * Done.
+ */
*pcbMsg = cbMsg;
return pbMsg;
}
@@ -1338,7 +1365,8 @@ static int usage(FILE *pOut, const char *argv0)
fprintf(pOut,
"usage: %s [-Z|--zap-env] [-E|--set <var=val>] [-U|--unset <var=val>]\n"
" [-C|--chdir <dir>] [--wcc-brain-damage]\n"
- " [-3|--32-bit] [-6|--64-bit] [-v] -- <program> [args]\n"
+ " [-3|--32-bit] [-6|--64-bit] [-v]\n"
+ " [-P|--post-cmd <cmd> [args]] -- <program> [args]\n"
" or: %s --help\n"
" or: %s --version\n"
"\n"
@@ -1361,6 +1389,10 @@ static int usage(FILE *pOut, const char *argv0)
" quoting conventions on Windows, OS/2, and DOS.\n"
" -v,--verbose\n"
" More verbose execution.\n"
+ " -P|--post-cmd <cmd> ...\n"
+ " For running a built-in command on the output, specifying the command\n"
+ " and all it's parameters. Currently supported commands:\n"
+ " kDepObj\n"
" -V,--version\n"
" Show the version number.\n"
" -h,--help\n"
@@ -1382,6 +1414,8 @@ int kmk_builtin_kSubmit(int argc, char **argv, char **envp, struct child *pChild
char **papszEnv = NULL;
const char *pszExecutable = NULL;
const char *pszCwd = NULL;
+ int iPostCmd = argc;
+ int cPostCmdArgs = 0;
unsigned cBitsWorker = g_cArchBits;
int fWatcomBrainDamage = 0;
int cVerbosity = 0;
@@ -1456,6 +1490,8 @@ int kmk_builtin_kSubmit(int argc, char **argv, char **envp, struct child *pChild
chOpt = 'Z';
else if (strcmp(pszArg, "chdir") == 0)
chOpt = 'C';
+ else if (strcmp(pszArg, "post-cmd") == 0)
+ chOpt = 'P';
else if (strcmp(pszArg, "32-bit") == 0)
chOpt = '3';
else if (strcmp(pszArg, "64-bit") == 0)
@@ -1488,7 +1524,7 @@ int kmk_builtin_kSubmit(int argc, char **argv, char **envp, struct child *pChild
pszValue = argv[iArg];
else
{
- errx(1, "Option -%c requires an value!", chOpt);
+ errx(1, "Option -%c requires a value!", chOpt);
return usage(stderr, argv[0]);
}
break;
@@ -1523,6 +1559,20 @@ int kmk_builtin_kSubmit(int argc, char **argv, char **envp, struct child *pChild
break;
return rcExit;
+ case 'P':
+ if (cPostCmdArgs > 0)
+ return errx(1, "The -P option can only be used once!");
+ if (*pszArg != '\0')
+ return errx(1, "The cmd part of the -P needs to be a separate argument!");
+ iPostCmd = ++iArg;
+ if (iArg >= argc)
+ return errx(1, "The -P option requires a command following it!");
+ while (iArg < argc && strcmp(argv[iArg], "--") != 0)
+ iArg++;
+ cPostCmdArgs = iArg - iPostCmd;
+ iArg--;
+ break;
+
case '3':
cBitsWorker = 32;
break;
@@ -1562,7 +1612,7 @@ int kmk_builtin_kSubmit(int argc, char **argv, char **envp, struct child *pChild
{
uint32_t cbMsg;
void *pvMsg = kSubmitComposeJobMessage(pszExecutable, &argv[iArg], papszEnv, szCwd,
- fWatcomBrainDamage, &cbMsg);
+ fWatcomBrainDamage, &argv[iPostCmd], cPostCmdArgs, &cbMsg);
PWORKERINSTANCE pWorker = kSubmitSelectWorkSpawnNewIfNecessary(cBitsWorker, cVerbosity);
if (pWorker)
{
diff --git a/src/kmk/variable.c b/src/kmk/variable.c
index 16e6a0f..5e85e83 100644
--- a/src/kmk/variable.c
+++ b/src/kmk/variable.c
@@ -58,6 +58,12 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
} while (0)
#endif
+#ifdef KMK
+/* Incremented every time a variable is modified, so that target_environment
+ knows when to regenerate the table of exported global variables. */
+static size_t global_variable_generation = 0;
+#endif
+
/* Chain of all pattern-specific variables. */
@@ -216,6 +222,9 @@ variable_hash_cmp (const void *xv, const void *yv)
#define SMALL_SCOPE_VARIABLE_BUCKETS 13
# endif
#endif
+#ifndef ENVIRONMENT_VARIABLE_BUCKETS /* added by bird. */
+# define ENVIRONMENT_VARIABLE_BUCKETS 256
+#endif
#ifdef KMK /* Drop the 'static' */
@@ -269,6 +278,11 @@ define_variable_in_set (const char *name, unsigned int length,
struct variable **var_slot;
struct variable var_key;
+#ifdef KMK
+ if (set == NULL || set == &global_variable_set)
+ global_variable_generation++;
+#endif
+
if (env_overrides && origin == o_env)
origin = o_env_override;
@@ -514,6 +528,10 @@ undefine_variable_in_set (const char *name, unsigned int length,
var_key.length = length;
var_slot = (struct variable **) hash_find_slot_strcached (&set->table, &var_key);
#endif
+#ifdef KMK
+ if (set == &global_variable_set)
+ global_variable_generation++;
+#endif
if (env_overrides && origin == o_env)
origin = o_env_override;
@@ -563,6 +581,11 @@ define_variable_alias_in_set (const char *name, unsigned int length,
struct variable *v;
struct variable **var_slot;
+#ifdef KMK
+ if (set == NULL || set == &global_variable_set)
+ global_variable_generation++;
+#endif
+
/* Look it up the hash table slot for it. */
name = strcache2_add (&variable_strcache, name, length);
if ( set != &global_variable_set
@@ -1958,6 +1981,85 @@ define_automatic_variables (void)
int export_all_variables;
+#ifdef KMK
+/* Cached table containing the exports of the global_variable_set. When
+ there are many global variables, it can be so expensive to construct the
+ child environment that we have a majority of job slot idle. */
+static size_t global_variable_set_exports_generation = ~(size_t)0;
+static struct hash_table global_variable_set_exports;
+
+static void update_global_variable_set_exports(void)
+{
+ struct variable **v_slot;
+ struct variable **v_end;
+
+ /* Re-initialize the table. */
+ if (global_variable_set_exports_generation != ~(size_t)0)
+ hash_free (&global_variable_set_exports, 0);
+ hash_init_strcached (&global_variable_set_exports, ENVIRONMENT_VARIABLE_BUCKETS,
+ &variable_strcache, offsetof (struct variable, name));
+
+ /* do pretty much the same as target_environment. */
+ v_slot = (struct variable **) global_variable_set.table.ht_vec;
+ v_end = v_slot + global_variable_set.table.ht_size;
+ for ( ; v_slot < v_end; v_slot++)
+ if (! HASH_VACANT (*v_slot))
+ {
+ struct variable **new_slot;
+ struct variable *v = *v_slot;
+
+ switch (v->export)
+ {
+ case v_default:
+ if (v->origin == o_default || v->origin == o_automatic)
+ /* Only export default variables by explicit request. */
+ continue;
+
+ /* The variable doesn't have a name that can be exported. */
+ if (! v->exportable)
+ continue;
+
+ if (! export_all_variables
+ && v->origin != o_command
+ && v->origin != o_env && v->origin != o_env_override)
+ continue;
+ break;
+
+ case v_export:
+ break;
+
+ case v_noexport:
+ {
+ /* If this is the SHELL variable and it's not exported,
+ then add the value from our original environment, if
+ the original environment defined a value for SHELL. */
+ extern struct variable shell_var;
+ if (streq (v->name, "SHELL") && shell_var.value)
+ {
+ v = &shell_var;
+ break;
+ }
+ continue;
+ }
+
+ case v_ifset:
+ if (v->origin == o_default)
+ continue;
+ break;
+ }
+
+ assert (strcache2_is_cached (&variable_strcache, v->name));
+ new_slot = (struct variable **) hash_find_slot_strcached (&global_variable_set_exports, v);
+ if (HASH_VACANT (*new_slot))
+ hash_insert_at (&global_variable_set_exports, v, new_slot);
+ }
+
+ /* done */
+ global_variable_set_exports_generation = global_variable_generation;
+}
+
+#endif
+
/* Create a new environment for FILE's commands.
If FILE is nil, this is for the `shell' function.
The child's MAKELEVEL variable is incremented. */
@@ -1977,16 +2079,21 @@ target_environment (struct file *file)
const char *cached_name;
#endif
+#ifdef KMK
+ if (global_variable_set_exports_generation != global_variable_generation)
+ update_global_variable_set_exports();
+#endif
+
if (file == 0)
set_list = current_variable_set_list;
else
set_list = file->variables;
#ifndef CONFIG_WITH_STRCACHE2
- hash_init (&table, VARIABLE_BUCKETS,
+ hash_init (&table, ENVIRONMENT_VARIABLE_BUCKETS,
variable_hash_1, variable_hash_2, variable_hash_cmp);
#else /* CONFIG_WITH_STRCACHE2 */
- hash_init_strcached (&table, VARIABLE_BUCKETS,
+ hash_init_strcached (&table, ENVIRONMENT_VARIABLE_BUCKETS,
&variable_strcache, offsetof (struct variable, name));
#endif /* CONFIG_WITH_STRCACHE2 */
@@ -1995,6 +2102,13 @@ target_environment (struct file *file)
for (s = set_list; s != 0; s = s->next)
{
struct variable_set *set = s->set;
+#ifdef KMK
+ if (set == &global_variable_set)
+ {
+ assert(s->next == NULL);
+ break;
+ }
+#endif
v_slot = (struct variable **) set->table.ht_vec;
v_end = v_slot + set->table.ht_size;
for ( ; v_slot < v_end; v_slot++)
@@ -2073,6 +2187,22 @@ target_environment (struct file *file)
}
}
+#ifdef KMK
+ /* Add the global exports to table. */
+ v_slot = (struct variable **) global_variable_set_exports.ht_vec;
+ v_end = v_slot + global_variable_set_exports.ht_size;
+ for ( ; v_slot < v_end; v_slot++)
+ if (! HASH_VACANT (*v_slot))
+ {
+ struct variable **new_slot;
+ struct variable *v = *v_slot;
+ assert (strcache2_is_cached (&variable_strcache, v->name));
+ new_slot = (struct variable **) hash_find_slot_strcached (&table, v);
+ if (HASH_VACANT (*new_slot))
+ hash_insert_at (&table, v, new_slot);
+ }
+#endif
+
#ifndef CONFIG_WITH_STRCACHE2
makelevel_key.name = MAKELEVEL_NAME;
makelevel_key.length = MAKELEVEL_LENGTH;
diff --git a/src/lib/kStuff/include/k/kLdrFmts/pe.h b/src/lib/kStuff/include/k/kLdrFmts/pe.h
index 3523226..42af4df 100644
--- a/src/lib/kStuff/include/k/kLdrFmts/pe.h
+++ b/src/lib/kStuff/include/k/kLdrFmts/pe.h
@@ -1,4 +1,4 @@
-/* $Id: pe.h 82 2016-08-22 21:01:51Z bird $ */
+/* $Id: pe.h 92 2016-09-08 15:31:37Z bird $ */
/** @file
* PE structures, types and defines.
*/
@@ -47,8 +47,13 @@
#endif
/* file header */
+#define IMAGE_FILE_MACHINE_UNKNOWN 0x0000
#define IMAGE_FILE_MACHINE_I386 0x014c
#define IMAGE_FILE_MACHINE_AMD64 0x8664
+#define IMAGE_FILE_MACHINE_ARM 0x01c0
+#define IMAGE_FILE_MACHINE_ARMNT 0x01c4
+#define IMAGE_FILE_MACHINE_ARM64 0xaa64
+#define IMAGE_FILE_MACHINE_EBC 0x0ebc
#define IMAGE_FILE_RELOCS_STRIPPED 0x0001
#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
@@ -67,6 +72,10 @@
#define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
+/** Raw UUID byte for the ANON_OBJECT_HEADER_BIGOBJ::ClassID value.
+ * These make out {d1baa1c7-baee-4ba9-af20-faf66aa4dcb8}. */
+#define ANON_OBJECT_HEADER_BIGOBJ_CLS_ID_BYTES \
+ 0xc7, 0xa1, 0xba, 0xd1,/*-*/ 0xee, 0xba,/*-*/ 0xa9, 0x4b,/*-*/ 0xaf, 0x20,/*-*/ 0xfa, 0xf6, 0x6a, 0xa4, 0xdc, 0xb8
/* optional header */
#define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10B
@@ -215,6 +224,57 @@ typedef struct _IMAGE_FILE_HEADER
typedef IMAGE_FILE_HEADER *PIMAGE_FILE_HEADER;
+typedef struct _ANON_OBJECT_HEADER
+{
+ KU16 Sig1;
+ KU16 Sig2;
+ KU16 Version; /**< >= 1 */
+ KU16 Machine;
+ KU32 TimeDataStamp;
+ KU8 ClassID[16];
+ KU32 SizeOfData;
+} ANON_OBJECT_HEADER;
+typedef ANON_OBJECT_HEADER *PANON_OBJECT_HEADER;
+
+
+typedef struct _ANON_OBJECT_HEADER_V2
+{
+ KU16 Sig1;
+ KU16 Sig2;
+ KU16 Version; /**< >= 2 */
+ KU16 Machine;
+ KU32 TimeDataStamp;
+ KU8 ClassID[16];
+ KU32 SizeOfData;
+ /* New fields for Version >= 2: */
+ KU32 Flags;
+ KU32 MetaDataSize; /**< CLR metadata */
+ KU32 MetaDataOffset;
+} ANON_OBJECT_HEADER_V2;
+typedef ANON_OBJECT_HEADER_V2 *PANON_OBJECT_HEADER_V2;
+
+
+typedef struct _ANON_OBJECT_HEADER_BIGOBJ
+{
+ KU16 Sig1;
+ KU16 Sig2;
+ KU16 Version; /**< >= 2 */
+ KU16 Machine;
+ KU32 TimeDataStamp;
+ KU8 ClassID[16]; /**< ANON_OBJECT_HEADER_BIGOBJ_CLS_ID_BYTES */
+ KU32 SizeOfData;
+ /* New fields for Version >= 2: */
+ KU32 Flags;
+ KU32 MetaDataSize; /**< CLR metadata */
+ KU32 MetaDataOffset;
+ /* Specific for bigobj: */
+ KU32 NumberOfSections;
+ KU32 PointerToSymbolTable;
+ KU32 NumberOfSymbols;
+} ANON_OBJECT_HEADER_BIGOBJ;
+typedef ANON_OBJECT_HEADER_BIGOBJ *PANON_OBJECT_HEADER_BIGOBJ;
+
+
typedef struct _IMAGE_DATA_DIRECTORY
{
KU32 VirtualAddress;
@@ -458,7 +518,7 @@ typedef IMAGE_LOAD_CONFIG_DIRECTORY64 *PIMAGE_LOAD_CONFIG_DIRECTORY64;
typedef struct _IMAGE_DEBUG_DIRECTORY
{
KU32 Characteristics;
- KU32 TimeDateStamp;
+ KU32 TimeDateStamp;
KU16 MajorVersion;
KU16 MinorVersion;
KU32 Type;
diff --git a/src/lib/kStuff/kLdr/kLdrModLX.c b/src/lib/kStuff/kLdr/kLdrModLX.c
index b05dd15..8af1421 100644
--- a/src/lib/kStuff/kLdr/kLdrModLX.c
+++ b/src/lib/kStuff/kLdr/kLdrModLX.c
@@ -1,4 +1,4 @@
-/* $Id: kLdrModLX.c 81 2016-08-18 22:10:38Z bird $ */
+/* $Id: kLdrModLX.c 87 2016-09-07 13:09:12Z bird $ */
/** @file
* kLdr - The Module Interpreter for the Linear eXecutable (LX) Format.
*/
@@ -118,9 +118,9 @@ static int kldrModLXHasDbgInfo(PKLDRMOD pMod, const void *pvBits);
static int kldrModLXRelocateBits(PKLDRMOD pMod, void *pvBits, KLDRADDR NewBaseAddress, KLDRADDR OldBaseAddress,
PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser);
static int kldrModLXDoCreate(PKRDR pRdr, KLDRFOFF offNewHdr, PKLDRMODLX *ppModLX);
-static const KU8 *kldrModLXDoNameTableLookupByOrdinal(const KU8 *pbNameTable, KI32 cbNameTable, KU32 iOrdinal);
-static int kldrModLXDoNameLookup(PKLDRMODLX pModLX, const char *pchSymbol, KU32 cchSymbol, KU32 *piSymbol);
-static const KU8 *kldrModLXDoNameTableLookupByName(const KU8 *pbNameTable, KI32 cbNameTable,
+static const KU8 *kldrModLXDoNameTableLookupByOrdinal(const KU8 *pbNameTable, KSSIZE cbNameTable, KU32 iOrdinal);
+static int kldrModLXDoNameLookup(PKLDRMODLX pModLX, const char *pchSymbol, KSIZE cchSymbol, KU32 *piSymbol);
+static const KU8 *kldrModLXDoNameTableLookupByName(const KU8 *pbNameTable, KSSIZE cbNameTable,
const char *pchSymbol, KSIZE cchSymbol);
static int kldrModLXDoLoadBits(PKLDRMODLX pModLX, void *pvBits);
static int kldrModLXDoIterDataUnpacking(KU8 *pbDst, const KU8 *pbSrc, int cbSrc);
@@ -297,7 +297,7 @@ static int kldrModLXDoCreate(PKRDR pRdr, KLDRFOFF offNewHdr, PKLDRMODLX *ppModLX
pMod->pRdr = pRdr;
pMod->pOps = NULL; /* set upon success. */
pMod->cSegments = Hdr.e32_objcnt;
- pMod->cchFilename = cchFilename;
+ pMod->cchFilename = (KU32)cchFilename;
pMod->pszFilename = (char *)K_ALIGN_P(&pMod->aSegments[pMod->cSegments], 8);
kHlpMemCopy((char *)pMod->pszFilename, kRdrName(pRdr), cchFilename + 1);
pMod->pszName = NULL; /* finalized further down */
@@ -477,7 +477,7 @@ static int kldrModLXDoCreate(PKRDR pRdr, KLDRFOFF offNewHdr, PKLDRMODLX *ppModLX
pMod->aSegments[i].cbMapped = K_ALIGN_Z(pModLX->paObjs[i].o32_size, OBJPAGELEN);
else
pMod->aSegments[i].cbMapped = pModLX->paObjs[i + 1].o32_base - pModLX->paObjs[i].o32_base;
- NextRVA += pMod->aSegments[i].cbMapped;
+ NextRVA += (KU32)pMod->aSegments[i].cbMapped;
/* protection */
switch ( pModLX->paObjs[i].o32_flags
@@ -708,7 +708,7 @@ static int kldrModLXQuerySymbol(PKLDRMOD pMod, const void *pvBits, KLDRADDR Base
* @param cchSymbol The symbol name length.
* @param piSymbol Where to store the symbol ordinal.
*/
-static int kldrModLXDoNameLookup(PKLDRMODLX pModLX, const char *pchSymbol, KU32 cchSymbol, KU32 *piSymbol)
+static int kldrModLXDoNameLookup(PKLDRMODLX pModLX, const char *pchSymbol, KSIZE cchSymbol, KU32 *piSymbol)
{
/*
@@ -783,7 +783,7 @@ static KU32 kldrModLXDoHash(const char *pchSymbol, KU8 cchSymbol)
* @param pchSymbol The name of the symbol we're looking for.
* @param cchSymbol The length of the symbol name.
*/
-static const KU8 *kldrModLXDoNameTableLookupByName(const KU8 *pbNameTable, KI32 cbNameTable,
+static const KU8 *kldrModLXDoNameTableLookupByName(const KU8 *pbNameTable, KSSIZE cbNameTable,
const char *pchSymbol, KSIZE cchSymbol)
{
/*
@@ -1172,7 +1172,7 @@ static int kldrModLXEnumSymbols(PKLDRMOD pMod, const void *pvBits, KLDRADDR Base
* @param cbNameTable The size of the name table.
* @param iOrdinal The ordinal to search for.
*/
-static const KU8 *kldrModLXDoNameTableLookupByOrdinal(const KU8 *pbNameTable, KI32 cbNameTable, KU32 iOrdinal)
+static const KU8 *kldrModLXDoNameTableLookupByOrdinal(const KU8 *pbNameTable, KSSIZE cbNameTable, KU32 iOrdinal)
{
while (*pbNameTable != 0 && cbNameTable > 0)
{
@@ -1423,7 +1423,7 @@ static int kldrModLXDoLoadBits(PKLDRMODLX pModLX, void *pvBits)
for (i = 0; i < pModLX->Hdr.e32_objcnt; i++)
{
const struct o32_obj * const pObj = &pModLX->paObjs[i];
- const KU32 cPages = pModLX->pMod->aSegments[i].cbMapped / OBJPAGELEN;
+ const KU32 cPages = (KU32)(pModLX->pMod->aSegments[i].cbMapped / OBJPAGELEN);
KU32 iPage;
KU8 *pbPage = (KU8 *)pvBits + (KUPTR)pModLX->pMod->aSegments[i].RVA;
@@ -2038,7 +2038,7 @@ static int kldrModLXCallInit(PKLDRMOD pMod, void *pvMapping, KUPTR uHandle)
*/
if (pvMapping == KLDRMOD_INT_MAP)
{
- pvMapping = pModLX->pvMapping;
+ pvMapping = (void *)pModLX->pvMapping;
if (!pvMapping)
return KLDR_ERR_NOT_MAPPED;
}
@@ -2165,7 +2165,7 @@ static int kldrModLXCallTerm(PKLDRMOD pMod, void *pvMapping, KUPTR uHandle)
*/
if (pvMapping == KLDRMOD_INT_MAP)
{
- pvMapping = pModLX->pvMapping;
+ pvMapping = (void *)pModLX->pvMapping;
if (!pvMapping)
return KLDR_ERR_NOT_MAPPED;
}
@@ -2475,11 +2475,11 @@ static int kldrModLXRelocateBits(PKLDRMOD pMod, void *pvBits, KLDRADDR NewBaseAd
if ( (u.prlc->nr_stype & NRSRCMASK) == NROFF32
&& off >= 0
&& off <= OBJPAGELEN - 4)
- *(KU32 *)&pbPage[off] = uValue;
+ *(KU32 *)&pbPage[off] = (KU32)uValue;
else if ( (u.prlc->nr_stype & NRSRCMASK) == NRSOFF32
&& off >= 0
&& off <= OBJPAGELEN - 4)
- *(KU32 *)&pbPage[off] = uValue - (PageAddress + off + 4);
+ *(KU32 *)&pbPage[off] = (KU32)(uValue - (PageAddress + off + 4));
else
{
/* generic */
@@ -2500,7 +2500,7 @@ static int kldrModLXRelocateBits(PKLDRMOD pMod, void *pvBits, KLDRADDR NewBaseAd
{
int off = *poffSrc++;
if (off >= 0 && off <= OBJPAGELEN - 4)
- *(KU32 *)&pbPage[off] = uValue;
+ *(KU32 *)&pbPage[off] = (KU32)uValue;
else
{
rc = kldrModLXDoReloc(pbPage, off, PageAddress, u.prlc, iSelector, uValue, fKind);
@@ -2515,7 +2515,7 @@ static int kldrModLXRelocateBits(PKLDRMOD pMod, void *pvBits, KLDRADDR NewBaseAd
{
int off = *poffSrc++;
if (off >= 0 && off <= OBJPAGELEN - 4)
- *(KU32 *)&pbPage[off] = uValue - (PageAddress + off + 4);
+ *(KU32 *)&pbPage[off] = (KU32)(uValue - (PageAddress + off + 4));
else
{
rc = kldrModLXDoReloc(pbPage, off, PageAddress, u.prlc, iSelector, uValue, fKind);
@@ -2633,7 +2633,7 @@ static int kldrModLXDoReloc(KU8 *pbPage, int off, KLDRADDR PageAddress, const st
cb = 4;
break;
case NRSOFF32:
- uData.off32 = (KU32)uValue - (PageAddress + off + 4);
+ uData.off32 = (KU32)(uValue - (PageAddress + off + 4));
cb = 4;
break;
default:
diff --git a/src/lib/kStuff/kLdr/kLdrModMachO.c b/src/lib/kStuff/kLdr/kLdrModMachO.c
index 7b4b2d2..6a11d30 100644
--- a/src/lib/kStuff/kLdr/kLdrModMachO.c
+++ b/src/lib/kStuff/kLdr/kLdrModMachO.c
@@ -1,4 +1,4 @@
-/* $Id: kLdrModMachO.c 81 2016-08-18 22:10:38Z bird $ */
+/* $Id: kLdrModMachO.c 91 2016-09-07 14:29:58Z bird $ */
/** @file
* kLdr - The Module Interpreter for the MACH-O format.
*/
@@ -218,10 +218,10 @@ static int kldrModMachOMapVirginBits(PKLDRMODMACHO pModMachO);
static int kldrModMachODoQuerySymbol32Bit(PKLDRMODMACHO pModMachO, const macho_nlist_32_t *paSyms, KU32 cSyms, const char *pchStrings,
KU32 cchStrings, KLDRADDR BaseAddress, KU32 iSymbol, const char *pchSymbol,
- KSIZE cchSymbol, PKLDRADDR puValue, KU32 *pfKind);
+ KU32 cchSymbol, PKLDRADDR puValue, KU32 *pfKind);
static int kldrModMachODoQuerySymbol64Bit(PKLDRMODMACHO pModMachO, const macho_nlist_64_t *paSyms, KU32 cSyms, const char *pchStrings,
KU32 cchStrings, KLDRADDR BaseAddress, KU32 iSymbol, const char *pchSymbol,
- KSIZE cchSymbol, PKLDRADDR puValue, KU32 *pfKind);
+ KU32 cchSymbol, PKLDRADDR puValue, KU32 *pfKind);
static int kldrModMachODoEnumSymbols32Bit(PKLDRMODMACHO pModMachO, const macho_nlist_32_t *paSyms, KU32 cSyms,
const char *pchStrings, KU32 cchStrings, KLDRADDR BaseAddress,
KU32 fFlags, PFNKLDRMODENUMSYMS pfnCallback, void *pvUser);
@@ -407,11 +407,11 @@ static int kldrModMachODoCreate(PKRDR pRdr, KLDRFOFF offImage, KU32 fOpenFlags,
pMod->pRdr = pRdr;
pMod->pOps = NULL; /* set upon success. */
pMod->cSegments = cSegments;
- pMod->cchFilename = cchFilename;
+ pMod->cchFilename = (KU32)cchFilename;
pMod->pszFilename = (char *)&pMod->aSegments[pMod->cSegments];
kHlpMemCopy((char *)pMod->pszFilename, kRdrName(pRdr), cchFilename + 1);
pMod->pszName = kHlpGetFilename(pMod->pszFilename);
- pMod->cchName = cchFilename - (pMod->pszName - pMod->pszFilename);
+ pMod->cchName = (KU32)(cchFilename - (pMod->pszName - pMod->pszFilename));
pMod->fFlags = 0;
switch (s.Hdr32.cputype)
{
@@ -570,7 +570,7 @@ static int kldrModMachOPreParseLoadCommands(KU8 *pbLoadCommands, const mach_hea
const KU64 cbFile = kRdrSize(pRdr) - offImage;
KU32 cSegments = 0;
KU32 cSections = 0;
- KU32 cbStringPool = 0;
+ KSIZE cbStringPool = 0;
KU32 cLeft = pHdr->ncmds;
KU32 cbLeft = pHdr->sizeofcmds;
KU8 *pb = pbLoadCommands;
@@ -653,7 +653,7 @@ static int kldrModMachOPreParseLoadCommands(KU8 *pbLoadCommands, const mach_hea
KLDRMODMACHO_CHECK_RETURN( pSrcSeg->filesize <= pSrcSeg->vmsize \
|| (fSkipSeg && !kHlpStrComp(pSrcSeg->segname, "__CTF") /* see above */), \
KLDR_ERR_MACHO_BAD_LOAD_COMMAND); \
- KLDRMODMACHO_CHECK_RETURN((pSrcSeg->maxprot & pSrcSeg->initprot) == pSrcSeg->initprot, \
+ KLDRMODMACHO_CHECK_RETURN(!(~pSrcSeg->maxprot & pSrcSeg->initprot), \
KLDR_ERR_MACHO_BAD_LOAD_COMMAND); \
KLDRMODMACHO_CHECK_RETURN(!(pSrcSeg->flags & ~(SG_HIGHVM | SG_FVMLIB | SG_NORELOC | SG_PROTECTED_VERSION_1)), \
KLDR_ERR_MACHO_BAD_LOAD_COMMAND); \
@@ -777,7 +777,7 @@ static int kldrModMachOPreParseLoadCommands(KU8 *pbLoadCommands, const mach_hea
| S_ATTR_DEBUG | S_ATTR_SOME_INSTRUCTIONS | S_ATTR_EXT_RELOC \
| S_ATTR_LOC_RELOC | SECTION_TYPE)), \
KLDR_ERR_MACHO_BAD_SECTION); \
- KLDRMODMACHO_CHECK_RETURN((pSect->flags & S_ATTR_DEBUG) == (pSect->flags & S_ATTR_DEBUG), \
+ KLDRMODMACHO_CHECK_RETURN((pSect->flags & S_ATTR_DEBUG) == (pFirstSect->flags & S_ATTR_DEBUG), \
KLDR_ERR_MACHO_MIXED_DEBUG_SECTION_FLAGS); \
\
KLDRMODMACHO_CHECK_RETURN(pSect->addr - pSrcSeg->vmaddr <= pSrcSeg->vmsize, \
@@ -1083,7 +1083,7 @@ static int kldrModMachOPreParseLoadCommands(KU8 *pbLoadCommands, const mach_hea
*pcSegments = cSegments;
*pcSections = cSections;
- *pcbStringPool = cbStringPool;
+ *pcbStringPool = (KU32)cbStringPool;
return 0;
}
@@ -1153,7 +1153,7 @@ static int kldrModMachOParseLoadCommands(PKLDRMODMACHO pModMachO, char *pbStrin
*pbStringPool++ = '.'; \
kHlpMemCopy(pbStringPool, a_achName2, cchName2); \
pbStringPool += cchName2; \
- pDstSeg->cchName += cchName2; \
+ pDstSeg->cchName += (KU32)cchName2; \
} \
*pbStringPool++ = '\0'; \
pDstSeg->SelFlat = 0; \
@@ -1165,8 +1165,8 @@ static int kldrModMachOParseLoadCommands(PKLDRMODMACHO pModMachO, char *pbStrin
pDstSeg->LinkAddress = (a_SegAddr); \
if (a_fFileBits) \
{ \
- pDstSeg->offFile = (a_offFile) + pModMachO->offImage; \
- pDstSeg->cbFile = (a_cbFile); \
+ pDstSeg->offFile = (KLDRFOFF)((a_offFile) + pModMachO->offImage); \
+ pDstSeg->cbFile = (KLDRFOFF)(a_cbFile); \
} \
else \
{ \
@@ -1177,15 +1177,15 @@ static int kldrModMachOParseLoadCommands(PKLDRMODMACHO pModMachO, char *pbStrin
pDstSeg->cbMapped = 0; \
pDstSeg->MapAddress = 0; \
\
- pSegExtra->iOrgSegNo = pSegExtra - &pModMachO->aSegments[0]; \
+ pSegExtra->iOrgSegNo = (KU32)(pSegExtra - &pModMachO->aSegments[0]); \
pSegExtra->cSections = 0; \
pSegExtra->paSections = pSectExtra; \
} while (0)
- /* Closes the new segment - parter of NEW_SEGMENT. */
+ /* Closes the new segment - part of NEW_SEGMENT. */
#define CLOSE_SEGMENT() \
do { \
- pSegExtra->cSections = pSectExtra - pSegExtra->paSections; \
+ pSegExtra->cSections = (KU32)(pSectExtra - pSegExtra->paSections); \
pSegExtra++; \
pDstSeg++; \
} while (0)
@@ -1253,7 +1253,7 @@ static int kldrModMachOParseLoadCommands(PKLDRMODMACHO pModMachO, char *pbStrin
else \
pSectExtra->offFixups = -1; \
pSectExtra->fFlags = pSect->flags; \
- pSectExtra->iSegment = pSegExtra - &pModMachO->aSegments[0]; \
+ pSectExtra->iSegment = (KU32)(pSegExtra - &pModMachO->aSegments[0]); \
pSectExtra->pvMachoSection = pSect; \
\
/* Update the segment alignment, if we're not skipping it. */ \
@@ -1374,7 +1374,7 @@ static int kldrModMachOParseLoadCommands(PKLDRMODMACHO pModMachO, char *pbStrin
{
cb = pDstSeg[1].RVA - pDstSeg->RVA;
- pDstSeg->cbMapped = (KSIZE)cb == cb ? cb : KSIZE_MAX;
+ pDstSeg->cbMapped = (KSIZE)cb == cb ? (KSIZE)cb : KSIZE_MAX;
}
cb = KLDR_ALIGN_ADDR(pDstSeg->cb, pDstSeg->Alignment);
@@ -1404,10 +1404,10 @@ static int kldrModMachOParseLoadCommands(PKLDRMODMACHO pModMachO, char *pbStrin
*/
if (pModMachO->fMakeGot)
{
- KSIZE cbPtr = ( pModMachO->Hdr.magic == IMAGE_MACHO32_SIGNATURE
- || pModMachO->Hdr.magic == IMAGE_MACHO32_SIGNATURE_OE)
- ? sizeof(KU32)
- : sizeof(KU64);
+ KU32 cbPtr = ( pModMachO->Hdr.magic == IMAGE_MACHO32_SIGNATURE
+ || pModMachO->Hdr.magic == IMAGE_MACHO32_SIGNATURE_OE)
+ ? sizeof(KU32)
+ : sizeof(KU64);
KU32 cbGot = pModMachO->cSymbols * cbPtr;
KU32 cbJmpStubs;
@@ -1439,7 +1439,7 @@ static int kldrModMachOParseLoadCommands(PKLDRMODMACHO pModMachO, char *pbStrin
pDstSeg->offFile = -1;
pDstSeg->cbFile = -1;
pDstSeg->RVA = pModMachO->GotRVA;
- pDstSeg->cbMapped = KLDR_ALIGN_ADDR(cbGot + cbJmpStubs, pDstSeg->Alignment);
+ pDstSeg->cbMapped = (KSIZE)KLDR_ALIGN_ADDR(cbGot + cbJmpStubs, pDstSeg->Alignment);
pDstSeg->MapAddress = 0;
pSegExtra->iOrgSegNo = KU32_MAX;
@@ -1701,11 +1701,11 @@ static int kldrModMachOQuerySymbol(PKLDRMOD pMod, const void *pvBits, KLDRADDR B
|| pModMachO->Hdr.magic == IMAGE_MACHO32_SIGNATURE_OE)
rc = kldrModMachODoQuerySymbol32Bit(pModMachO, (macho_nlist_32_t *)pModMachO->pvaSymbols, pModMachO->cSymbols,
pModMachO->pchStrings, pModMachO->cchStrings, BaseAddress, iSymbol, pchSymbol,
- cchSymbol, puValue, pfKind);
+ (KU32)cchSymbol, puValue, pfKind);
else
rc = kldrModMachODoQuerySymbol64Bit(pModMachO, (macho_nlist_64_t *)pModMachO->pvaSymbols, pModMachO->cSymbols,
pModMachO->pchStrings, pModMachO->cchStrings, BaseAddress, iSymbol, pchSymbol,
- cchSymbol, puValue, pfKind);
+ (KU32)cchSymbol, puValue, pfKind);
}
/*
@@ -1749,9 +1749,9 @@ static int kldrModMachOQuerySymbol(PKLDRMOD pMod, const void *pvBits, KLDRADDR B
* @param puValue See kLdrModQuerySymbol.
* @param pfKind See kLdrModQuerySymbol.
*/
-static int kldrModMachODoQuerySymbol32Bit(PKLDRMODMACHO pModMachO, const macho_nlist_32_t *paSyms, KU32 cSyms, const char *pchStrings,
- KU32 cchStrings, KLDRADDR BaseAddress, KU32 iSymbol, const char *pchSymbol, KSIZE cchSymbol,
- PKLDRADDR puValue, KU32 *pfKind)
+static int kldrModMachODoQuerySymbol32Bit(PKLDRMODMACHO pModMachO, const macho_nlist_32_t *paSyms, KU32 cSyms,
+ const char *pchStrings, KU32 cchStrings, KLDRADDR BaseAddress, KU32 iSymbol,
+ const char *pchSymbol, KU32 cchSymbol, PKLDRADDR puValue, KU32 *pfKind)
{
/*
* Find a valid symbol matching the search criteria.
@@ -1877,9 +1877,9 @@ static int kldrModMachODoQuerySymbol32Bit(PKLDRMODMACHO pModMachO, const macho_n
* @param puValue See kLdrModQuerySymbol.
* @param pfKind See kLdrModQuerySymbol.
*/
-static int kldrModMachODoQuerySymbol64Bit(PKLDRMODMACHO pModMachO, const macho_nlist_64_t *paSyms, KU32 cSyms, const char *pchStrings,
- KU32 cchStrings, KLDRADDR BaseAddress, KU32 iSymbol, const char *pchSymbol, KSIZE cchSymbol,
- PKLDRADDR puValue, KU32 *pfKind)
+static int kldrModMachODoQuerySymbol64Bit(PKLDRMODMACHO pModMachO, const macho_nlist_64_t *paSyms, KU32 cSyms,
+ const char *pchStrings, KU32 cchStrings, KLDRADDR BaseAddress, KU32 iSymbol,
+ const char *pchSymbol, KU32 cchSymbol, PKLDRADDR puValue, KU32 *pfKind)
{
/*
* Find a valid symbol matching the search criteria.
@@ -3597,7 +3597,7 @@ static int kldrModMachOMakeGOT(PKLDRMODMACHO pModMachO, void *pvBits, KLDRADDR N
PKLDRMODMACHOSECT pSymSect;
KLDRMODMACHO_CHECK_RETURN((KU32)paSyms[iSym].n_sect - 1 <= pModMachO->cSections, KLDR_ERR_MACHO_BAD_SYMBOL);
pSymSect = &pModMachO->paSections[paSyms[iSym].n_sect - 1];
- paGOT[iSym] = paSyms[iSym].n_value - pSymSect->LinkAddress + pSymSect->RVA + NewBaseAddress;
+ paGOT[iSym] = (KU32)(paSyms[iSym].n_value - pSymSect->LinkAddress + pSymSect->RVA + NewBaseAddress);
break;
}
@@ -3653,7 +3653,7 @@ static int kldrModMachOMakeGOT(PKLDRMODMACHO pModMachO, void *pvBits, KLDRADDR N
} Tmpl;
/* create the template. */
- off = pModMachO->GotRVA - (pModMachO->JmpStubsRVA + 6);
+ off = (KI32)(pModMachO->GotRVA - (pModMachO->JmpStubsRVA + 6));
Tmpl.ab[0] = 0xff; /* jmp [GOT-entry wrt RIP] */
Tmpl.ab[1] = 0x25;
Tmpl.ab[2] = off & 0xff;
diff --git a/src/lib/kStuff/kLdr/kLdrModPE.c b/src/lib/kStuff/kLdr/kLdrModPE.c
index 1379572..d829053 100644
--- a/src/lib/kStuff/kLdr/kLdrModPE.c
+++ b/src/lib/kStuff/kLdr/kLdrModPE.c
@@ -1,4 +1,4 @@
-/* $Id: kLdrModPE.c 85 2016-09-06 03:21:04Z bird $ */
+/* $Id: kLdrModPE.c 89 2016-09-07 13:32:53Z bird $ */
/** @file
* kLdr - The Module Interpreter for the Portable Executable (PE) Format.
*/
@@ -229,11 +229,11 @@ static int kldrModPEDoCreate(PKRDR pRdr, KLDRFOFF offNewHdr, PKLDRMODPE *ppModPE
pMod->pRdr = pRdr;
pMod->pOps = NULL; /* set upon success. */
pMod->cSegments = s.FileHdr.NumberOfSections + 1;
- pMod->cchFilename = cchFilename;
+ pMod->cchFilename = (KU32)cchFilename;
pMod->pszFilename = (char *)&pMod->aSegments[pMod->cSegments];
kHlpMemCopy((char *)pMod->pszFilename, kRdrName(pRdr), cchFilename + 1);
pMod->pszName = kHlpGetFilename(pMod->pszFilename);
- pMod->cchName = cchFilename - (pMod->pszName - pMod->pszFilename);
+ pMod->cchName = (KU32)(cchFilename - (pMod->pszName - pMod->pszFilename));
pMod->fFlags = 0;
switch (s.FileHdr.Machine)
{
@@ -324,6 +324,7 @@ static int kldrModPEDoCreate(PKRDR pRdr, KLDRFOFF offNewHdr, PKLDRMODPE *ppModPE
for (i = 0; i < pModPE->Hdrs.FileHeader.NumberOfSections; i++)
{
const char *pch;
+ KU32 cb2;
/* unused */
pMod->aSegments[i + 1].pvUser = NULL;
@@ -334,24 +335,24 @@ static int kldrModPEDoCreate(PKRDR pRdr, KLDRFOFF offNewHdr, PKLDRMODPE *ppModPE
/* name */
pMod->aSegments[i + 1].pchName = pch = (const char *)&pModPE->aShdrs[i].Name[0];
- cb = IMAGE_SIZEOF_SHORT_NAME;
- while ( cb > 0
- && (pch[cb - 1] == ' ' || pch[cb - 1] == '\0'))
- cb--;
- pMod->aSegments[i + 1].cchName = cb;
+ cb2 = IMAGE_SIZEOF_SHORT_NAME;
+ while ( cb2 > 0
+ && (pch[cb2 - 1] == ' ' || pch[cb2 - 1] == '\0'))
+ cb2--;
+ pMod->aSegments[i + 1].cchName = cb2;
/* size and addresses */
if (!(pModPE->aShdrs[i].Characteristics & IMAGE_SCN_TYPE_NOLOAD))
{
/* Kluge to deal with wlink ".reloc" sections that has a VirtualSize of 0 bytes. */
- KU32 cb = pModPE->aShdrs[i].Misc.VirtualSize;
- if (!cb)
- cb = K_ALIGN_Z(pModPE->aShdrs[i].SizeOfRawData, pModPE->Hdrs.OptionalHeader.SectionAlignment);
+ cb2 = pModPE->aShdrs[i].Misc.VirtualSize;
+ if (!cb2)
+ cb2 = K_ALIGN_Z(pModPE->aShdrs[i].SizeOfRawData, pModPE->Hdrs.OptionalHeader.SectionAlignment);
pMod->aSegments[i + 1].cb = pModPE->aShdrs[i].Misc.VirtualSize;
pMod->aSegments[i + 1].LinkAddress = pModPE->aShdrs[i].VirtualAddress
+ pModPE->Hdrs.OptionalHeader.ImageBase;
pMod->aSegments[i + 1].RVA = pModPE->aShdrs[i].VirtualAddress;
- pMod->aSegments[i + 1].cbMapped = cb;
+ pMod->aSegments[i + 1].cbMapped = cb2;
if (i + 2 < pMod->cSegments)
pMod->aSegments[i + 1].cbMapped= pModPE->aShdrs[i + 1].VirtualAddress
- pModPE->aShdrs[i].VirtualAddress;
@@ -369,7 +370,7 @@ static int kldrModPEDoCreate(PKRDR pRdr, KLDRFOFF offNewHdr, PKLDRMODPE *ppModPE
pMod->aSegments[i + 1].cbFile = pModPE->aShdrs[i].SizeOfRawData;
if ( pMod->aSegments[i + 1].cbMapped > 0 /* if mapped */
&& (KLDRSIZE)pMod->aSegments[i + 1].cbFile > pMod->aSegments[i + 1].cbMapped)
- pMod->aSegments[i + 1].cbFile = pMod->aSegments[i + 1].cbMapped;
+ pMod->aSegments[i + 1].cbFile = (KLDRFOFF)(pMod->aSegments[i + 1].cbMapped);
/* protection */
switch ( pModPE->aShdrs[i].Characteristics
@@ -858,7 +859,7 @@ static int kldrModPEDoForwarderQuery(PKLDRMODPE pModPE, const void *pvBits, cons
pszSymbol++;
if (!*pszSymbol)
return KLDR_ERR_PE_BAD_FORWARDER;
- cchImpModule = pszSymbol - pszForwarder;
+ cchImpModule = (KU32)(pszSymbol - pszForwarder);
pszSymbol++; /* skip the dot */
if (!*pszSymbol)
@@ -1295,7 +1296,7 @@ static int kldrModPEAllocTLS(PKLDRMOD pMod, void *pvMapping)
*/
if (pvMapping == KLDRMOD_INT_MAP)
{
- pvMapping = pModPE->pvMapping;
+ pvMapping = (void *)pModPE->pvMapping;
if (!pvMapping)
return KLDR_ERR_NOT_MAPPED;
}
@@ -1321,7 +1322,7 @@ static void kldrModPEFreeTLS(PKLDRMOD pMod, void *pvMapping)
*/
if (pvMapping == KLDRMOD_INT_MAP)
{
- pvMapping = pModPE->pvMapping;
+ pvMapping = (void *)pModPE->pvMapping;
if (!pvMapping)
return;
}
@@ -1730,7 +1731,7 @@ static int kldrModPECallInit(PKLDRMOD pMod, void *pvMapping, KUPTR uHandle)
*/
if (pvMapping == KLDRMOD_INT_MAP)
{
- pvMapping = pModPE->pvMapping;
+ pvMapping = (void *)pModPE->pvMapping;
if (!pvMapping)
return KLDR_ERR_NOT_MAPPED;
}
@@ -1888,7 +1889,7 @@ static int kldrModPECallTerm(PKLDRMOD pMod, void *pvMapping, KUPTR uHandle)
*/
if (pvMapping == KLDRMOD_INT_MAP)
{
- pvMapping = pModPE->pvMapping;
+ pvMapping = (void *)pModPE->pvMapping;
if (!pvMapping)
return KLDR_ERR_NOT_MAPPED;
}
@@ -1916,7 +1917,7 @@ static int kldrModPECallThread(PKLDRMOD pMod, void *pvMapping, KUPTR uHandle, un
*/
if (pvMapping == KLDRMOD_INT_MAP)
{
- pvMapping = pModPE->pvMapping;
+ pvMapping = (void *)pModPE->pvMapping;
if (!pvMapping)
return KLDR_ERR_NOT_MAPPED;
}
diff --git a/src/lib/quote_argv.c b/src/lib/quote_argv.c
index 9c4559a..016f945 100644
--- a/src/lib/quote_argv.c
+++ b/src/lib/quote_argv.c
@@ -1,4 +1,4 @@
-/* $Id: quote_argv.c 2851 2016-08-31 17:30:52Z bird $ */
+/* $Id: quote_argv.c 2894 2016-09-08 13:27:56Z bird $ */
/** @file
* quote_argv - Correctly quote argv for spawn, windows specific.
*/
@@ -113,6 +113,8 @@ void quote_argv(int argc, char **argv, int fWatcomBrainDamage, int fFreeOrLeak)
|| (pszProblem = (const char *)memchr(pszOrg, '\'', cchOrg)) != NULL
|| ( !fWatcomBrainDamage
&& (pszProblem = (const char *)memchr(pszOrg, '=', cchOrg)) != NULL)
+ || ( fWatcomBrainDamage
+ && (pszProblem = (const char *)memchr(pszOrg, '\\', cchOrg)) != NULL)
)
{
char ch;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-virtualbox/kbuild.git
More information about the Pkg-virtualbox-commits
mailing list