Rename assembly files with .S extensions.
The openssl files were generated with an .s extension,
which tells GCC that they normally don't need to be sent
to the pre-processor (i.e. they are passed directly to the
assembler).
Unfortunately, all these files _do_ need to be preprocessed,
which is why 'LOCAL_AS_CFLAGS := -x assembler-with-cpp' was
required in Crypto.mk.
As simpler way to solve the issue is simply to use an .S
extension when generating the assembly files. GCC knows
that these must be pre-processed first.
So the patch does:
- Rename all .s files to .S
- Remove the use of -x assembler-with-cpp from Crypto.mk
- Modify import_openssl.sh to directly generate .S files
(tested)
Context: This makes it easier to reuse the exact same sources
for Chrome on Android. Its gyp build system doesn't
have a feature comparable to LOCAL_AS_CFLAGS.
Change-Id: I708d9fbcf8d42b5c39a7d30df2b03ed79a3e62f0
diff --git a/Crypto.mk b/Crypto.mk
index cb1fbaf..6f94f76 100644
--- a/Crypto.mk
+++ b/Crypto.mk
@@ -3,38 +3,38 @@
x86_cflags := -DOPENSSL_BN_ASM_GF2m -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_PART_WORDS -DAES_ASM -DGHASH_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DDES_PTR -DDES_RISC1 -DDES_UNROLL
arm_src_files := \
- crypto/aes/asm/aes-armv4.s \
- crypto/bn/asm/armv4-gf2m.s \
- crypto/bn/asm/armv4-mont.s \
+ crypto/aes/asm/aes-armv4.S \
+ crypto/bn/asm/armv4-gf2m.S \
+ crypto/bn/asm/armv4-mont.S \
crypto/bn/bn_asm.c \
- crypto/modes/asm/ghash-armv4.s \
- crypto/sha/asm/sha1-armv4-large.s \
- crypto/sha/asm/sha256-armv4.s \
- crypto/sha/asm/sha512-armv4.s
+ crypto/modes/asm/ghash-armv4.S \
+ crypto/sha/asm/sha1-armv4-large.S \
+ crypto/sha/asm/sha256-armv4.S \
+ crypto/sha/asm/sha512-armv4.S
mips_src_files := \
- crypto/aes/asm/aes-mips.s \
- crypto/bn/asm/bn-mips.s \
- crypto/bn/asm/mips-mont.s \
- crypto/sha/asm/sha1-mips.s \
- crypto/sha/asm/sha256-mips.s
+ crypto/aes/asm/aes-mips.S \
+ crypto/bn/asm/bn-mips.S \
+ crypto/bn/asm/mips-mont.S \
+ crypto/sha/asm/sha1-mips.S \
+ crypto/sha/asm/sha256-mips.S
x86_src_files := \
- crypto/aes/asm/aes-586.s \
- crypto/aes/asm/vpaes-x86.s \
- crypto/aes/asm/aesni-x86.s \
- crypto/bn/asm/bn-586.s \
- crypto/bn/asm/co-586.s \
- crypto/bn/asm/x86-mont.s \
- crypto/bn/asm/x86-gf2m.s \
- crypto/modes/asm/ghash-x86.s \
- crypto/sha/asm/sha1-586.s \
- crypto/sha/asm/sha256-586.s \
- crypto/sha/asm/sha512-586.s \
- crypto/md5/asm/md5-586.s \
- crypto/des/asm/des-586.s \
- crypto/des/asm/crypt586.s \
- crypto/bf/asm/bf-586.s
+ crypto/aes/asm/aes-586.S \
+ crypto/aes/asm/vpaes-x86.S \
+ crypto/aes/asm/aesni-x86.S \
+ crypto/bn/asm/bn-586.S \
+ crypto/bn/asm/co-586.S \
+ crypto/bn/asm/x86-mont.S \
+ crypto/bn/asm/x86-gf2m.S \
+ crypto/modes/asm/ghash-x86.S \
+ crypto/sha/asm/sha1-586.S \
+ crypto/sha/asm/sha256-586.S \
+ crypto/sha/asm/sha512-586.S \
+ crypto/md5/asm/md5-586.S \
+ crypto/des/asm/des-586.S \
+ crypto/des/asm/crypt586.S \
+ crypto/bf/asm/bf-586.S
x86_exclude_files := \
crypto/aes/aes_cbc.c \
@@ -558,8 +558,6 @@
local_c_flags := -DNO_WINDOWS_BRAINDEATH
-local_as_flags := -x assembler-with-cpp
-
local_c_includes += $(log_c_includes)
local_additional_dependencies := $(LOCAL_PATH)/android-config.mk $(LOCAL_PATH)/Crypto.mk
@@ -578,7 +576,6 @@
LOCAL_SRC_FILES += $(local_src_files)
LOCAL_CFLAGS += $(local_c_flags)
-LOCAL_ASFLAGS += $(local_as_flags)
LOCAL_C_INCLUDES += $(local_c_includes)
ifeq ($(TARGET_ARCH),arm)
LOCAL_SRC_FILES += $(arm_src_files)
@@ -620,7 +617,6 @@
LOCAL_SRC_FILES += $(local_src_files)
LOCAL_CFLAGS += $(local_c_flags)
-LOCAL_ASFLAGS += $(local_as_flags)
LOCAL_C_INCLUDES += $(local_c_includes)
ifeq ($(TARGET_ARCH),arm)
LOCAL_SRC_FILES += $(arm_src_files)
@@ -658,7 +654,6 @@
LOCAL_SRC_FILES += $(other_arch_src_files)
endif
LOCAL_CFLAGS += $(local_c_flags) -DPURIFY
-LOCAL_ASFLAGS += $(local_as_flags)
LOCAL_C_INCLUDES += $(local_c_includes)
LOCAL_LDLIBS += -ldl
LOCAL_MODULE_TAGS := optional
@@ -681,7 +676,6 @@
LOCAL_SRC_FILES += $(other_arch_src_files)
endif
LOCAL_CFLAGS += $(local_c_flags) -DPURIFY
-LOCAL_ASFLAGS += $(local_as_flags)
LOCAL_C_INCLUDES += $(local_c_includes)
LOCAL_LDLIBS += -ldl
LOCAL_MODULE_TAGS := optional
diff --git a/crypto/aes/asm/aes-586.s b/crypto/aes/asm/aes-586.S
similarity index 100%
rename from crypto/aes/asm/aes-586.s
rename to crypto/aes/asm/aes-586.S
diff --git a/crypto/aes/asm/aes-armv4.s b/crypto/aes/asm/aes-armv4.S
similarity index 100%
rename from crypto/aes/asm/aes-armv4.s
rename to crypto/aes/asm/aes-armv4.S
diff --git a/crypto/aes/asm/aes-mips.s b/crypto/aes/asm/aes-mips.S
similarity index 100%
rename from crypto/aes/asm/aes-mips.s
rename to crypto/aes/asm/aes-mips.S
diff --git a/crypto/aes/asm/aesni-x86.s b/crypto/aes/asm/aesni-x86.S
similarity index 100%
rename from crypto/aes/asm/aesni-x86.s
rename to crypto/aes/asm/aesni-x86.S
diff --git a/crypto/aes/asm/vpaes-x86.s b/crypto/aes/asm/vpaes-x86.S
similarity index 100%
rename from crypto/aes/asm/vpaes-x86.s
rename to crypto/aes/asm/vpaes-x86.S
diff --git a/crypto/bf/asm/bf-586.s b/crypto/bf/asm/bf-586.S
similarity index 100%
rename from crypto/bf/asm/bf-586.s
rename to crypto/bf/asm/bf-586.S
diff --git a/crypto/bn/asm/armv4-gf2m.s b/crypto/bn/asm/armv4-gf2m.S
similarity index 100%
rename from crypto/bn/asm/armv4-gf2m.s
rename to crypto/bn/asm/armv4-gf2m.S
diff --git a/crypto/bn/asm/armv4-mont.s b/crypto/bn/asm/armv4-mont.S
similarity index 100%
rename from crypto/bn/asm/armv4-mont.s
rename to crypto/bn/asm/armv4-mont.S
diff --git a/crypto/bn/asm/bn-586.s b/crypto/bn/asm/bn-586.S
similarity index 100%
rename from crypto/bn/asm/bn-586.s
rename to crypto/bn/asm/bn-586.S
diff --git a/crypto/bn/asm/bn-mips.s b/crypto/bn/asm/bn-mips.S
similarity index 100%
rename from crypto/bn/asm/bn-mips.s
rename to crypto/bn/asm/bn-mips.S
diff --git a/crypto/bn/asm/co-586.s b/crypto/bn/asm/co-586.S
similarity index 100%
rename from crypto/bn/asm/co-586.s
rename to crypto/bn/asm/co-586.S
diff --git a/crypto/bn/asm/mips-mont.s b/crypto/bn/asm/mips-mont.S
similarity index 100%
rename from crypto/bn/asm/mips-mont.s
rename to crypto/bn/asm/mips-mont.S
diff --git a/crypto/bn/asm/x86-gf2m.s b/crypto/bn/asm/x86-gf2m.S
similarity index 100%
rename from crypto/bn/asm/x86-gf2m.s
rename to crypto/bn/asm/x86-gf2m.S
diff --git a/crypto/bn/asm/x86-mont.s b/crypto/bn/asm/x86-mont.S
similarity index 100%
rename from crypto/bn/asm/x86-mont.s
rename to crypto/bn/asm/x86-mont.S
diff --git a/crypto/des/asm/crypt586.s b/crypto/des/asm/crypt586.S
similarity index 100%
rename from crypto/des/asm/crypt586.s
rename to crypto/des/asm/crypt586.S
diff --git a/crypto/des/asm/des-586.s b/crypto/des/asm/des-586.S
similarity index 100%
rename from crypto/des/asm/des-586.s
rename to crypto/des/asm/des-586.S
diff --git a/crypto/md5/asm/md5-586.s b/crypto/md5/asm/md5-586.S
similarity index 100%
rename from crypto/md5/asm/md5-586.s
rename to crypto/md5/asm/md5-586.S
diff --git a/crypto/modes/asm/ghash-armv4.s b/crypto/modes/asm/ghash-armv4.S
similarity index 100%
rename from crypto/modes/asm/ghash-armv4.s
rename to crypto/modes/asm/ghash-armv4.S
diff --git a/crypto/modes/asm/ghash-x86.s b/crypto/modes/asm/ghash-x86.S
similarity index 100%
rename from crypto/modes/asm/ghash-x86.s
rename to crypto/modes/asm/ghash-x86.S
diff --git a/crypto/sha/asm/sha1-586.s b/crypto/sha/asm/sha1-586.S
similarity index 100%
rename from crypto/sha/asm/sha1-586.s
rename to crypto/sha/asm/sha1-586.S
diff --git a/crypto/sha/asm/sha1-armv4-large.s b/crypto/sha/asm/sha1-armv4-large.S
similarity index 100%
rename from crypto/sha/asm/sha1-armv4-large.s
rename to crypto/sha/asm/sha1-armv4-large.S
diff --git a/crypto/sha/asm/sha1-mips.s b/crypto/sha/asm/sha1-mips.S
similarity index 100%
rename from crypto/sha/asm/sha1-mips.s
rename to crypto/sha/asm/sha1-mips.S
diff --git a/crypto/sha/asm/sha256-586.s b/crypto/sha/asm/sha256-586.S
similarity index 100%
rename from crypto/sha/asm/sha256-586.s
rename to crypto/sha/asm/sha256-586.S
diff --git a/crypto/sha/asm/sha256-armv4.s b/crypto/sha/asm/sha256-armv4.S
similarity index 100%
rename from crypto/sha/asm/sha256-armv4.s
rename to crypto/sha/asm/sha256-armv4.S
diff --git a/crypto/sha/asm/sha256-mips.s b/crypto/sha/asm/sha256-mips.S
similarity index 100%
rename from crypto/sha/asm/sha256-mips.s
rename to crypto/sha/asm/sha256-mips.S
diff --git a/crypto/sha/asm/sha512-586.s b/crypto/sha/asm/sha512-586.S
similarity index 100%
rename from crypto/sha/asm/sha512-586.s
rename to crypto/sha/asm/sha512-586.S
diff --git a/crypto/sha/asm/sha512-armv4.s b/crypto/sha/asm/sha512-armv4.S
similarity index 100%
rename from crypto/sha/asm/sha512-armv4.s
rename to crypto/sha/asm/sha512-armv4.S
diff --git a/import_openssl.sh b/import_openssl.sh
index 0630769..e02e8c3 100755
--- a/import_openssl.sh
+++ b/import_openssl.sh
@@ -130,40 +130,40 @@
done
# Generate arm asm
- perl crypto/aes/asm/aes-armv4.pl > crypto/aes/asm/aes-armv4.s
- perl crypto/bn/asm/armv4-gf2m.pl > crypto/bn/asm/armv4-gf2m.s
- perl crypto/bn/asm/armv4-mont.pl > crypto/bn/asm/armv4-mont.s
- perl crypto/modes/asm/ghash-armv4.pl > crypto/modes/asm/ghash-armv4.s
- perl crypto/sha/asm/sha1-armv4-large.pl > crypto/sha/asm/sha1-armv4-large.s
- perl crypto/sha/asm/sha256-armv4.pl > crypto/sha/asm/sha256-armv4.s
- perl crypto/sha/asm/sha512-armv4.pl > crypto/sha/asm/sha512-armv4.s
+ perl crypto/aes/asm/aes-armv4.pl > crypto/aes/asm/aes-armv4.S
+ perl crypto/bn/asm/armv4-gf2m.pl > crypto/bn/asm/armv4-gf2m.S
+ perl crypto/bn/asm/armv4-mont.pl > crypto/bn/asm/armv4-mont.S
+ perl crypto/modes/asm/ghash-armv4.pl > crypto/modes/asm/ghash-armv4.S
+ perl crypto/sha/asm/sha1-armv4-large.pl > crypto/sha/asm/sha1-armv4-large.S
+ perl crypto/sha/asm/sha256-armv4.pl > crypto/sha/asm/sha256-armv4.S
+ perl crypto/sha/asm/sha512-armv4.pl > crypto/sha/asm/sha512-armv4.S
# Generate mips asm
# The perl scripts expect to run the target compiler as $CC to determine
# the endianess of the target. Setting CC to true is a hack that forces the scripts
# to generate little endian output
- CC=true perl crypto/aes/asm/aes-mips.pl o32 > crypto/aes/asm/aes-mips.s
- CC=true perl crypto/bn/asm/mips.pl o32 > crypto/bn/asm/bn-mips.s
- CC=true perl crypto/bn/asm/mips-mont.pl o32 > crypto/bn/asm/mips-mont.s
- CC=true perl crypto/sha/asm/sha1-mips.pl o32 > crypto/sha/asm/sha1-mips.s
- CC=true perl crypto/sha/asm/sha512-mips.pl o32 > crypto/sha/asm/sha256-mips.s
+ CC=true perl crypto/aes/asm/aes-mips.pl o32 > crypto/aes/asm/aes-mips.S
+ CC=true perl crypto/bn/asm/mips.pl o32 > crypto/bn/asm/bn-mips.S
+ CC=true perl crypto/bn/asm/mips-mont.pl o32 > crypto/bn/asm/mips-mont.S
+ CC=true perl crypto/sha/asm/sha1-mips.pl o32 > crypto/sha/asm/sha1-mips.S
+ CC=true perl crypto/sha/asm/sha512-mips.pl o32 > crypto/sha/asm/sha256-mips.S
# Generate x86 asm
- perl crypto/aes/asm/aes-586.pl elf > crypto/aes/asm/aes-586.s
- perl crypto/aes/asm/vpaes-x86.pl elf > crypto/aes/asm/vpaes-x86.s
- perl crypto/aes/asm/aesni-x86.pl elf > crypto/aes/asm/aesni-x86.s
- perl crypto/bn/asm/bn-586.pl elf > crypto/bn/asm/bn-586.s
- perl crypto/bn/asm/co-586.pl elf > crypto/bn/asm/co-586.s
- perl crypto/bn/asm/x86-mont.pl elf > crypto/bn/asm/x86-mont.s
- perl crypto/bn/asm/x86-gf2m.pl elf > crypto/bn/asm/x86-gf2m.s
- perl crypto/modes/asm/ghash-x86.pl elf > crypto/modes/asm/ghash-x86.s
- perl crypto/sha/asm/sha1-586.pl elf > crypto/sha/asm/sha1-586.s
- perl crypto/sha/asm/sha256-586.pl elf > crypto/sha/asm/sha256-586.s
- perl crypto/sha/asm/sha512-586.pl elf > crypto/sha/asm/sha512-586.s
- perl crypto/md5/asm/md5-586.pl elf > crypto/md5/asm/md5-586.s
- perl crypto/des/asm/des-586.pl elf > crypto/des/asm/des-586.s
- perl crypto/des/asm/crypt586.pl elf > crypto/des/asm/crypt586.s
- perl crypto/bf/asm/bf-586.pl elf > crypto/bf/asm/bf-586.s
+ perl crypto/aes/asm/aes-586.pl elf > crypto/aes/asm/aes-586.S
+ perl crypto/aes/asm/vpaes-x86.pl elf > crypto/aes/asm/vpaes-x86.S
+ perl crypto/aes/asm/aesni-x86.pl elf > crypto/aes/asm/aesni-x86.S
+ perl crypto/bn/asm/bn-586.pl elf > crypto/bn/asm/bn-586.S
+ perl crypto/bn/asm/co-586.pl elf > crypto/bn/asm/co-586.S
+ perl crypto/bn/asm/x86-mont.pl elf > crypto/bn/asm/x86-mont.S
+ perl crypto/bn/asm/x86-gf2m.pl elf > crypto/bn/asm/x86-gf2m.S
+ perl crypto/modes/asm/ghash-x86.pl elf > crypto/modes/asm/ghash-x86.S
+ perl crypto/sha/asm/sha1-586.pl elf > crypto/sha/asm/sha1-586.S
+ perl crypto/sha/asm/sha256-586.pl elf > crypto/sha/asm/sha256-586.S
+ perl crypto/sha/asm/sha512-586.pl elf > crypto/sha/asm/sha512-586.S
+ perl crypto/md5/asm/md5-586.pl elf > crypto/md5/asm/md5-586.S
+ perl crypto/des/asm/des-586.pl elf > crypto/des/asm/des-586.S
+ perl crypto/des/asm/crypt586.pl elf > crypto/des/asm/crypt586.S
+ perl crypto/bf/asm/bf-586.pl elf > crypto/bf/asm/bf-586.S
# Setup android.testssl directory
mkdir android.testssl