Index: lld/trunk/ELF/Writer.cpp =================================================================== --- lld/trunk/ELF/Writer.cpp +++ lld/trunk/ELF/Writer.cpp @@ -1262,7 +1262,12 @@ EHdr->e_shnum = OutputSections.size() + 1; EHdr->e_shstrndx = Out::ShStrTab->SectionIndex; - if (Config->EMachine == EM_MIPS) + if (Config->EMachine == EM_ARM) + // We don't currently use any features incompatible with EF_ARM_EABI_VER5, + // but we don't have any firm guarantees of conformance. Linux AArch64 + // kernels (as of 2016) require an EABI version to be set. + EHdr->e_flags = EF_ARM_EABI_VER5; + else if (Config->EMachine == EM_MIPS) EHdr->e_flags = getMipsEFlags(); if (!Config->Relocatable) { Index: lld/trunk/test/ELF/arm-eabi-version.s =================================================================== --- lld/trunk/test/ELF/arm-eabi-version.s +++ lld/trunk/test/ELF/arm-eabi-version.s @@ -0,0 +1,14 @@ +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t.o +// RUN: ld.lld -static %t.o -o %tout +// RUN: llvm-readobj -file-headers %tout | FileCheck %s +// REQUIRES: arm + .syntax unified + .text + .globl _start +_start: + bx lr + +// CHECK: Flags [ +// CHECK-NEXT: 0x1000000 +// CHECK-NEXT: 0x4000000 +// CHECK-NEXT: ]