[lld] r233799 - [ARM] Set specific flags in ELF header
Denis Protivensky
dprotivensky at accesssoftek.com
Wed Apr 1 04:39:53 PDT 2015
Author: denis-protivensky
Date: Wed Apr 1 06:39:53 2015
New Revision: 233799
URL: http://llvm.org/viewvc/llvm-project?rev=233799&view=rev
Log:
[ARM] Set specific flags in ELF header
Added:
lld/trunk/test/elf/ARM/header-flags.test
Modified:
lld/trunk/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h
Modified: lld/trunk/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h?rev=233799&r1=233798&r2=233799&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h Wed Apr 1 06:39:53 2015
@@ -13,6 +13,7 @@
#include "ARMLinkingContext.h"
#include "ARMTargetHandler.h"
#include "ARMSymbolTable.h"
+#include "llvm/Support/ELF.h"
namespace {
const char *gotSymbol = "_GLOBAL_OFFSET_TABLE_";
@@ -101,6 +102,10 @@ std::error_code ARMExecutableWriter<ELFT
if (std::error_code ec = ExecutableWriter<ELFT>::setELFHeader())
return ec;
+ // Set ARM-specific flags.
+ this->_elfHeader->e_flags(llvm::ELF::EF_ARM_EABI_VER5 |
+ llvm::ELF::EF_ARM_VFP_FLOAT);
+
StringRef entryName = _ctx.entrySymbolName();
if (const AtomLayout *al = _armLayout.findAtomLayoutByName(entryName)) {
if (const auto *ea = dyn_cast<DefinedAtom>(al->_atom)) {
Added: lld/trunk/test/elf/ARM/header-flags.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/ARM/header-flags.test?rev=233799&view=auto
==============================================================================
--- lld/trunk/test/elf/ARM/header-flags.test (added)
+++ lld/trunk/test/elf/ARM/header-flags.test Wed Apr 1 06:39:53 2015
@@ -0,0 +1,40 @@
+# Various checks for header flags.
+
+# 1. Check header flags for statically linked executable with default options.
+# RUN: yaml2obj -format=elf %s > %t.o
+# RUN: lld -flavor gnu -target arm -m armelf_linux_eabi -Bstatic \
+# RUN: --noinhibit-exec %t.o -o %t
+# RUN: llvm-readobj -file-headers %t | FileCheck -check-prefix=STATIC-DEF %s
+#
+# STATIC-DEF: Flags {{.}} (0x5000400)
+# ABI version 5 + hard float ^^
+
+---
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_ARM
+ Flags: [ EF_ARM_EABI_VER5 ]
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 0x0000000000000004
+ Content: 04B02DE500B08DE20030A0E30300A0E100D04BE204B09DE41EFF2FE1
+ - Name: .data
+ Type: SHT_PROGBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ AddressAlign: 0x0000000000000001
+ Content: ''
+ - Name: .bss
+ Type: SHT_NOBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ AddressAlign: 0x0000000000000001
+ Content: ''
+Symbols:
+ Global:
+ - Name: main
+ Type: STT_FUNC
+ Section: .text
+...
More information about the llvm-commits
mailing list