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

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 13 14:00:14 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL281394: [ELF] Set EF_ARM_EABI_VER5 for ARM (authored by ruiu).

Changed prior to commit:
  https://reviews.llvm.org/D24471?vs=71231&id=71236#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D24471

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

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<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) {
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:  ]


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


More information about the llvm-commits mailing list