aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rw-r--r--build/arm-wince-vs8/armasmv5.rules20
-rw-r--r--build/arm-wince-vs8/armasmv6.rules20
-rw-r--r--build/arm-wince-vs8/armasmxscale.rules20
-rw-r--r--build/arm-wince-vs8/obj_int_extract.bat13
-rw-r--r--build/arm-wince-vs8/vpx.sln88
-rwxr-xr-xbuild/make/Makefile13
-rwxr-xr-xbuild/make/armlink_adapter.sh6
-rwxr-xr-xbuild/make/configure.sh56
-rwxr-xr-xbuild/make/gen_msvs_proj.sh662
-rwxr-xr-xbuild/make/gen_msvs_sln.sh3
-rw-r--r--build/make/obj_int_extract.c702
-rw-r--r--build/x86-msvs/obj_int_extract.bat15
12 files changed, 817 insertions, 801 deletions
diff --git a/build/arm-wince-vs8/armasmv5.rules b/build/arm-wince-vs8/armasmv5.rules
deleted file mode 100644
index efb80bcb2..000000000
--- a/build/arm-wince-vs8/armasmv5.rules
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<VisualStudioToolFile
- Name="armasm"
- Version="8.00"
- >
- <Rules>
- <CustomBuildRule
- Name="ARMASM"
- DisplayName="Armasm Assembler"
- CommandLine="armasm -o &quot;$(IntDir)\$(InputName).obj&quot; $(InputPath) -32 -ARCH 5&#x0D;&#x0A;"
- Outputs="$(IntDir)\$(InputName).obj"
- FileExtensions="*.asm"
- ExecutionDescription="Assembling $(InputName).asm"
- ShowOnlyRuleProperties="false"
- >
- <Properties>
- </Properties>
- </CustomBuildRule>
- </Rules>
-</VisualStudioToolFile>
diff --git a/build/arm-wince-vs8/armasmv6.rules b/build/arm-wince-vs8/armasmv6.rules
deleted file mode 100644
index 67c6bc9d8..000000000
--- a/build/arm-wince-vs8/armasmv6.rules
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<VisualStudioToolFile
- Name="armasm"
- Version="8.00"
- >
- <Rules>
- <CustomBuildRule
- Name="ARMASM"
- DisplayName="Armasm Assembler"
- CommandLine="armasm -o &quot;$(IntDir)\$(InputName).obj&quot; $(InputPath) -32 -ARCH 6&#x0D;&#x0A;"
- Outputs="$(IntDir)\$(InputName).obj"
- FileExtensions="*.asm"
- ExecutionDescription="Assembling $(InputName).asm"
- ShowOnlyRuleProperties="false"
- >
- <Properties>
- </Properties>
- </CustomBuildRule>
- </Rules>
-</VisualStudioToolFile>
diff --git a/build/arm-wince-vs8/armasmxscale.rules b/build/arm-wince-vs8/armasmxscale.rules
deleted file mode 100644
index 4da9d1e82..000000000
--- a/build/arm-wince-vs8/armasmxscale.rules
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<VisualStudioToolFile
- Name="armasm"
- Version="8.00"
- >
- <Rules>
- <CustomBuildRule
- Name="ARMASM"
- DisplayName="Armasm Assembler"
- CommandLine="armasm -o &quot;$(IntDir)\$(InputName).obj&quot; $(InputPath) -32 -cpu XSCALE&#x0D;&#x0A;"
- Outputs="$(IntDir)\$(InputName).obj"
- FileExtensions="*.asm"
- ExecutionDescription="Assembling $(InputName).asm"
- ShowOnlyRuleProperties="false"
- >
- <Properties>
- </Properties>
- </CustomBuildRule>
- </Rules>
-</VisualStudioToolFile>
diff --git a/build/arm-wince-vs8/obj_int_extract.bat b/build/arm-wince-vs8/obj_int_extract.bat
deleted file mode 100644
index a361fc346..000000000
--- a/build/arm-wince-vs8/obj_int_extract.bat
+++ /dev/null
@@ -1,13 +0,0 @@
-@echo off
-REM Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-REM
-REM Use of this source code is governed by a BSD-style license
-REM that can be found in the LICENSE file in the root of the source
-REM tree. An additional intellectual property rights grant can be found
-REM in the file PATENTS. All contributing project authors may
-REM be found in the AUTHORS file in the root of the source tree.
-echo on
-
-
-cl /I ".\\" /I "..\vp6_decoder_sdk" /I "..\vp6_decoder_sdk\vpx_ports" /D "NDEBUG" /D "_WIN32_WCE=0x420" /D "UNDER_CE" /D "WIN32_PLATFORM_PSPC" /D "WINCE" /D "_LIB" /D "ARM" /D "_ARM_" /D "_UNICODE" /D "UNICODE" /FD /EHsc /MT /GS- /fp:fast /GR- /Fo"Pocket_PC_2003__ARMV4_\%1/" /Fd"Pocket_PC_2003__ARMV4_\%1/vc80.pdb" /W3 /nologo /c /TC ..\vp6_decoder_sdk\vp6_decoder\algo\common\arm\dec_asm_offsets_arm.c
-obj_int_extract.exe rvds "Pocket_PC_2003__ARMV4_\%1/dec_asm_offsets_arm.obj"
diff --git a/build/arm-wince-vs8/vpx.sln b/build/arm-wince-vs8/vpx.sln
deleted file mode 100644
index 3e49929f2..000000000
--- a/build/arm-wince-vs8/vpx.sln
+++ /dev/null
@@ -1,88 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual Studio 2005
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example", "example.vcproj", "{BA5FE66F-38DD-E034-F542-B1578C5FB950}"
- ProjectSection(ProjectDependencies) = postProject
- {DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74} = {DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74}
- {E1360C65-D375-4335-8057-7ED99CC3F9B2} = {E1360C65-D375-4335-8057-7ED99CC3F9B2}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "obj_int_extract", "obj_int_extract.vcproj", "{E1360C65-D375-4335-8057-7ED99CC3F9B2}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vpx", "vpx.vcproj", "{DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74}"
- ProjectSection(ProjectDependencies) = postProject
- {E1360C65-D375-4335-8057-7ED99CC3F9B2} = {E1360C65-D375-4335-8057-7ED99CC3F9B2}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xma", "xma.vcproj", "{A955FC4A-73F1-44F7-135E-30D84D32F022}"
- ProjectSection(ProjectDependencies) = postProject
- {E1360C65-D375-4335-8057-7ED99CC3F9B2} = {E1360C65-D375-4335-8057-7ED99CC3F9B2}
- {DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74} = {DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74}
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Mixed Platforms = Debug|Mixed Platforms
- Debug|Pocket PC 2003 (ARMV4) = Debug|Pocket PC 2003 (ARMV4)
- Debug|Win32 = Debug|Win32
- Release|Mixed Platforms = Release|Mixed Platforms
- Release|Pocket PC 2003 (ARMV4) = Release|Pocket PC 2003 (ARMV4)
- Release|Win32 = Release|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {BA5FE66F-38DD-E034-F542-B1578C5FB950}.Debug|Mixed Platforms.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
- {BA5FE66F-38DD-E034-F542-B1578C5FB950}.Debug|Mixed Platforms.Build.0 = Debug|Pocket PC 2003 (ARMV4)
- {BA5FE66F-38DD-E034-F542-B1578C5FB950}.Debug|Mixed Platforms.Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
- {BA5FE66F-38DD-E034-F542-B1578C5FB950}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
- {BA5FE66F-38DD-E034-F542-B1578C5FB950}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug|Pocket PC 2003 (ARMV4)
- {BA5FE66F-38DD-E034-F542-B1578C5FB950}.Debug|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
- {BA5FE66F-38DD-E034-F542-B1578C5FB950}.Debug|Win32.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
- {BA5FE66F-38DD-E034-F542-B1578C5FB950}.Release|Mixed Platforms.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
- {BA5FE66F-38DD-E034-F542-B1578C5FB950}.Release|Mixed Platforms.Build.0 = Release|Pocket PC 2003 (ARMV4)
- {BA5FE66F-38DD-E034-F542-B1578C5FB950}.Release|Mixed Platforms.Deploy.0 = Release|Pocket PC 2003 (ARMV4)
- {BA5FE66F-38DD-E034-F542-B1578C5FB950}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4)
- {BA5FE66F-38DD-E034-F542-B1578C5FB950}.Release|Pocket PC 2003 (ARMV4).Build.0 = Release|Pocket PC 2003 (ARMV4)
- {BA5FE66F-38DD-E034-F542-B1578C5FB950}.Release|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Pocket PC 2003 (ARMV4)
- {BA5FE66F-38DD-E034-F542-B1578C5FB950}.Release|Win32.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
- {E1360C65-D375-4335-8057-7ED99CC3F9B2}.Debug|Mixed Platforms.ActiveCfg = Release|Win32
- {E1360C65-D375-4335-8057-7ED99CC3F9B2}.Debug|Mixed Platforms.Build.0 = Release|Win32
- {E1360C65-D375-4335-8057-7ED99CC3F9B2}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Win32
- {E1360C65-D375-4335-8057-7ED99CC3F9B2}.Debug|Win32.ActiveCfg = Release|Win32
- {E1360C65-D375-4335-8057-7ED99CC3F9B2}.Debug|Win32.Build.0 = Release|Win32
- {E1360C65-D375-4335-8057-7ED99CC3F9B2}.Release|Mixed Platforms.ActiveCfg = Release|Win32
- {E1360C65-D375-4335-8057-7ED99CC3F9B2}.Release|Mixed Platforms.Build.0 = Release|Win32
- {E1360C65-D375-4335-8057-7ED99CC3F9B2}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Win32
- {E1360C65-D375-4335-8057-7ED99CC3F9B2}.Release|Win32.ActiveCfg = Release|Win32
- {E1360C65-D375-4335-8057-7ED99CC3F9B2}.Release|Win32.Build.0 = Release|Win32
- {DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74}.Debug|Mixed Platforms.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
- {DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74}.Debug|Mixed Platforms.Build.0 = Debug|Pocket PC 2003 (ARMV4)
- {DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74}.Debug|Mixed Platforms.Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
- {DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
- {DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug|Pocket PC 2003 (ARMV4)
- {DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74}.Debug|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
- {DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74}.Debug|Win32.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
- {DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74}.Release|Mixed Platforms.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
- {DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74}.Release|Mixed Platforms.Build.0 = Release|Pocket PC 2003 (ARMV4)
- {DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74}.Release|Mixed Platforms.Deploy.0 = Release|Pocket PC 2003 (ARMV4)
- {DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4)
- {DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74}.Release|Pocket PC 2003 (ARMV4).Build.0 = Release|Pocket PC 2003 (ARMV4)
- {DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74}.Release|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Pocket PC 2003 (ARMV4)
- {DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74}.Release|Win32.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
- {A955FC4A-73F1-44F7-135E-30D84D32F022}.Debug|Mixed Platforms.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
- {A955FC4A-73F1-44F7-135E-30D84D32F022}.Debug|Mixed Platforms.Build.0 = Debug|Pocket PC 2003 (ARMV4)
- {A955FC4A-73F1-44F7-135E-30D84D32F022}.Debug|Mixed Platforms.Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
- {A955FC4A-73F1-44F7-135E-30D84D32F022}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
- {A955FC4A-73F1-44F7-135E-30D84D32F022}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug|Pocket PC 2003 (ARMV4)
- {A955FC4A-73F1-44F7-135E-30D84D32F022}.Debug|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
- {A955FC4A-73F1-44F7-135E-30D84D32F022}.Debug|Win32.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
- {A955FC4A-73F1-44F7-135E-30D84D32F022}.Release|Mixed Platforms.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
- {A955FC4A-73F1-44F7-135E-30D84D32F022}.Release|Mixed Platforms.Build.0 = Release|Pocket PC 2003 (ARMV4)
- {A955FC4A-73F1-44F7-135E-30D84D32F022}.Release|Mixed Platforms.Deploy.0 = Release|Pocket PC 2003 (ARMV4)
- {A955FC4A-73F1-44F7-135E-30D84D32F022}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4)
- {A955FC4A-73F1-44F7-135E-30D84D32F022}.Release|Pocket PC 2003 (ARMV4).Build.0 = Release|Pocket PC 2003 (ARMV4)
- {A955FC4A-73F1-44F7-135E-30D84D32F022}.Release|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Pocket PC 2003 (ARMV4)
- {A955FC4A-73F1-44F7-135E-30D84D32F022}.Release|Win32.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/build/make/Makefile b/build/make/Makefile
index 40fa6d50c..64d3c934b 100755
--- a/build/make/Makefile
+++ b/build/make/Makefile
@@ -152,8 +152,8 @@ endif
# Rule to extract assembly constants from C sources
#
obj_int_extract: build/make/obj_int_extract.c
- $(if $(quiet),echo " [HOSTCC] $@")
- $(qexec)$(HOSTCC) -I. -o $@ $<
+ $(if $(quiet),@echo " [HOSTCC] $@")
+ $(qexec)$(HOSTCC) -I. -I$(SRC_PATH_BARE) -o $@ $<
CLEAN-OBJS += obj_int_extract
#
@@ -255,7 +255,7 @@ ifeq ($(filter clean,$(MAKECMDGOALS)),)
endif
#
-# Configuration dependant rules
+# Configuration dependent rules
#
$(call pairmap,install_map_templates,$(INSTALL_MAPS))
@@ -331,11 +331,8 @@ ifneq ($(call enabled,DIST-SRCS),)
DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_sln.sh
DIST-SRCS-$(CONFIG_MSVS) += build/x86-msvs/yasm.rules
DIST-SRCS-$(CONFIG_RVCT) += build/make/armlink_adapter.sh
- #
- # This isn't really ARCH_ARM dependent, it's dependant on whether we're
- # using assembly code or not (CONFIG_OPTIMIZATIONS maybe). Just use
- # this for now.
- DIST-SRCS-$(ARCH_ARM) += build/make/obj_int_extract.c
+ # Include obj_int_extract if we use offsets from asm_*_offsets
+ DIST-SRCS-$(ARCH_ARM)$(ARCH_X86)$(ARCH_X86_64) += build/make/obj_int_extract.c
DIST-SRCS-$(ARCH_ARM) += build/make/ads2gas.pl
DIST-SRCS-yes += $(target:-$(TOOLCHAIN)=).mk
endif
diff --git a/build/make/armlink_adapter.sh b/build/make/armlink_adapter.sh
index 571e46ec3..b53669c9b 100755
--- a/build/make/armlink_adapter.sh
+++ b/build/make/armlink_adapter.sh
@@ -17,15 +17,17 @@ for i; do
on_of=1
elif [ "$i" == "-v" ]; then
verbose=1
+ elif [ "$i" == "-g" ]; then
+ args="${args} --debug"
elif [ "$on_of" == "1" ]; then
outfile=$i
- on_of=0
+ on_of=0
elif [ -f "$i" ]; then
infiles="$infiles $i"
elif [ "${i:0:2}" == "-l" ]; then
libs="$libs ${i#-l}"
elif [ "${i:0:2}" == "-L" ]; then
- libpaths="${libpaths} ${i#-L}"
+ libpaths="${libpaths} ${i#-L}"
else
args="${args} ${i}"
fi
diff --git a/build/make/configure.sh b/build/make/configure.sh
index d25d6400e..a48fd9faf 100755
--- a/build/make/configure.sh
+++ b/build/make/configure.sh
@@ -78,11 +78,12 @@ Build options:
--log=yes|no|FILE file configure log is written to [config.err]
--target=TARGET target platform tuple [generic-gnu]
--cpu=CPU optimize for a specific cpu rather than a family
+ --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
${toggle_extra_warnings} emit harmless warnings (always non-fatal)
${toggle_werror} treat warnings as errors, if possible
(not available with all compilers)
${toggle_optimizations} turn on/off compiler optimization flags
- ${toggle_pic} turn on/off Position Independant Code
+ ${toggle_pic} turn on/off Position Independent Code
${toggle_ccache} turn on/off compiler cache
${toggle_debug} enable/disable debug mode
${toggle_gprof} enable/disable gprof profiling instrumentation
@@ -442,6 +443,9 @@ process_common_cmdline() {
;;
--cpu=*) tune_cpu="$optval"
;;
+ --extra-cflags=*)
+ extra_cflags="${optval}"
+ ;;
--enable-?*|--disable-?*)
eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
echo "${CMDLINE_SELECT} ${ARCH_EXT_LIST}" | grep "^ *$option\$" >/dev/null || die_unknown $opt
@@ -547,6 +551,10 @@ process_common_toolchain() {
tgt_isa=universal
tgt_os=darwin9
;;
+ *darwin10*)
+ tgt_isa=x86_64
+ tgt_os=darwin10
+ ;;
*mingw32*|*cygwin*)
[ -z "$tgt_isa" ] && tgt_isa=x86
tgt_os=win32
@@ -606,10 +614,20 @@ process_common_toolchain() {
add_ldflags "-isysroot /Developer/SDKs/MacOSX10.5.sdk"
add_ldflags "-mmacosx-version-min=10.5"
;;
+ *-darwin10-*)
+ add_cflags "-isysroot /Developer/SDKs/MacOSX10.6.sdk"
+ add_cflags "-mmacosx-version-min=10.6"
+ add_ldflags "-isysroot /Developer/SDKs/MacOSX10.6.sdk"
+ add_ldflags "-mmacosx-version-min=10.6"
+ ;;
esac
# Handle Solaris variants. Solaris 10 needs -lposix4
case ${toolchain} in
+ sparc-solaris-*)
+ add_extralibs -lposix4
+ add_cflags "-DMUST_BE_ALIGNED"
+ ;;
*-solaris-*)
add_extralibs -lposix4
;;
@@ -650,12 +668,12 @@ process_common_toolchain() {
elif enabled armv7
then
check_add_cflags -march=armv7-a -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp #-ftree-vectorize
- check_add_asflags -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp #-march=armv7-a
+ check_add_asflags -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp #-march=armv7-a
else
check_add_cflags -march=${tgt_isa}
check_add_asflags -march=${tgt_isa}
fi
-
+ enabled debug && add_asflags -g
asm_conversion_cmd="${source_path}/build/make/ads2gas.pl"
;;
rvct)
@@ -680,16 +698,24 @@ process_common_toolchain() {
arch_int=${tgt_isa##armv}
arch_int=${arch_int%%te}
check_add_asflags --pd "\"ARCHITECTURE SETA ${arch_int}\""
+ enabled debug && add_asflags -g
+ add_cflags --gnu
+ add_cflags --enum_is_int
+ add_cflags --wchar32
;;
esac
case ${tgt_os} in
+ none*)
+ disable multithread
+ disable os_support
+ ;;
darwin*)
SDK_PATH=/Developer/Platforms/iPhoneOS.platform/Developer
TOOLCHAIN_PATH=${SDK_PATH}/usr/bin
CC=${TOOLCHAIN_PATH}/gcc
AR=${TOOLCHAIN_PATH}/ar
- LD=${TOOLCHAIN_PATH}/arm-apple-darwin9-gcc-4.2.1
+ LD=${TOOLCHAIN_PATH}/arm-apple-darwin10-gcc-4.2.1
AS=${TOOLCHAIN_PATH}/as
STRIP=${TOOLCHAIN_PATH}/strip
NM=${TOOLCHAIN_PATH}/nm
@@ -703,14 +729,14 @@ process_common_toolchain() {
add_cflags -arch ${tgt_isa}
add_ldflags -arch_only ${tgt_isa}
- add_cflags "-isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk"
+ add_cflags "-isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk"
# This should be overridable
- alt_libc=${SDK_PATH}/SDKs/iPhoneOS3.1.sdk
+ alt_libc=${SDK_PATH}/SDKs/iPhoneOS4.2.sdk
# Add the paths for the alternate libc
# for d in usr/include usr/include/gcc/darwin/4.0/; do
- for d in usr/include usr/include/gcc/darwin/4.0/ usr/lib/gcc/arm-apple-darwin9/4.0.1/include/; do
+ for d in usr/include usr/include/gcc/darwin/4.0/ usr/lib/gcc/arm-apple-darwin10/4.2.1/include/; do
try_dir="${alt_libc}/${d}"
[ -d "${try_dir}" ] && add_cflags -I"${try_dir}"
done
@@ -732,13 +758,9 @@ process_common_toolchain() {
|| die "Must supply --libc when targetting *-linux-rvct"
# Set up compiler
- add_cflags --gnu
- add_cflags --enum_is_int
add_cflags --library_interface=aeabi_glibc
add_cflags --no_hide_all
- add_cflags --wchar32
add_cflags --dwarf2
- add_cflags --gnu
# Set up linker
add_ldflags --sysv --no_startup --no_ref_cpp_init
@@ -845,7 +867,7 @@ process_common_toolchain() {
setup_gnu_toolchain
add_cflags -use-msasm -use-asm
add_ldflags -i-static
- enabled x86_64 && add_cflags -ipo -no-prec-div -static -xSSE3 -axSSE3
+ enabled x86_64 && add_cflags -ipo -no-prec-div -static -xSSE2 -axSSE2
enabled x86_64 && AR=xiar
case ${tune_cpu} in
atom*)
@@ -880,7 +902,7 @@ process_common_toolchain() {
case ${tgt_os} in
win*)
add_asflags -f win${bits}
- enabled debug && add_asflags -g dwarf2
+ enabled debug && add_asflags -g cv8
;;
linux*|solaris*)
add_asflags -f elf${bits}
@@ -935,7 +957,7 @@ process_common_toolchain() {
enabled small && check_add_cflags -O2 || check_add_cflags -O3
fi
- # Position Independant Code (PIC) support, for building relocatable
+ # Position Independent Code (PIC) support, for building relocatable
# shared objects
enabled gcc && enabled pic && check_add_cflags -fPIC
@@ -962,6 +984,12 @@ EOF
add_cflags -D_LARGEFILE_SOURCE
add_cflags -D_FILE_OFFSET_BITS=64
fi
+
+ # append any user defined extra cflags
+ if [ -n "${extra_cflags}" ] ; then
+ check_add_cflags ${extra_cflags} || \
+ die "Requested extra CFLAGS '${extra_cflags}' not supported by compiler"
+ fi
}
process_toolchain() {
diff --git a/build/make/gen_msvs_proj.sh b/build/make/gen_msvs_proj.sh
index 584477f92..c2ef44a9b 100755
--- a/build/make/gen_msvs_proj.sh
+++ b/build/make/gen_msvs_proj.sh
@@ -32,7 +32,8 @@ Options:
--name=project_name Name of the project (required)
--proj-guid=GUID GUID to use for the project
--module-def=filename File containing export definitions (for DLLs)
- --ver=version Version (7,8) of visual studio to generate for
+ --ver=version Version (7,8,9) of visual studio to generate for
+ --src-path-bare=dir Path to root of source tree
-Ipath/to/include Additional include directories
-DFLAG[=value] Preprocessor macros to define
-Lpath/to/lib Additional library search paths
@@ -132,7 +133,7 @@ generate_filter() {
open_tag Filter \
Name=$name \
Filter=$pats \
- UniqueIdentifier=`generate_uuid`
+ UniqueIdentifier=`generate_uuid` \
file_list_sz=${#file_list[@]}
for i in ${!file_list[@]}; do
@@ -145,31 +146,21 @@ generate_filter() {
if [ "$pat" == "asm" ] && $asm_use_custom_step; then
for plat in "${platforms[@]}"; do
for cfg in Debug Release; do
- open_tag FileConfiguration \
- Name="${cfg}|${plat}"
+ open_tag FileConfiguration \
+ Name="${cfg}|${plat}" \
+
tag Tool \
Name="VCCustomBuildTool" \
Description="Assembling \$(InputFileName)" \
- CommandLine="$(eval echo \$asm_${cfg}_cmdline)"\
- Outputs="\$(InputName).obj"
+ CommandLine="$(eval echo \$asm_${cfg}_cmdline)" \
+ Outputs="\$(InputName).obj" \
+
close_tag FileConfiguration
done
done
fi
- if [ "${f##*.}" == "cpp" ]; then
- for plat in "${platforms[@]}"; do
- for cfg in Debug Release; do
- open_tag FileConfiguration \
- Name="${cfg}|${plat}"
- tag Tool \
- Name="VCCLCompilerTool" \
- CompileAs="2"
- close_tag FileConfiguration
- done
- done
- fi
- close_tag File
+ close_tag File
break
fi
@@ -185,57 +176,63 @@ unset target
for opt in "$@"; do
optval="${opt#*=}"
case "$opt" in
- --help|-h) show_help
- ;;
- --target=*) target="${optval}"
- ;;
- --out=*) outfile="$optval"
- ;;
- --name=*) name="${optval}"
- ;;
- --proj-guid=*) guid="${optval}"
- ;;
- --module-def=*)
- link_opts="${link_opts} ModuleDefinitionFile=${optval}"
- ;;
- --exe) proj_kind="exe"
- ;;
- --lib) proj_kind="lib"
- ;;
- --static-crt) use_static_runtime=true
- ;;
- --ver=*) vs_ver="$optval"
- case $optval in
- [789])
- ;;
- *) die Unrecognized Visual Studio Version in $opt
- ;;
- esac
- ;;
- -I*) opt="${opt%/}"
- incs="${incs}${incs:+;}&quot;${opt##-I}&quot;"
- yasmincs="${yasmincs} ${opt}"
- ;;
- -D*) defines="${defines}${defines:+;}${opt##-D}"
- ;;
- -L*) # fudge . to $(OutDir)
- if [ "${opt##-L}" == "." ]; then
- libdirs="${libdirs}${libdirs:+;}&quot;\$(OutDir)&quot;"
- else
- # Also try directories for this platform/configuration
- libdirs="${libdirs}${libdirs:+;}&quot;${opt##-L}&quot;"
- libdirs="${libdirs}${libdirs:+;}&quot;${opt##-L}/\$(PlatformName)/\$(ConfigurationName)&quot;"
- libdirs="${libdirs}${libdirs:+;}&quot;${opt##-L}/\$(PlatformName)&quot;"
- fi
- ;;
- -l*) libs="${libs}${libs:+ }${opt##-l}.lib"
- ;;
- -*) die_unknown $opt
- ;;
- *) file_list[${#file_list[@]}]="$opt"
- case "$opt" in
- *.asm) uses_asm=true;;
- esac
+ --help|-h) show_help
+ ;;
+ --target=*) target="${optval}"
+ ;;
+ --out=*) outfile="$optval"
+ ;;
+ --name=*) name="${optval}"
+ ;;
+ --proj-guid=*) guid="${optval}"
+ ;;
+ --module-def=*) link_opts="${link_opts} ModuleDefinitionFile=${optval}"
+ ;;
+ --exe) proj_kind="exe"
+ ;;
+ --lib) proj_kind="lib"
+ ;;
+ --src-path-bare=*) src_path_bare="$optval"
+ ;;
+ --static-crt) use_static_runtime=true
+ ;;
+ --ver=*)
+ vs_ver="$optval"
+ case "$optval" in
+ [789])
+ ;;
+ *) die Unrecognized Visual Studio Version in $opt
+ ;;
+ esac
+ ;;
+ -I*)
+ opt="${opt%/}"
+ incs="${incs}${incs:+;}&quot;${opt##-I}&quot;"
+ yasmincs="${yasmincs} ${opt}"
+ ;;
+ -D*) defines="${defines}${defines:+;}${opt##-D}"
+ ;;
+ -L*) # fudge . to $(OutDir)
+ if [ "${opt##-L}" == "." ]; then
+ libdirs="${libdirs}${libdirs:+;}&quot;\$(OutDir)&quot;"
+ else
+ # Also try directories for this platform/configuration
+ libdirs="${libdirs}${libdirs:+;}&quot;${opt##-L}&quot;"
+ libdirs="${libdirs}${libdirs:+;}&quot;${opt##-L}/\$(PlatformName)/\$(ConfigurationName)&quot;"
+ libdirs="${libdirs}${libdirs:+;}&quot;${opt##-L}/\$(PlatformName)&quot;"
+ fi
+ ;;
+ -l*) libs="${libs}${libs:+ }${opt##-l}.lib"
+ ;;
+ -*) die_unknown $opt
+ ;;
+ *)
+ file_list[${#file_list[@]}]="$opt"
+ case "$opt" in
+ *.asm) uses_asm=true
+ ;;
+ esac
+ ;;
esac
done
outfile=${outfile:-/dev/stdout}
@@ -278,11 +275,7 @@ done
# List Keyword for this target
case "$target" in
- x86*)
- keyword="ManagedCProj"
- ;;
- arm*|iwmmx*)
- keyword="Win32Proj"
+ x86*) keyword="ManagedCProj"
;;
*) die "Unsupported target $target!"
esac
@@ -298,402 +291,255 @@ case "$target" in
asm_Debug_cmdline="yasm -Xvc -g cv8 -f \$(PlatformName) ${yasmincs} &quot;\$(InputPath)&quot;"
asm_Release_cmdline="yasm -Xvc -f \$(PlatformName) ${yasmincs} &quot;\$(InputPath)&quot;"
;;
- arm*|iwmmx*)
- case "${name}" in
- obj_int_extract) platforms[0]="Win32"
- ;;
- *) platforms[0]="Pocket PC 2003 (ARMV4)"
- ;;
- esac
- ;;
*) die "Unsupported target $target!"
-esac
-
-# List Command-line Arguments for this target
-case "$target" in
- arm*|iwmmx*)
- if [ "$name" == "example" ];then
- ARGU="--codec vp6 --flipuv --progress _bnd.vp6"
- fi
- if [ "$name" == "xma" ];then
- ARGU="--codec vp6 -h 240 -w 320 -v"
- fi
;;
esac
generate_vcproj() {
case "$proj_kind" in
- exe) vs_ConfigurationType=1
- ;;
- *) vs_ConfigurationType=4
- ;;
+ exe) vs_ConfigurationType=1
+ ;;
+ *) vs_ConfigurationType=4
+ ;;
esac
echo "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>"
- open_tag VisualStudioProject \
- ProjectType="Visual C++" \
- Version="${vs_ver_id}" \
- Name="${name}" \
- ProjectGUID="{${guid}}" \
- RootNamespace="${name}" \
- Keyword="${keyword}"
-
- open_tag Platforms
+ open_tag VisualStudioProject \
+ ProjectType="Visual C++" \
+ Version="${vs_ver_id}" \
+ Name="${name}" \
+ ProjectGUID="{${guid}}" \
+ RootNamespace="${name}" \
+ Keyword="${keyword}" \
+
+ open_tag Platforms
for plat in "${platforms[@]}"; do
- tag Platform Name="$plat"
+ tag Platform Name="$plat"
done
close_tag Platforms
- open_tag ToolFiles
+ open_tag ToolFiles
case "$target" in
x86*) $uses_asm && tag ToolFile RelativePath="$self_dirname/../x86-msvs/yasm.rules"
;;
- arm*|iwmmx*)
- if [ "$name" == "vpx" ];then
- case "$target" in
- armv5*)
- tag ToolFile RelativePath="$self_dirname/../arm-wince-vs8/armasmv5.rules"
- ;;
- armv6*)
- tag ToolFile RelativePath="$self_dirname/../arm-wince-vs8/armasmv6.rules"
- ;;
- iwmmxt*)
- tag ToolFile RelativePath="$self_dirname/../arm-wince-vs8/armasmxscale.rules"
- ;;
- esac
- fi
- ;;
esac
close_tag ToolFiles
- open_tag Configurations
+ open_tag Configurations
for plat in "${platforms[@]}"; do
plat_no_ws=`echo $plat | sed 's/[^A-Za-z0-9_]/_/g'`
- open_tag Configuration \
- Name="Debug|$plat" \
- OutputDirectory="\$(SolutionDir)$plat_no_ws/\$(ConfigurationName)" \
- IntermediateDirectory="$plat_no_ws/\$(ConfigurationName)/${name}" \
- ConfigurationType="$vs_ConfigurationType" \
- CharacterSet="1"
-
- if [ "$target" == "armv6-wince-vs8" ] || [ "$target" == "armv5te-wince-vs8" ] || [ "$target" == "iwmmxt-wince-vs8" ] || [ "$target" == "iwmmxt2-wince-vs8" ];then
- case "$name" in
- vpx) tag Tool \
- Name="VCPreBuildEventTool" \
- CommandLine="call obj_int_extract.bat \$(ConfigurationName)"
- tag Tool \
- Name="VCMIDLTool" \
- TargetEnvironment="1"
- tag Tool \
- Name="VCCLCompilerTool" \
- ExecutionBucket="7" \
- Optimization="0" \
- AdditionalIncludeDirectories="$incs" \
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES);WINCE;DEBUG;_LIB;\$(ARCHFAM);\$(_ARCHFAM_);_UNICODE;UNICODE;" \
- MinimalRebuild="true" \
- RuntimeLibrary="1" \
- BufferSecurityCheck="false" \
- UsePrecompiledHeader="0" \
- WarningLevel="3" \
- DebugInformationFormat="1" \
- CompileAs="1"
- tag Tool \
- Name="VCResourceCompilerTool" \
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES)" \
- Culture="1033" \
- AdditionalIncludeDirectories="\$(IntDir)" \
- ;;
- example|xma) tag Tool \
- Name="VCCLCompilerTool" \
- ExecutionBucket="7" \
- Optimization="0" \
- AdditionalIncludeDirectories="$incs" \
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES);WINCE;DEBUG;_CONSOLE;\$(ARCHFAM);\$(_ARCHFAM_);_UNICODE;UNICODE;" \
- MinimalRebuild="true" \
- RuntimeLibrary="1" \
- BufferSecurityCheck="false" \
- UsePrecompiledHeader="0" \
- WarningLevel="3" \
- DebugInformationFormat="1" \
- CompileAs="1"
- tag Tool \
- Name="VCResourceCompilerTool" \
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES)" \
- Culture="1033" \
- AdditionalIncludeDirectories="\$(IntDir)" \
- ;;
- obj_int_extract) tag Tool \
- Name="VCCLCompilerTool" \
- Optimization="0" \
- AdditionalIncludeDirectories="$incs" \
- PreprocessorDefinitions="WIN32;DEBUG;_CONSOLE" \
- RuntimeLibrary="1" \
- WarningLevel="3" \
- DebugInformationFormat="1" \
- ;;
- esac
- fi
+ open_tag Configuration \
+ Name="Debug|$plat" \
+ OutputDirectory="\$(SolutionDir)$plat_no_ws/\$(ConfigurationName)" \
+ IntermediateDirectory="$plat_no_ws/\$(ConfigurationName)/${name}" \
+ ConfigurationType="$vs_ConfigurationType" \
+ CharacterSet="1" \
case "$target" in
- x86*) tag Tool \
- Name="VCCLCompilerTool" \
- Optimization="0" \
- AdditionalIncludeDirectories="$incs" \
- PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;$defines" \
- RuntimeLibrary="$debug_runtime" \
- UsePrecompiledHeader="0" \
- WarningLevel="3" \
- DebugInformationFormat="1" \
- Detect64BitPortabilityProblems="true" \
-
- $uses_asm && tag Tool Name="YASM" IncludePaths="$incs" Debug="1"
+ x86*)
+ case "$name" in
+ obj_int_extract)
+ tag Tool \
+ Name="VCCLCompilerTool" \
+ Optimization="0" \
+ AdditionalIncludeDirectories="$incs" \
+ PreprocessorDefinitions="WIN32;DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" \
+ RuntimeLibrary="$debug_runtime" \
+ WarningLevel="3" \
+ Detect64BitPortabilityProblems="true" \
+ DebugInformationFormat="1" \
+ ;;
+ vpx)
+ tag Tool \
+ Name="VCPreBuildEventTool" \
+ CommandLine="call obj_int_extract.bat $src_path_bare" \
+
+ tag Tool \
+ Name="VCCLCompilerTool" \
+ Optimization="0" \
+ AdditionalIncludeDirectories="$incs" \
+ PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;$defines" \
+ RuntimeLibrary="$debug_runtime" \
+ UsePrecompiledHeader="0" \
+ WarningLevel="3" \
+ DebugInformationFormat="1" \
+ Detect64BitPortabilityProblems="true" \
+
+ $uses_asm && tag Tool Name="YASM" IncludePaths="$incs" Debug="1"
+ ;;
+ *)
+ tag Tool \
+ Name="VCCLCompilerTool" \
+ Optimization="0" \
+ AdditionalIncludeDirectories="$incs" \
+ PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;$defines" \
+ RuntimeLibrary="$debug_runtime" \
+ UsePrecompiledHeader="0" \
+ WarningLevel="3" \
+ DebugInformationFormat="1" \
+ Detect64BitPortabilityProblems="true" \
+
+ $uses_asm && tag Tool Name="YASM" IncludePaths="$incs" Debug="1"
+ ;;
+ esac
;;
esac
case "$proj_kind" in
exe)
case "$target" in
- x86*) tag Tool \
- Name="VCLinkerTool" \
- AdditionalDependencies="$debug_libs \$(NoInherit)" \
- AdditionalLibraryDirectories="$libdirs" \
- GenerateDebugInformation="true" \
- ProgramDatabaseFile="\$(OutDir)/${name}.pdb" \
-
- ;;
- arm*|iwmmx*)
+ x86*)
case "$name" in
- obj_int_extract) tag Tool \
- Name="VCLinkerTool" \
- OutputFile="${name}.exe" \
- GenerateDebugInformation="true"
+ obj_int_extract)
+ tag Tool \
+ Name="VCLinkerTool" \
+ OutputFile="${name}.exe" \
+ GenerateDebugInformation="true" \
;;
- *) tag Tool \
- Name="VCLinkerTool" \
- AdditionalDependencies="$debug_libs" \
- OutputFile="\$(OutDir)/${name}.exe" \
- LinkIncremental="2" \
- AdditionalLibraryDirectories="${libdirs};&quot;..\lib/$plat_no_ws&quot;" \
- DelayLoadDLLs="\$(NOINHERIT)" \
- GenerateDebugInformation="true" \
- ProgramDatabaseFile="\$(OutDir)/${name}.pdb" \
- SubSystem="9" \
- StackReserveSize="65536" \
- StackCommitSize="4096" \
- EntryPointSymbol="mainWCRTStartup" \
- TargetMachine="3"
+ *)
+ tag Tool \
+ Name="VCLinkerTool" \
+ AdditionalDependencies="$debug_libs \$(NoInherit)" \
+ AdditionalLibraryDirectories="$libdirs" \
+ GenerateDebugInformation="true" \
+ ProgramDatabaseFile="\$(OutDir)/${name}.pdb" \
;;
esac
- ;;
+ ;;
esac
;;
lib)
case "$target" in
- arm*|iwmmx*) tag Tool \
- Name="VCLibrarianTool" \
- AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM" \
- OutputFile="\$(OutDir)/${name}.lib" \
- ;;
- *) tag Tool \
- Name="VCLibrarianTool" \
- OutputFile="\$(OutDir)/${name}${lib_sfx}d.lib" \
- ;;
+ x86*)
+ tag Tool \
+ Name="VCLibrarianTool" \
+ OutputFile="\$(OutDir)/${name}${lib_sfx}d.lib" \
+
+ ;;
esac
;;
- dll) tag Tool \
- Name="VCLinkerTool" \
- AdditionalDependencies="\$(NoInherit)" \
- LinkIncremental="2" \
- GenerateDebugInformation="true" \
- AssemblyDebug="1" \
- TargetMachine="1" \
- $link_opts
+ dll)
+ tag Tool \
+ Name="VCLinkerTool" \
+ AdditionalDependencies="\$(NoInherit)" \
+ LinkIncremental="2" \
+ GenerateDebugInformation="true" \
+ AssemblyDebug="1" \
+ TargetMachine="1" \
+ $link_opts \
+
+ ;;
esac
- if [ "$target" == "armv6-wince-vs8" ] || [ "$target" == "armv5te-wince-vs8" ] || [ "$target" == "iwmmxt-wince-vs8" ] || [ "$target" == "iwmmxt2-wince-vs8" ];then
- case "$name" in
- vpx) tag DeploymentTool \
- ForceDirty="-1" \
- RegisterOutput="0"
- ;;
- example|xma) tag DeploymentTool \
- ForceDirty="-1" \
- RegisterOutput="0"
- tag DebuggerTool \
- Arguments="${ARGU}"
- ;;
- esac
- fi
close_tag Configuration
- open_tag Configuration \
- Name="Release|$plat" \
- OutputDirectory="\$(SolutionDir)$plat_no_ws/\$(ConfigurationName)" \
- IntermediateDirectory="$plat_no_ws/\$(ConfigurationName)/${name}" \
- ConfigurationType="$vs_ConfigurationType" \
- CharacterSet="1" \
- WholeProgramOptimization="0"
-
- if [ "$target" == "armv6-wince-vs8" ] || [ "$target" == "armv5te-wince-vs8" ] || [ "$target" == "iwmmxt-wince-vs8" ] || [ "$target" == "iwmmxt2-wince-vs8" ];then
- case "$name" in
- vpx) tag Tool \
- Name="VCPreBuildEventTool" \
- CommandLine="call obj_int_extract.bat \$(ConfigurationName)"
- tag Tool \
- Name="VCMIDLTool" \
- TargetEnvironment="1"
- tag Tool \
- Name="VCCLCompilerTool" \
- ExecutionBucket="7" \
- Optimization="2" \
- FavorSizeOrSpeed="1" \
- AdditionalIncludeDirectories="$incs" \
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES);WINCE;_LIB;\$(ARCHFAM);\$(_ARCHFAM_);_UNICODE;UNICODE;" \
- RuntimeLibrary="0" \
- BufferSecurityCheck="false" \
- UsePrecompiledHeader="0" \
- WarningLevel="3" \
- DebugInformationFormat="0" \
- CompileAs="1"
- tag Tool \
- Name="VCResourceCompilerTool" \
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES)" \
- Culture="1033" \
- AdditionalIncludeDirectories="\$(IntDir)" \
- ;;
- example|xma) tag Tool \
- Name="VCCLCompilerTool" \
- ExecutionBucket="7" \
- Optimization="2" \
- FavorSizeOrSpeed="1" \
- AdditionalIncludeDirectories="$incs" \
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES);WINCE;_CONSOLE;\$(ARCHFAM);\$(_ARCHFAM_);_UNICODE;UNICODE;" \
- RuntimeLibrary="0" \
- BufferSecurityCheck="false" \
- UsePrecompiledHeader="0" \
- WarningLevel="3" \
- DebugInformationFormat="0" \
- CompileAs="1"
- tag Tool \
- Name="VCResourceCompilerTool" \
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES)" \
- Culture="1033" \
- AdditionalIncludeDirectories="\$(IntDir)" \
- ;;
- obj_int_extract) tag Tool \
- Name="VCCLCompilerTool" \
- AdditionalIncludeDirectories="$incs" \
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" \
- RuntimeLibrary="0" \
- UsePrecompiledHeader="0" \
- WarningLevel="3" \
- Detect64BitPortabilityProblems="true" \
- DebugInformationFormat="0" \
- ;;
- esac
- fi
+ open_tag Configuration \
+ Name="Release|$plat" \
+ OutputDirectory="\$(SolutionDir)$plat_no_ws/\$(ConfigurationName)" \
+ IntermediateDirectory="$plat_no_ws/\$(ConfigurationName)/${name}" \
+ ConfigurationType="$vs_ConfigurationType" \
+ CharacterSet="1" \
+ WholeProgramOptimization="0" \
- case "$target" in
- x86*) tag Tool \
- Name="VCCLCompilerTool" \
- AdditionalIncludeDirectories="$incs" \
- PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;$defines" \
- RuntimeLibrary="$release_runtime" \
- UsePrecompiledHeader="0" \
- WarningLevel="3" \
- DebugInformationFormat="0" \
- Detect64BitPortabilityProblems="true"
-
- $uses_asm && tag Tool Name="YASM" IncludePaths="$incs"
- ;;
+ case "$target" in
+ x86*)
+ case "$name" in
+ obj_int_extract)
+ tag Tool \
+ Name="VCCLCompilerTool" \
+ AdditionalIncludeDirectories="$incs" \
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" \
+ RuntimeLibrary="$release_runtime" \
+ UsePrecompiledHeader="0" \
+ WarningLevel="3" \
+ Detect64BitPortabilityProblems="true" \
+ DebugInformationFormat="0" \
+ ;;
+ vpx)
+ tag Tool \
+ Name="VCPreBuildEventTool" \
+ CommandLine="call obj_int_extract.bat $src_path_bare" \
+
+ tag Tool \
+ Name="VCCLCompilerTool" \
+ AdditionalIncludeDirectories="$incs" \
+ PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;$defines" \
+ RuntimeLibrary="$release_runtime" \
+ UsePrecompiledHeader="0" \
+ WarningLevel="3" \
+ DebugInformationFormat="0" \
+ Detect64BitPortabilityProblems="true" \
+
+ $uses_asm && tag Tool Name="YASM" IncludePaths="$incs"
+ ;;
+ *)
+ tag Tool \
+ Name="VCCLCompilerTool" \
+ AdditionalIncludeDirectories="$incs" \
+ PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;$defines" \
+ RuntimeLibrary="$release_runtime" \
+ UsePrecompiledHeader="0" \
+ WarningLevel="3" \
+ DebugInformationFormat="0" \
+ Detect64BitPortabilityProblems="true" \
+
+ $uses_asm && tag Tool Name="YASM" IncludePaths="$incs"
+ ;;
esac
+ ;;
+ esac
case "$proj_kind" in
exe)
case "$target" in
- x86*) tag Tool \
- Name="VCLinkerTool" \
- AdditionalDependencies="$libs \$(NoInherit)" \
- AdditionalLibraryDirectories="$libdirs" \
- ;;
- arm*|iwmmx*)
+ x86*)
case "$name" in
- obj_int_extract) tag Tool \
- Name="VCLinkerTool" \
- OutputFile="${name}.exe" \
- LinkIncremental="1" \
- GenerateDebugInformation="false" \
- SubSystem="0" \
- OptimizeReferences="0" \
- EnableCOMDATFolding="0" \
- TargetMachine="0"
+ obj_int_extract)
+ tag Tool \
+ Name="VCLinkerTool" \
+ OutputFile="${name}.exe" \
+ GenerateDebugInformation="true" \
;;
- *) tag Tool \
- Name="VCLinkerTool" \
- AdditionalDependencies="$libs" \
- OutputFile="\$(OutDir)/${name}.exe" \
- LinkIncremental="1" \
- AdditionalLibraryDirectories="${libdirs};&quot;..\lib/$plat_no_ws&quot;" \
- DelayLoadDLLs="\$(NOINHERIT)" \
- GenerateDebugInformation="true" \
- ProgramDatabaseFile="\$(OutDir)/${name}.pdb" \
- SubSystem="9" \
- StackReserveSize="65536" \
- StackCommitSize="4096" \
- OptimizeReferences="2" \
- EnableCOMDATFolding="2" \
- EntryPointSymbol="mainWCRTStartup" \
- TargetMachine="3"
+ *)
+ tag Tool \
+ Name="VCLinkerTool" \
+ AdditionalDependencies="$libs \$(NoInherit)" \
+ AdditionalLibraryDirectories="$libdirs" \
+
;;
esac
- ;;
+ ;;
esac
;;
- lib)
+ lib)
case "$target" in
- arm*|iwmmx*) tag Tool \
- Name="VCLibrarianTool" \
- AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM" \
- OutputFile="\$(OutDir)/${name}.lib" \
- ;;
- *) tag Tool \
- Name="VCLibrarianTool" \
- OutputFile="\$(OutDir)/${name}${lib_sfx}.lib" \
- ;;
+ x86*)
+ tag Tool \
+ Name="VCLibrarianTool" \
+ OutputFile="\$(OutDir)/${name}${lib_sfx}.lib" \
+
+ ;;
esac
- ;;
- dll) # note differences to debug version: LinkIncremental, AssemblyDebug
- tag Tool \
- Name="VCLinkerTool" \
- AdditionalDependencies="\$(NoInherit)" \
- LinkIncremental="1" \
- GenerateDebugInformation="true" \
- TargetMachine="1" \
- $link_opts
- esac
+ ;;
+ dll) # note differences to debug version: LinkIncremental, AssemblyDebug
+ tag Tool \
+ Name="VCLinkerTool" \
+ AdditionalDependencies="\$(NoInherit)" \
+ LinkIncremental="1" \
+ GenerateDebugInformation="true" \
+ TargetMachine="1" \
+ $link_opts \
- if [ "$target" == "armv6-wince-vs8" ] || [ "$target" == "armv5te-wince-vs8" ] || [ "$target" == "iwmmxt-wince-vs8" ] || [ "$target" == "iwmmxt2-wince-vs8" ];then
- case "$name" in
- vpx) tag DeploymentTool \
- ForceDirty="-1" \
- RegisterOutput="0"
- ;;
- example|xma) tag DeploymentTool \
- ForceDirty="-1" \
- RegisterOutput="0"
- tag DebuggerTool \
- Arguments="${ARGU}"
- ;;
- esac
- fi
+ ;;
+ esac
close_tag Configuration
done
close_tag Configurations
- open_tag Files
- generate_filter srcs "Source Files" "cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- generate_filter hdrs "Header Files" "h;hpp;hxx;hm;inl;inc;xsd"
+ open_tag Files
+ generate_filter srcs "Source Files" "c;def;odl;idl;hpj;bat;asm;asmx"
+ generate_filter hdrs "Header Files" "h;hm;inl;inc;xsd"
generate_filter resrcs "Resource Files" "rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
generate_filter resrcs "Build Files" "mk"
close_tag Files
diff --git a/build/make/gen_msvs_sln.sh b/build/make/gen_msvs_sln.sh
index 9cf090067..240678b64 100755
--- a/build/make/gen_msvs_sln.sh
+++ b/build/make/gen_msvs_sln.sh
@@ -139,9 +139,6 @@ process_global() {
echo "${indent}${proj_guid}.${config}.ActiveCfg = ${config}"
echo "${indent}${proj_guid}.${config}.Build.0 = ${config}"
- if [ "$target" == "armv6-wince-vs8" ] || [ "$target" == "armv5te-wince-vs8" ] || [ "$target" == "iwmmxt-wince-vs8" ] || [ "$target" == "iwmmxt2-wince-vs8" ];then
- echo "${indent}${proj_guid}.${config}.Deploy.0 = ${config}"
- fi
done
IFS=${IFS_bak}
done
diff --git a/build/make/obj_int_extract.c b/build/make/obj_int_extract.c
index e01870f27..c46d9d58b 100644
--- a/build/make/obj_int_extract.c
+++ b/build/make/obj_int_extract.c
@@ -14,7 +14,7 @@
#include "vpx_config.h"
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) || defined(__MINGW32__)
#include <io.h>
#include <share.h>
#include "vpx/vpx_integer.h"
@@ -59,20 +59,47 @@ int parse_macho(uint8_t *base_buf, size_t sz)
struct mach_header header;
uint8_t *buf = base_buf;
int base_data_section = 0;
-
+ int bits = 0;
+
+ /* We can read in mach_header for 32 and 64 bit architectures
+ * because it's identical to mach_header_64 except for the last
+ * element (uint32_t reserved), which we don't use. Then, when
+ * we know which architecture we're looking at, increment buf
+ * appropriately.
+ */
memcpy(&header, buf, sizeof(struct mach_header));
- buf += sizeof(struct mach_header);
- if (header.magic != MH_MAGIC)
+ if (header.magic == MH_MAGIC)
{
- log_msg("Bad magic number for object file. 0x%x expected, 0x%x found.\n",
- header.magic, MH_MAGIC);
- goto bail;
+ if (header.cputype == CPU_TYPE_ARM
+ || header.cputype == CPU_TYPE_X86)
+ {
+ bits = 32;
+ buf += sizeof(struct mach_header);
+ }
+ else
+ {
+ log_msg("Bad cputype for object file. Currently only tested for CPU_TYPE_[ARM|X86].\n");
+ goto bail;
+ }
}
-
- if (header.cputype != CPU_TYPE_ARM)
+ else if (header.magic == MH_MAGIC_64)
+ {
+ if (header.cputype == CPU_TYPE_X86_64)
+ {
+ bits = 64;
+ buf += sizeof(struct mach_header_64);
+ }
+ else
+ {
+ log_msg("Bad cputype for object file. Currently only tested for CPU_TYPE_X86_64.\n");
+ goto bail;
+ }
+ }
+ else
{
- log_msg("Bad cputype for object file. Currently only tested for CPU_TYPE_ARM.\n");
+ log_msg("Bad magic number for object file. 0x%x or 0x%x expected, 0x%x found.\n",
+ MH_MAGIC, MH_MAGIC_64, header.magic);
goto bail;
}
@@ -85,8 +112,6 @@ int parse_macho(uint8_t *base_buf, size_t sz)
for (i = 0; i < header.ncmds; i++)
{
struct load_command lc;
- struct symtab_command sc;
- struct segment_command seg_c;
memcpy(&lc, buf, sizeof(struct load_command));
@@ -94,50 +119,99 @@ int parse_macho(uint8_t *base_buf, size_t sz)
{
uint8_t *seg_buf = buf;
struct section s;
+ struct segment_command seg_c;
- memcpy(&seg_c, buf, sizeof(struct segment_command));
-
+ memcpy(&seg_c, seg_buf, sizeof(struct segment_command));
seg_buf += sizeof(struct segment_command);
- for (j = 0; j < seg_c.nsects; j++)
+ /* Although each section is given it's own offset, nlist.n_value
+ * references the offset of the first section. This isn't
+ * apparent without debug information because the offset of the
+ * data section is the same as the first section. However, with
+ * debug sections mixed in, the offset of the debug section
+ * increases but n_value still references the first section.
+ */
+ if (seg_c.nsects < 1)
{
- memcpy(&s, seg_buf + (j * sizeof(struct section)), sizeof(struct section));
+ log_msg("Not enough sections\n");
+ goto bail;
+ }
- // Need to get this offset which is the start of the symbol table
- // before matching the strings up with symbols.
- base_data_section = s.offset;
+ memcpy(&s, seg_buf, sizeof(struct section));
+ base_data_section = s.offset;
+ }
+ else if (lc.cmd == LC_SEGMENT_64)
+ {
+ uint8_t *seg_buf = buf;
+ struct section_64 s;
+ struct segment_command_64 seg_c;
+
+ memcpy(&seg_c, seg_buf, sizeof(struct segment_command_64));
+ seg_buf += sizeof(struct segment_command_64);
+
+ /* Explanation in LG_SEGMENT */
+ if (seg_c.nsects < 1)
+ {
+ log_msg("Not enough sections\n");
+ goto bail;
}
+
+ memcpy(&s, seg_buf, sizeof(struct section_64));
+ base_data_section = s.offset;
}
else if (lc.cmd == LC_SYMTAB)
{
- uint8_t *sym_buf = base_buf;
- uint8_t *str_buf = base_buf;
-
if (base_data_section != 0)
{
+ struct symtab_command sc;
+ uint8_t *sym_buf = base_buf;
+ uint8_t *str_buf = base_buf;
+
memcpy(&sc, buf, sizeof(struct symtab_command));
if (sc.cmdsize != sizeof(struct symtab_command))
+ {
log_msg("Can't find symbol table!\n");
+ goto bail;
+ }
sym_buf += sc.symoff;
str_buf += sc.stroff;
for (j = 0; j < sc.nsyms; j++)
{
- struct nlist nl;
- int val;
+ /* Location of string is cacluated each time from the
+ * start of the string buffer. On darwin the symbols
+ * are prefixed by "_", so we bump the pointer by 1.
+ * The target value is defined as an int in asm_*_offsets.c,
+ * which is 4 bytes on all targets we currently use.
+ */
+ if (bits == 32)
+ {
+ struct nlist nl;
+ int val;
- memcpy(&nl, sym_buf + (j * sizeof(struct nlist)), sizeof(struct nlist));
+ memcpy(&nl, sym_buf, sizeof(struct nlist));
+ sym_buf += sizeof(struct nlist);
- val = *((int *)(base_buf + base_data_section + nl.n_value));
+ memcpy(&val, base_buf + base_data_section + nl.n_value,
+ sizeof(val));
+ printf("%-40s EQU %5d\n",
+ str_buf + nl.n_un.n_strx + 1, val);
+ }
+ else /* if (bits == 64) */
+ {
+ struct nlist_64 nl;
+ int val;
+
+ memcpy(&nl, sym_buf, sizeof(struct nlist_64));
+ sym_buf += sizeof(struct nlist_64);
- // Location of string is cacluated each time from the
- // start of the string buffer. On darwin the symbols
- // are prefixed by "_". On other platforms it is not
- // so it needs to be removed. That is the reason for
- // the +1.
- printf("%-40s EQU %5d\n", str_buf + nl.n_un.n_strx + 1, val);
+ memcpy(&val, base_buf + base_data_section + nl.n_value,
+ sizeof(val));
+ printf("%-40s EQU %5d\n",
+ str_buf + nl.n_un.n_strx + 1, val);
+ }
}
}
}
@@ -218,7 +292,7 @@ bail:
return EXIT_FAILURE;
}
-#else
+#elif defined(__ELF__)
#include "elf.h"
#define COPY_STRUCT(dst, buf, ofst, sz) do {\
@@ -237,212 +311,420 @@ bail:
typedef struct
{
- uint8_t *buf; /* Buffer containing ELF data */
- size_t sz; /* Buffer size */
- int le_data; /* Data is little-endian */
- Elf32_Ehdr hdr;
+ uint8_t *buf; /* Buffer containing ELF data */
+ size_t sz; /* Buffer size */
+ int le_data; /* Data is little-endian */
+ unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */
+ int bits; /* 32 or 64 */
+ Elf32_Ehdr hdr32;
+ Elf64_Ehdr hdr64;
} elf_obj_t;
-int parse_elf32_header(elf_obj_t *elf)
+int parse_elf_header(elf_obj_t *elf)
{
int res;
- /* Verify ELF32 header */
- COPY_STRUCT(&elf->hdr, elf->buf, 0, elf->sz);
- res = elf->hdr.e_ident[EI_MAG0] == ELFMAG0;
- res &= elf->hdr.e_ident[EI_MAG1] == ELFMAG1;
- res &= elf->hdr.e_ident[EI_MAG2] == ELFMAG2;
- res &= elf->hdr.e_ident[EI_MAG3] == ELFMAG3;
- res &= elf->hdr.e_ident[EI_CLASS] == ELFCLASS32;
- res &= elf->hdr.e_ident[EI_DATA] == ELFDATA2LSB
- || elf->hdr.e_ident[EI_DATA] == ELFDATA2MSB;
+ /* Verify ELF Magic numbers */
+ COPY_STRUCT(&elf->e_ident, elf->buf, 0, elf->sz);
+ res = elf->e_ident[EI_MAG0] == ELFMAG0;
+ res &= elf->e_ident[EI_MAG1] == ELFMAG1;
+ res &= elf->e_ident[EI_MAG2] == ELFMAG2;
+ res &= elf->e_ident[EI_MAG3] == ELFMAG3;
+ res &= elf->e_ident[EI_CLASS] == ELFCLASS32
+ || elf->e_ident[EI_CLASS] == ELFCLASS64;
+ res &= elf->e_ident[EI_DATA] == ELFDATA2LSB;
if (!res) goto bail;
- elf->le_data = elf->hdr.e_ident[EI_DATA] == ELFDATA2LSB;
-
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr.e_type);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr.e_machine);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr.e_version);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr.e_entry);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr.e_phoff);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr.e_shoff);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr.e_flags);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr.e_ehsize);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr.e_phentsize);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr.e_phnum);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr.e_shentsize);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr.e_shnum);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr.e_shstrndx);
+ elf->le_data = elf->e_ident[EI_DATA] == ELFDATA2LSB;
+
+ /* Read in relevant values */
+ if (elf->e_ident[EI_CLASS] == ELFCLASS32)
+ {
+ elf->bits = 32;
+ COPY_STRUCT(&elf->hdr32, elf->buf, 0, elf->sz);
+
+ ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_type);
+ ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_machine);
+ ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_version);
+ ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_entry);
+ ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_phoff);
+ ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_shoff);
+ ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_flags);
+ ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_ehsize);
+ ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_phentsize);
+ ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_phnum);
+ ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_shentsize);
+ ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_shnum);
+ ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_shstrndx);
+ }
+ else /* if (elf->e_ident[EI_CLASS] == ELFCLASS64) */
+ {
+ elf->bits = 64;
+ COPY_STRUCT(&elf->hdr64, elf->buf, 0, elf->sz);
+
+ ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_type);
+ ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_machine);
+ ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_version);
+ ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_entry);
+ ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_phoff);
+ ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_shoff);
+ ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_flags);
+ ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_ehsize);
+ ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_phentsize);
+ ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_phnum);
+ ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_shentsize);
+ ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_shnum);
+ ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_shstrndx);
+ }
+
return 0;
bail:
+ log_msg("Failed to parse ELF file header");
return 1;
}
-int parse_elf32_section(elf_obj_t *elf, int idx, Elf32_Shdr *hdr)
+int parse_elf_section(elf_obj_t *elf, int idx, Elf32_Shdr *hdr32, Elf64_Shdr *hdr64)
{
- if (idx >= elf->hdr.e_shnum)
- goto bail;
+ if (hdr32)
+ {
+ if (idx >= elf->hdr32.e_shnum)
+ goto bail;
+
+ COPY_STRUCT(hdr32, elf->buf, elf->hdr32.e_shoff + idx * elf->hdr32.e_shentsize,
+ elf->sz);
+ ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_name);
+ ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_type);
+ ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_flags);
+ ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_addr);
+ ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_offset);
+ ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_size);
+ ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_link);
+ ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_info);
+ ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_addralign);
+ ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_entsize);
+ }
+ else /* if (hdr64) */
+ {
+ if (idx >= elf->hdr64.e_shnum)
+ goto bail;
+
+ COPY_STRUCT(hdr64, elf->buf, elf->hdr64.e_shoff + idx * elf->hdr64.e_shentsize,
+ elf->sz);
+ ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_name);
+ ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_type);
+ ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_flags);
+ ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_addr);
+ ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_offset);
+ ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_size);
+ ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_link);
+ ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_info);
+ ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_addralign);
+ ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_entsize);
+ }
- COPY_STRUCT(hdr, elf->buf, elf->hdr.e_shoff + idx * elf->hdr.e_shentsize,
- elf->sz);
- ENDIAN_ASSIGN_IN_PLACE(hdr->sh_name);
- ENDIAN_ASSIGN_IN_PLACE(hdr->sh_type);
- ENDIAN_ASSIGN_IN_PLACE(hdr->sh_flags);
- ENDIAN_ASSIGN_IN_PLACE(hdr->sh_addr);
- ENDIAN_ASSIGN_IN_PLACE(hdr->sh_offset);
- ENDIAN_ASSIGN_IN_PLACE(hdr->sh_size);
- ENDIAN_ASSIGN_IN_PLACE(hdr->sh_link);
- ENDIAN_ASSIGN_IN_PLACE(hdr->sh_info);
- ENDIAN_ASSIGN_IN_PLACE(hdr->sh_addralign);
- ENDIAN_ASSIGN_IN_PLACE(hdr->sh_entsize);
return 0;
bail:
return 1;
}
-char *parse_elf32_string_table(elf_obj_t *elf, int s_idx, int idx)
+char *parse_elf_string_table(elf_obj_t *elf, int s_idx, int idx)
{
- Elf32_Shdr shdr;
-
- if (parse_elf32_section(elf, s_idx, &shdr))
+ if (elf->bits == 32)
{
- log_msg("Failed to parse ELF string table: section %d, index %d\n",
- s_idx, idx);
- return "";
+ Elf32_Shdr shdr;
+
+ if (parse_elf_section(elf, s_idx, &shdr, NULL))
+ {
+ log_msg("Failed to parse ELF string table: section %d, index %d\n",
+ s_idx, idx);
+ return "";
+ }
+
+ return (char *)(elf->buf + shdr.sh_offset + idx);
}
+ else /* if (elf->bits == 64) */
+ {
+ Elf64_Shdr shdr;
- return (char *)(elf->buf + shdr.sh_offset + idx);
+ if (parse_elf_section(elf, s_idx, NULL, &shdr))
+ {
+ log_msg("Failed to parse ELF string table: section %d, index %d\n",
+ s_idx, idx);
+ return "";
+ }
+
+ return (char *)(elf->buf + shdr.sh_offset + idx);
+ }
}
-int parse_elf32_symbol(elf_obj_t *elf, unsigned int ofst, Elf32_Sym *sym)
+int parse_elf_symbol(elf_obj_t *elf, unsigned int ofst, Elf32_Sym *sym32, Elf64_Sym *sym64)
{
- COPY_STRUCT(sym, elf->buf, ofst, elf->sz);
- ENDIAN_ASSIGN_IN_PLACE(sym->st_name);
- ENDIAN_ASSIGN_IN_PLACE(sym->st_value);
- ENDIAN_ASSIGN_IN_PLACE(sym->st_size);
- ENDIAN_ASSIGN_IN_PLACE(sym->st_info);
- ENDIAN_ASSIGN_IN_PLACE(sym->st_other);
- ENDIAN_ASSIGN_IN_PLACE(sym->st_shndx);
+ if (sym32)
+ {
+ COPY_STRUCT(sym32, elf->buf, ofst, elf->sz);
+ ENDIAN_ASSIGN_IN_PLACE(sym32->st_name);
+ ENDIAN_ASSIGN_IN_PLACE(sym32->st_value);
+ ENDIAN_ASSIGN_IN_PLACE(sym32->st_size);
+ ENDIAN_ASSIGN_IN_PLACE(sym32->st_info);
+ ENDIAN_ASSIGN_IN_PLACE(sym32->st_other);
+ ENDIAN_ASSIGN_IN_PLACE(sym32->st_shndx);
+ }
+ else /* if (sym64) */
+ {
+ COPY_STRUCT(sym64, elf->buf, ofst, elf->sz);
+ ENDIAN_ASSIGN_IN_PLACE(sym64->st_name);
+ ENDIAN_ASSIGN_IN_PLACE(sym64->st_value);
+ ENDIAN_ASSIGN_IN_PLACE(sym64->st_size);
+ ENDIAN_ASSIGN_IN_PLACE(sym64->st_info);
+ ENDIAN_ASSIGN_IN_PLACE(sym64->st_other);
+ ENDIAN_ASSIGN_IN_PLACE(sym64->st_shndx);
+ }
return 0;
bail:
return 1;
}
-int parse_elf32(uint8_t *buf, size_t sz, output_fmt_t mode)
+int parse_elf(uint8_t *buf, size_t sz, output_fmt_t mode)
{
- elf_obj_t elf;
- Elf32_Shdr shdr;
+ elf_obj_t elf;
unsigned int ofst;
- int i;
- Elf32_Off strtab_off; /* save String Table offset for later use */
+ int i;
+ Elf32_Off strtab_off32;
+ Elf64_Off strtab_off64; /* save String Table offset for later use */
memset(&elf, 0, sizeof(elf));
elf.buf = buf;
elf.sz = sz;
/* Parse Header */
- if (parse_elf32_header(&elf))
- {
- log_msg("Parse error: File does not appear to be valid ELF32\n");
- return 1;
- }
+ if (parse_elf_header(&elf))
+ goto bail;
- for (i = 0; i < elf.hdr.e_shnum; i++)
+ if (elf.bits == 32)
{
- parse_elf32_section(&elf, i, &shdr);
-
- if (shdr.sh_type == SHT_STRTAB)
+ Elf32_Shdr shdr;
+ for (i = 0; i < elf.hdr32.e_shnum; i++)
{
- char strtsb_name[128];
-
- strcpy(strtsb_name, (char *)(elf.buf + shdr.sh_offset + shdr.sh_name));
+ parse_elf_section(&elf, i, &shdr, NULL);
- if (!(strcmp(strtsb_name, ".shstrtab")))
+ if (shdr.sh_type == SHT_STRTAB)
{
- log_msg("found section: %s\n", strtsb_name);
- strtab_off = shdr.sh_offset;
- break;
+ char strtsb_name[128];
+
+ strcpy(strtsb_name, (char *)(elf.buf + shdr.sh_offset + shdr.sh_name));
+
+ if (!(strcmp(strtsb_name, ".shstrtab")))
+ {
+ /* log_msg("found section: %s\n", strtsb_name); */
+ strtab_off32 = shdr.sh_offset;
+ break;
+ }
}
}
}
-
- /* Parse all Symbol Tables */
- for (i = 0; i < elf.hdr.e_shnum; i++)
+ else /* if (elf.bits == 64) */
{
-
- parse_elf32_section(&elf, i, &shdr);
-
- if (shdr.sh_type == SHT_SYMTAB)
+ Elf64_Shdr shdr;
+ for (i = 0; i < elf.hdr64.e_shnum; i++)
{
- for (ofst = shdr.sh_offset;
- ofst < shdr.sh_offset + shdr.sh_size;
- ofst += shdr.sh_entsize)
+ parse_elf_section(&elf, i, NULL, &shdr);
+
+ if (shdr.sh_type == SHT_STRTAB)
{
- Elf32_Sym sym;
+ char strtsb_name[128];
- parse_elf32_symbol(&elf, ofst, &sym);
+ strcpy(strtsb_name, (char *)(elf.buf + shdr.sh_offset + shdr.sh_name));
- /* For all OBJECTS (data objects), extract the value from the
- * proper data segment.
- */
- if (ELF32_ST_TYPE(sym.st_info) == STT_OBJECT && sym.st_name)
- log_msg("found data object %s\n",
- parse_elf32_string_table(&elf,
- shdr.sh_link,
- sym.st_name));
-
- if (ELF32_ST_TYPE(sym.st_info) == STT_OBJECT
- && sym.st_size == 4)
+ if (!(strcmp(strtsb_name, ".shstrtab")))
{
- Elf32_Shdr dhdr;
- int32_t val;
- char section_name[128];
-
- parse_elf32_section(&elf, sym.st_shndx, &dhdr);
+ /* log_msg("found section: %s\n", strtsb_name); */
+ strtab_off64 = shdr.sh_offset;
+ break;
+ }
+ }
+ }
+ }
- /* For explanition - refer to _MSC_VER version of code */
- strcpy(section_name, (char *)(elf.buf + strtab_off + dhdr.sh_name));
- log_msg("Section_name: %s, Section_type: %d\n", section_name, dhdr.sh_type);
+ /* Parse all Symbol Tables */
+ if (elf.bits == 32)
+ {
+ Elf32_Shdr shdr;
+ for (i = 0; i < elf.hdr32.e_shnum; i++)
+ {
+ parse_elf_section(&elf, i, &shdr, NULL);
- if (!(strcmp(section_name, ".bss")))
+ if (shdr.sh_type == SHT_SYMTAB)
+ {
+ for (ofst = shdr.sh_offset;
+ ofst < shdr.sh_offset + shdr.sh_size;
+ ofst += shdr.sh_entsize)
+ {
+ Elf32_Sym sym;
+
+ parse_elf_symbol(&elf, ofst, &sym, NULL);
+
+ /* For all OBJECTS (data objects), extract the value from the
+ * proper data segment.
+ */
+ /* if (ELF32_ST_TYPE(sym.st_info) == STT_OBJECT && sym.st_name)
+ log_msg("found data object %s\n",
+ parse_elf_string_table(&elf,
+ shdr.sh_link,
+ sym.st_name));
+ */
+
+ if (ELF32_ST_TYPE(sym.st_info) == STT_OBJECT
+ && sym.st_size == 4)
{
- val = 0;
+ Elf32_Shdr dhdr;
+ int val = 0;
+ char section_name[128];
+
+ parse_elf_section(&elf, sym.st_shndx, &dhdr, NULL);
+
+ /* For explanition - refer to _MSC_VER version of code */
+ strcpy(section_name, (char *)(elf.buf + strtab_off32 + dhdr.sh_name));
+ /* log_msg("Section_name: %s, Section_type: %d\n", section_name, dhdr.sh_type); */
+
+ if (strcmp(section_name, ".bss"))
+ {
+ if (sizeof(val) != sym.st_size)
+ {
+ /* The target value is declared as an int in
+ * asm_*_offsets.c, which is 4 bytes on all
+ * targets we currently use. Complain loudly if
+ * this is not true.
+ */
+ log_msg("Symbol size is wrong\n");
+ goto bail;
+ }
+
+ memcpy(&val,
+ elf.buf + dhdr.sh_offset + sym.st_value,
+ sym.st_size);
+ }
+
+ if (!elf.le_data)
+ {
+ log_msg("Big Endian data not supported yet!\n");
+ goto bail;
+ }
+
+ switch (mode)
+ {
+ case OUTPUT_FMT_RVDS:
+ printf("%-40s EQU %5d\n",
+ parse_elf_string_table(&elf,
+ shdr.sh_link,
+ sym.st_name),
+ val);
+ break;
+ case OUTPUT_FMT_GAS:
+ printf(".equ %-40s, %5d\n",
+ parse_elf_string_table(&elf,
+ shdr.sh_link,
+ sym.st_name),
+ val);
+ break;
+ default:
+ printf("%s = %d\n",
+ parse_elf_string_table(&elf,
+ shdr.sh_link,
+ sym.st_name),
+ val);
+ }
}
- else
- {
- memcpy(&val,
- elf.buf + dhdr.sh_offset + sym.st_value,
- sizeof(val));
- }
-
- if (!elf.le_data)
- {
- log_msg("Big Endian data not supported yet!\n");
- goto bail;
- }\
+ }
+ }
+ }
+ }
+ else /* if (elf.bits == 64) */
+ {
+ Elf64_Shdr shdr;
+ for (i = 0; i < elf.hdr64.e_shnum; i++)
+ {
+ parse_elf_section(&elf, i, NULL, &shdr);
- switch (mode)
+ if (shdr.sh_type == SHT_SYMTAB)
+ {
+ for (ofst = shdr.sh_offset;
+ ofst < shdr.sh_offset + shdr.sh_size;
+ ofst += shdr.sh_entsize)
+ {
+ Elf64_Sym sym;
+
+ parse_elf_symbol(&elf, ofst, NULL, &sym);
+
+ /* For all OBJECTS (data objects), extract the value from the
+ * proper data segment.
+ */
+ /* if (ELF64_ST_TYPE(sym.st_info) == STT_OBJECT && sym.st_name)
+ log_msg("found data object %s\n",
+ parse_elf_string_table(&elf,
+ shdr.sh_link,
+ sym.st_name));
+ */
+
+ if (ELF64_ST_TYPE(sym.st_info) == STT_OBJECT
+ && sym.st_size == 4)
{
- case OUTPUT_FMT_RVDS:
- printf("%-40s EQU %5d\n",
- parse_elf32_string_table(&elf,
- shdr.sh_link,
- sym.st_name),
- val);
- break;
- case OUTPUT_FMT_GAS:
- printf(".equ %-40s, %5d\n",
- parse_elf32_string_table(&elf,
- shdr.sh_link,
- sym.st_name),
- val);
- break;
- default:
- printf("%s = %d\n",
- parse_elf32_string_table(&elf,
- shdr.sh_link,
- sym.st_name),
- val);
+ Elf64_Shdr dhdr;
+ int val = 0;
+ char section_name[128];
+
+ parse_elf_section(&elf, sym.st_shndx, NULL, &dhdr);
+
+ /* For explanition - refer to _MSC_VER version of code */
+ strcpy(section_name, (char *)(elf.buf + strtab_off64 + dhdr.sh_name));
+ /* log_msg("Section_name: %s, Section_type: %d\n", section_name, dhdr.sh_type); */
+
+ if ((strcmp(section_name, ".bss")))
+ {
+ if (sizeof(val) != sym.st_size)
+ {
+ /* The target value is declared as an int in
+ * asm_*_offsets.c, which is 4 bytes on all
+ * targets we currently use. Complain loudly if
+ * this is not true.
+ */
+ log_msg("Symbol size is wrong\n");
+ goto bail;
+ }
+
+ memcpy(&val,
+ elf.buf + dhdr.sh_offset + sym.st_value,
+ sym.st_size);
+ }
+
+ if (!elf.le_data)
+ {
+ log_msg("Big Endian data not supported yet!\n");
+ goto bail;
+ }
+
+ switch (mode)
+ {
+ case OUTPUT_FMT_RVDS:
+ printf("%-40s EQU %5d\n",
+ parse_elf_string_table(&elf,
+ shdr.sh_link,
+ sym.st_name),
+ val);
+ break;
+ case OUTPUT_FMT_GAS:
+ printf(".equ %-40s, %5d\n",
+ parse_elf_string_table(&elf,
+ shdr.sh_link,
+ sym.st_name),
+ val);
+ break;
+ default:
+ printf("%s = %d\n",
+ parse_elf_string_table(&elf,
+ shdr.sh_link,
+ sym.st_name),
+ val);
+ }
}
}
}
@@ -454,7 +736,7 @@ int parse_elf32(uint8_t *buf, size_t sz, output_fmt_t mode)
return 0;
bail:
- log_msg("Parse error: File does not appear to be valid ELF32\n");
+ log_msg("Parse error: File does not appear to be valid ELF32 or ELF64\n");
return 1;
}
@@ -521,8 +803,7 @@ int main(int argc, char **argv)
goto bail;
}
- res = parse_elf32(file_buf, stat_buf.st_size, mode);
- //res = parse_coff(file_buf, stat_buf.st_size);
+ res = parse_elf(file_buf, stat_buf.st_size, mode);
free(file_buf);
if (!res)
@@ -535,7 +816,7 @@ bail:
#endif
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) || defined(__MINGW32__)
/* See "Microsoft Portable Executable and Common Object File Format Specification"
for reference.
*/
@@ -549,7 +830,6 @@ int parse_coff(unsigned __int8 *buf, size_t sz)
unsigned int i;
unsigned __int8 *ptr;
unsigned __int32 symoffset;
- FILE *fp;
char **sectionlist; //this array holds all section names in their correct order.
//it is used to check if the symbol is in .bss or .data section.
@@ -560,9 +840,18 @@ int parse_coff(unsigned __int8 *buf, size_t sz)
strtab_ptr = symtab_ptr + symtab_sz * 18;
if (nsections > 96)
- goto bail;
+ {
+ log_msg("Too many sections\n");
+ return 1;
+ }
+
+ sectionlist = malloc(nsections * sizeof(sectionlist));
- sectionlist = malloc(nsections * sizeof * sectionlist);
+ if (sectionlist == NULL)
+ {
+ log_msg("Allocating first level of section list failed\n");
+ return 1;
+ }
//log_msg("COFF: Found %u symbols in %u sections.\n", symtab_sz, nsections);
@@ -580,6 +869,12 @@ int parse_coff(unsigned __int8 *buf, size_t sz)
//log_msg("COFF: Parsing section %s\n",sectionname);
sectionlist[i] = malloc(strlen(sectionname) + 1);
+
+ if (sectionlist[i] == NULL)
+ {
+ log_msg("Allocating storage for %s failed\n", sectionname);
+ goto bail;
+ }
strcpy(sectionlist[i], sectionname);
if (!strcmp(sectionname, ".data")) sectionrawdata_ptr = get_le32(ptr + 20);
@@ -590,14 +885,6 @@ int parse_coff(unsigned __int8 *buf, size_t sz)
//log_msg("COFF: Symbol table at offset %u\n", symtab_ptr);
//log_msg("COFF: raw data pointer ofset for section .data is %u\n", sectionrawdata_ptr);
- fp = fopen("vpx_asm_offsets.asm", "w");
-
- if (fp == NULL)
- {
- perror("open file");
- goto bail;
- }
-
/* The compiler puts the data with non-zero offset in .data section, but puts the data with
zero offset in .bss section. So, if the data in in .bss section, set offset=0.
Note from Wiki: In an object module compiled from C, the bss section contains
@@ -631,13 +918,23 @@ int parse_coff(unsigned __int8 *buf, size_t sz)
char name[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
strncpy(name, ptr, 8);
//log_msg("COFF: Parsing symbol %s\n",name);
- fprintf(fp, "%-40s EQU ", name);
+ /* The 64bit Windows compiler doesn't prefix with an _.
+ * Check what's there, and bump if necessary
+ */
+ if (name[0] == '_')
+ printf("%-40s EQU ", name + 1);
+ else
+ printf("%-40s EQU ", name);
}
else
{
//log_msg("COFF: Parsing symbol %s\n",
// buf + strtab_ptr + get_le32(ptr+4));
- fprintf(fp, "%-40s EQU ", buf + strtab_ptr + get_le32(ptr + 4));
+ if ((buf + strtab_ptr + get_le32(ptr + 4))[0] == '_')
+ printf("%-40s EQU ",
+ buf + strtab_ptr + get_le32(ptr + 4) + 1);
+ else
+ printf("%-40s EQU ", buf + strtab_ptr + get_le32(ptr + 4));
}
if (!(strcmp(sectionlist[section-1], ".bss")))
@@ -654,14 +951,13 @@ int parse_coff(unsigned __int8 *buf, size_t sz)
//log_msg(" Address: %u\n",get_le32(ptr+8));
//log_msg(" Offset: %u\n", symoffset);
- fprintf(fp, "%5d\n", symoffset);
+ printf("%5d\n", symoffset);
}
ptr += 18;
}
- fprintf(fp, " END\n");
- fclose(fp);
+ printf(" END\n");
for (i = 0; i < nsections; i++)
{
@@ -711,11 +1007,7 @@ int main(int argc, char **argv)
else
f = argv[1];
- if (_sopen_s(&fd, f, _O_BINARY, _SH_DENYNO, _S_IREAD | _S_IWRITE))
- {
- perror("Unable to open file");
- goto bail;
- }
+ fd = _sopen(f, _O_BINARY, _SH_DENYNO, _S_IREAD | _S_IWRITE);
if (_fstat(fd, &stat_buf))
{
diff --git a/build/x86-msvs/obj_int_extract.bat b/build/x86-msvs/obj_int_extract.bat
new file mode 100644
index 000000000..1bb865331
--- /dev/null
+++ b/build/x86-msvs/obj_int_extract.bat
@@ -0,0 +1,15 @@
+REM Copyright (c) 2011 The WebM project authors. All Rights Reserved.
+REM
+REM Use of this source code is governed by a BSD-style license
+REM that can be found in the LICENSE file in the root of the source
+REM tree. An additional intellectual property rights grant can be found
+REM in the file PATENTS. All contributing project authors may
+REM be found in the AUTHORS file in the root of the source tree.
+echo on
+
+cl /I "./" /I "%1" /nologo /c "%1/vp8/common/asm_com_offsets.c"
+cl /I "./" /I "%1" /nologo /c "%1/vp8/decoder/asm_dec_offsets.c"
+cl /I "./" /I "%1" /nologo /c "%1/vp8/encoder/asm_enc_offsets.c"
+obj_int_extract.exe rvds "asm_com_offsets.obj" > "asm_com_offsets.asm"
+obj_int_extract.exe rvds "asm_dec_offsets.obj" > "asm_dec_offsets.asm"
+obj_int_extract.exe rvds "asm_enc_offsets.obj" > "asm_enc_offsets.asm"