[PATCH] D24471: [ELF] Set EF_ARM_EABI_VER5 for ARM

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 13 13:41:34 PDT 2016


mstorsjo updated this revision to Diff 71231.
mstorsjo added a comment.

Amended the comment as requested.


https://reviews.llvm.org/D24471

Files:
  ELF/Writer.cpp
  test/ELF/arm-eabi-version.s

Index: test/ELF/arm-eabi-version.s
===================================================================
--- /dev/null
+++ 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:  ]
Index: ELF/Writer.cpp
===================================================================
--- ELF/Writer.cpp
+++ ELF/Writer.cpp
@@ -1262,7 +1262,12 @@
   EHdr->e_shnum = OutputSections.size() + 1;
   EHdr->e_shstrndx = Out<ELFT>::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<ELFT>();
 
   if (!Config->Relocatable) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24471.71231.patch
Type: text/x-patch
Size: 1217 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160913/7ad2e537/attachment.bin>


More information about the llvm-commits mailing list