[lld] r344518 - [ELF][HEXAGON] Let input determine e_flag.

Sid Manning via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 15 07:44:53 PDT 2018


Author: sidneym
Date: Mon Oct 15 07:44:52 2018
New Revision: 344518

URL: http://llvm.org/viewvc/llvm-project?rev=344518&view=rev
Log:
[ELF][HEXAGON] Let input determine e_flag.

Differential Revision: https://reviews.llvm.org/D53204

Added:
    lld/trunk/test/ELF/hexagon-eflag.s
Modified:
    lld/trunk/ELF/Arch/Hexagon.cpp

Modified: lld/trunk/ELF/Arch/Hexagon.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/Hexagon.cpp?rev=344518&r1=344517&r2=344518&view=diff
==============================================================================
--- lld/trunk/ELF/Arch/Hexagon.cpp (original)
+++ lld/trunk/ELF/Arch/Hexagon.cpp Mon Oct 15 07:44:52 2018
@@ -55,8 +55,19 @@ Hexagon::Hexagon() {
   NoneRel = R_HEX_NONE;
 }
 
-// Support V60 only at the moment.
-uint32_t Hexagon::calcEFlags() const { return 0x60; }
+uint32_t Hexagon::calcEFlags() const {
+  assert(!ObjectFiles.empty());
+
+  // The architecture revision must always be equal to or greater than
+  // greatest revision in the list of inputs.
+  uint32_t Ret = 0;
+  for (InputFile *F : ObjectFiles) {
+    uint32_t EFlags = cast<ObjFile<ELF32LE>>(F)->getObj().getHeader()->e_flags;
+    if (EFlags > Ret)
+      Ret = EFlags;
+  }
+  return Ret;
+}
 
 static uint32_t applyMask(uint32_t Mask, uint32_t Data) {
   uint32_t Result = 0;

Added: lld/trunk/test/ELF/hexagon-eflag.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/hexagon-eflag.s?rev=344518&view=auto
==============================================================================
--- lld/trunk/test/ELF/hexagon-eflag.s (added)
+++ lld/trunk/test/ELF/hexagon-eflag.s Mon Oct 15 07:44:52 2018
@@ -0,0 +1,7 @@
+# REQUIRES: hexagon
+# RUN: llvm-mc -filetype=obj -mv62 -triple=hexagon-unknown-elf %s -o %t
+# RUN: llvm-mc -filetype=obj -mv60 -triple=hexagon-unknown-elf %S/Inputs/hexagon.s -o %t2
+# RUN: ld.lld %t2 %t  -o %t3
+# RUN: llvm-readelf -h  %t3 | FileCheck %s
+# Verify that the largest arch in the input list is selected.
+# CHECK: Flags: 0x62




More information about the llvm-commits mailing list