Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown directive when building OpenSSL MIPS #286

Closed
yan12125 opened this issue Jan 24, 2017 · 4 comments
Closed

Unknown directive when building OpenSSL MIPS #286

yan12125 opened this issue Jan 24, 2017 · 4 comments
Labels

Comments

@yan12125
Copy link

Description

When building OpenSSL MIPS with Clang, compiling a MIPS file leads to "unknown directive"

/opt/android-ndk-beta/toolchains/llvm/prebuilt/linux-x86_64/bin/clang  -I. -Icrypto/include -Iinclude -Icrypto -DDSO_DLFCN -DHAVE_DLFCN_H -DNDEBUG -DOPENSSL_THREADS -DOPENSSL_NO_STATIC_ENGINE -DOPENSSL_PIC -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DAES_ASM -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/usr/local/lib/engines-1.1\"" -Wall -O3 -pthread -fPIC --sysroot=/opt/android-ndk-beta/platforms/android-21/arch-mips -Wa,--noexecstack -gcc-toolchain /opt/android-ndk-beta/toolchains/mipsel-linux-android-4.9/prebuilt/linux-x86_64 -target mipsel-none-linux-android  -fPIC -DOPENSSL_USE_NODELETE -MMD -MF crypto/aes/aes-mips.d.tmp -MT crypto/aes/aes-mips.o -c -o crypto/aes/aes-mips.o crypto/aes/aes-mips.s
clang: warning: argument unused during compilation: '-D DSO_DLFCN'
clang: warning: argument unused during compilation: '-D HAVE_DLFCN_H'
clang: warning: argument unused during compilation: '-D NDEBUG'
clang: warning: argument unused during compilation: '-D OPENSSL_THREADS'
clang: warning: argument unused during compilation: '-D OPENSSL_NO_STATIC_ENGINE'
clang: warning: argument unused during compilation: '-D OPENSSL_PIC'
clang: warning: argument unused during compilation: '-D OPENSSL_BN_ASM_MONT'
clang: warning: argument unused during compilation: '-D SHA1_ASM'
clang: warning: argument unused during compilation: '-D SHA256_ASM'
clang: warning: argument unused during compilation: '-D AES_ASM'
clang: warning: argument unused during compilation: '-D OPENSSLDIR="/usr/local/ssl"'
clang: warning: argument unused during compilation: '-D ENGINESDIR="/usr/local/lib/engines-1.1"'
clang: warning: argument unused during compilation: '-pthread'
clang: warning: argument unused during compilation: '-D OPENSSL_USE_NODELETE'
clang: warning: argument unused during compilation: '-MMD'
clang: warning: argument unused during compilation: '-MF crypto/aes/aes-mips.d.tmp'
clang: warning: argument unused during compilation: '-MT crypto/aes/aes-mips.o'
crypto/aes/aes-mips.s:1058:1: error: unknown directive
.rdata
^

aes-mips.s is a generated source. See https://gist.github.com/yan12125/ea5bf41fdf504cdd212de3fff51a24ed

Steps to reproduce:
First save this patch as use-integrated-as-in-mips.patch

diff --git a/Configurations/20-android.conf b/Configurations/20-android.conf
index b89e51e63..89d994bd3 100644
--- a/Configurations/20-android.conf
+++ b/Configurations/20-android.conf
@@ -144,7 +144,7 @@
     },
     "android-mips-clang" => {
         inherit_from     => [ "android-clang", "android-mips-base" ],
-        cflags           => add(picker(default => "-target mipsel-none-linux-android -fno-integrated-as")),
+        cflags           => add(picker(default => "-target mipsel-none-linux-android")),
     },
     "android64-clang" => {
         inherit_from     => [ "android64-base" ],
git clone https://github.com/openssl/openssl
cd openssl
wget https://github.com/openssl/openssl/pull/2229.patch
patch -p1 -i 2229.patch
patch -p1 -i use-integrated-as-in-mips.patch
export CC="$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/clang"
export CXX="$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++"
export GCC_TOOLCHAIN="$ANDROID_NDK/toolchains/mipsel-linux-android-4.9/prebuilt/linux-x86_64"
export CROSS_SYSROOT="$ANDROID_NDK/platforms/android-21/arch-mips"

./Configure android-mips-clang
make

Environment Details

Not all of these will be relevant to every bug, but please provide as much
information as you can.

  • NDK Version: 14.0.3529234-beta1
  • Build sytem: custom
  • Host OS: Arch Linux latest
  • Compiler: Clang
  • ABI: x86
  • STL: N/A
  • NDK API level: 21
  • Device API level: N/A
a252539783 pushed a commit to a252539783/aosp-platform-ndk that referenced this issue May 3, 2017
Test: ./validate.py
Bug: android/ndk#259
Bug: android/ndk#286
Change-Id: I86bef3c731f85f8997157daa0692983300c5e101
(cherry picked from commit b544896)
a252539783 pushed a commit to a252539783/aosp-platform-ndk that referenced this issue May 3, 2017
Test: ./validate.py
Bug: android/ndk#259
Bug: android/ndk#286
Change-Id: I86bef3c731f85f8997157daa0692983300c5e101
yan12125 pushed a commit to yan12125/python3-android that referenced this issue May 18, 2017
An exception: due to android/ndk#286,
OpenSSL on MIPS still uses -fno-integrated-as
yan12125 pushed a commit to yan12125/python3-android that referenced this issue May 18, 2017
Like android/ndk#286, MIPS64 requires
-fno-integrated-as, too. It's clang default in r15 beta2. Here I write
it explicitly to make things clear.
@fornwall
Copy link

Is this fixed by the updated clang in r15 beta2?

@yan12125
Copy link
Author

@fornwall: Clang's integrated assembler is still incompatible with OpenSSL git-master on MIPS. I didn't check stable releases.

@DanAlbert
Copy link
Member

That's fine though, just use -fno-integrated-as for that target (and an explicit -fintegrated-as for mips64).

@DanAlbert
Copy link
Member

MIPS is deprecated as of r16.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants