title: /usr/bin/as: unrecognized option '-EL'
body: <p>So while compiling android kernel for my 1plus phone, after multiples attempts over 3 days, I gave up and give a try to ask here if anyone had this problem before.</p>
  <p>The bug is a bit obscure to me, but I feel like the problem comes from my recent change to a GNU/Linux distribution (Gentoo), which is somehow overriding the AS environment variable when it shouldn't; it fails at assembling VDSO, but I've no idea sadly from where the overriding comes. (maybe they did a modify the make command in order to allow supporting flags overriding etc..)</p>
  <p>EDIT, Small version:</p>
  <pre><code>make RANLIB=/media/sda2/git/linux-x86/clang-bootstrap/bin/llvm-ranlib CC='/media/sda2/git/linux-x86/clang-bootstrap/bin/clang -fintegrated-as' LD=/media/sda2/git/linux-x86/clang-bootstrap/bin/ld.lld AR=/media/sda2/git/linux-x86/clang-bootstrap/bin/llvm-ar AS=/media/sda2/git/linux-x86/clang-bootstrap/bin/llvm-as NM=/media/sda2/git/linux-x86/clang-bootstrap/bin/llvm-nm OBJCOPY=/media/sda2/git/linux-x86/clang-bootstrap/bin/llvm-objcopy OBJDUMP=/media/sda2/git/linux-x86/clang-bootstrap/bin/llvm-objdump READELF=/media/sda2/git/linux-x86/clang-bootstrap/bin/llvm-readelf OBJSIZE=/media/sda2/git/linux-x86/clang-bootstrap/bin/llvm-size STRIP=/media/sda2/git/linux-x86/clang-bootstrap/bin/llvm-strip
    CC      kernel/bounds.s
    CC      arch/arm64/kernel/asm-offsets.s
  In file included from arch/arm64/kernel/asm-offsets.c:25:
  In file included from ./include/linux/kvm_host.h:39:
  In file included from ./arch/arm64/include/asm/kvm_host.h:42:
  In file included from ./include/kvm/arm_pmu.h:21:
  In file included from ./include/linux/perf_event.h:57:
  In file included from ./include/linux/cgroup.h:28:
  ./include/linux/cgroup-defs.h:475:16: warning: field 'cgrp' with variable sized type 'struct cgroup' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
          struct cgroup cgrp;
                        ^
  1 warning generated.
    CALL    scripts/checksyscalls.sh
    LDS     arch/arm64/kernel/vdso/vdso.lds
    VDSOA   arch/arm64/kernel/vdso/gettimeofday.o 
  /usr/bin/as: unrecognized option '-EL'
  clang-12: error: assembler command failed with exit code 1 (use -v to see invocation)
  make[1]: *** [arch/arm64/kernel/vdso/Makefile:57: arch/arm64/kernel/vdso/gettimeofday.o] Error 1
  make: *** [arch/arm64/Makefile:201: vdso_prepare] Error 2
  </code></pre>
  <p>Environment variables:</p>
  <pre><code># https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/
  export PATH='/media/sda2/git/aarch64-linux-android-4.9/bin':${PATH}
  export LD_LIBRARY_PATH='/media/sda2/git/aarch64-linux-android-4.9/lib':${LD_LIBRARY_PATH}
  
  # git clone https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86
  export PATH='/media/sda2/git/linux-x86/clang-bootstrap/bin':${PATH}
  export LD_LIBRARY_PATH='/media/sda2/git/linux-x86/clang-bootstrap/lib':${LD_LIBRARY_PATH}
  
  export ARCH=arm64 
  export SUBARCH=arm64
  export CROSS_COMPILE='aarch64-linux-android-'
  export CROSS_COMPILER=$PATH
  export CLANG_TRIPLE='aarch64-linux-gnu-'
  export KCFLAGS='-pipe -O3'
  export KCPPFLAGS='-pipe -O3'
  </code></pre>
  <p>Kernel used:
  <a href="https://github.com/LineageOS/android_kernel_oneplus_sm8250" rel="nofollow noreferrer">https://github.com/LineageOS/android_kernel_oneplus_sm8250</a></p>
  <p>Any ideas?</p>
  <p>I use Google's clang prebuilt compiler (could build it myself but in order to gain time) in order to use polly for compiling android kernels since Gentoo LLVM team doesn't apparently have yet a use flag for it.</p>
  <p>At worse I'm thinking to use Ubuntu binutils/automake etc / creating a docker environment in order to compile this kernel but this just doesn't make many sense to me since I should be able to do it on my own host system.</p>
  <p>Thank you for your help and your care.</p>