From 2cc5c8f97c534ff5f1aedddcf5bc3267010e594e Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Wed, 21 Mar 2018 14:09:04 +0200 Subject: [PATCH 1/4] ads2gas: Add a -noelf option This allows skipping elf specific features from the output. Change-Id: I739299ba41286ca10415e056b4ffd561be5e0350 --- build/make/ads2gas.pl | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/build/make/ads2gas.pl b/build/make/ads2gas.pl index 029cc4a56..91609da73 100755 --- a/build/make/ads2gas.pl +++ b/build/make/ads2gas.pl @@ -23,9 +23,11 @@ use lib $FindBin::Bin; use thumb; my $thumb = 0; +my $elf = 1; foreach my $arg (@ARGV) { $thumb = 1 if ($arg eq "-thumb"); + $elf = 0 if ($arg eq "-noelf"); } print "@ This file was created from a .asm file\n"; @@ -140,7 +142,11 @@ while () # Make function visible to linker, and make additional symbol with # prepended underscore - s/EXPORT\s+\|([\$\w]*)\|/.global $1 \n\t.type $1, function/; + if ($elf) { + s/EXPORT\s+\|([\$\w]*)\|/.global $1 \n\t.type $1, function/; + } else { + s/EXPORT\s+\|([\$\w]*)\|/.global $1/; + } s/IMPORT\s+\|([\$\w]*)\|/.global $1/; s/EXPORT\s+([\$\w]*)/.global $1/; @@ -181,11 +187,16 @@ while () # eabi_attributes numerical equivalents can be found in the # "ARM IHI 0045C" document. - # REQUIRE8 Stack is required to be 8-byte aligned - s/\sREQUIRE8/.eabi_attribute 24, 1 \@Tag_ABI_align_needed/g; + if ($elf) { + # REQUIRE8 Stack is required to be 8-byte aligned + s/\sREQUIRE8/.eabi_attribute 24, 1 \@Tag_ABI_align_needed/g; - # PRESERVE8 Stack 8-byte align is preserved - s/\sPRESERVE8/.eabi_attribute 25, 1 \@Tag_ABI_align_preserved/g; + # PRESERVE8 Stack 8-byte align is preserved + s/\sPRESERVE8/.eabi_attribute 25, 1 \@Tag_ABI_align_preserved/g; + } else { + s/\sREQUIRE8//; + s/\sPRESERVE8//; + } # Use PROC and ENDP to give the symbols a .size directive. # This makes them show up properly in debugging tools like gdb and valgrind. @@ -202,7 +213,7 @@ while () my $proc; s/\bENDP\b/@ $&/; $proc = pop(@proc_stack); - $_ = "\t.size $proc, .-$proc".$_ if ($proc); + $_ = "\t.size $proc, .-$proc".$_ if ($proc and $elf); } # EQU directive @@ -225,4 +236,4 @@ while () } # Mark that this object doesn't need an executable stack. -printf ("\t.section\t.note.GNU-stack,\"\",\%\%progbits\n"); +printf ("\t.section\t.note.GNU-stack,\"\",\%\%progbits\n") if $elf; From b08a0b07d4debb232a2b6679c9fd2903dffb9ebe Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Wed, 21 Mar 2018 14:12:04 +0200 Subject: [PATCH 2/4] configure: Add an armv7-win32-gcc target This builds for windows on arm, with llvm-mingw. The target triplet is named -gcc since that's how similar existing targets are named, even though it technically runs clang (via frontends named "$CROSS-gcc"). Assemble using $CC -c since there's no standalone assembler available (except perhaps llvm-mc). Change-Id: I2c9a319730afef73f811bad79f488dcdc244ab0d --- build/make/configure.sh | 14 +++++++++++++- configure | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/build/make/configure.sh b/build/make/configure.sh index 3be9d8c71..60fc36e43 100644 --- a/build/make/configure.sh +++ b/build/make/configure.sh @@ -941,7 +941,6 @@ process_common_toolchain() { setup_gnu_toolchain arch_int=${tgt_isa##armv} arch_int=${arch_int%%te} - check_add_asflags --defsym ARCHITECTURE=${arch_int} tune_cflags="-mtune=" if [ ${tgt_isa} = "armv7" ] || [ ${tgt_isa} = "armv7s" ]; then if [ -z "${float_abi}" ]; then @@ -968,6 +967,19 @@ EOF enabled debug && add_asflags -g asm_conversion_cmd="${source_path}/build/make/ads2gas.pl" + + case ${tgt_os} in + win*) + asm_conversion_cmd="$asm_conversion_cmd -noelf" + AS="$CC -c" + EXE_SFX=.exe + enable_feature thumb + ;; + *) + check_add_asflags --defsym ARCHITECTURE=${arch_int} + ;; + esac + if enabled thumb; then asm_conversion_cmd="$asm_conversion_cmd -thumb" check_add_cflags -mthumb diff --git a/configure b/configure index 3ebcb2648..80198ae26 100755 --- a/configure +++ b/configure @@ -106,6 +106,7 @@ all_platforms="${all_platforms} armv7-darwin-gcc" #neon Cortex-A8 all_platforms="${all_platforms} armv7-linux-rvct" #neon Cortex-A8 all_platforms="${all_platforms} armv7-linux-gcc" #neon Cortex-A8 all_platforms="${all_platforms} armv7-none-rvct" #neon Cortex-A8 +all_platforms="${all_platforms} armv7-win32-gcc" all_platforms="${all_platforms} armv7-win32-vs11" all_platforms="${all_platforms} armv7-win32-vs12" all_platforms="${all_platforms} armv7-win32-vs14" From e9ea629b13c0dfd290c62bb0ef03b1259e156539 Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Wed, 21 Mar 2018 14:13:33 +0200 Subject: [PATCH 3/4] test: Check for ARCH_X86_64 in addition to _WIN64 _WIN64 is also defined when targeting windows on aarch64. Change-Id: I42b84e14079c19d0ba9362a06d8c6e7287644373 --- test/register_state_check.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/register_state_check.h b/test/register_state_check.h index b1cb98335..5f78f1f96 100644 --- a/test/register_state_check.h +++ b/test/register_state_check.h @@ -28,7 +28,7 @@ // See platform implementations of RegisterStateCheckXXX for details. // -#if defined(_WIN64) +#if defined(_WIN64) && ARCH_X86_64 #undef NOMINMAX #define NOMINMAX @@ -138,7 +138,7 @@ class RegisterStateCheck {}; } // namespace libvpx_test -#endif // _WIN64 +#endif // _WIN64 && ARCH_X86_64 #if ARCH_X86 #if defined(__GNUC__) From 8af243cfba0f373dffff3498a83459366633b7ea Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Wed, 21 Mar 2018 14:15:13 +0200 Subject: [PATCH 4/4] configure: Add an arm64-win64-gcc target This configuration doesn't require any extra custom settings, since it only uses neon intrinsics that are handled automatically by the compiler (no external assembly). Change-Id: I35415c68f483a430c0672e060a7bbd09a3469512 --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 80198ae26..2f198e9a6 100755 --- a/configure +++ b/configure @@ -101,6 +101,7 @@ EOF all_platforms="${all_platforms} arm64-android-gcc" all_platforms="${all_platforms} arm64-darwin-gcc" all_platforms="${all_platforms} arm64-linux-gcc" +all_platforms="${all_platforms} arm64-win64-gcc" all_platforms="${all_platforms} armv7-android-gcc" #neon Cortex-A8 all_platforms="${all_platforms} armv7-darwin-gcc" #neon Cortex-A8 all_platforms="${all_platforms} armv7-linux-rvct" #neon Cortex-A8