<div dir="ltr"><div>Hi Manman,</div><div><br></div><div>I'm currently investigating this issue, in the meantime I'll xfail the test temporarily.</div><div><br></div><div style>Thanks,</div><div>Amara</div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On 3 May 2013 22:13, Manman Ren <span dir="ltr"><<a href="mailto:mren@apple.com" target="_blank">mren@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
This seems to break one of the bots.<br>
<a href="http://lab.llvm.org:8013/builders/clang-x86_64-darwin11-DA/builds/1892" target="_blank">http://lab.llvm.org:8013/builders/clang-x86_64-darwin11-DA/builds/1892</a><br>
<br>
Thanks,<br>
Manman<br>
<div class="HOEnZb"><div class="h5"><br>
On May 3, 2013, at 4:36 AM, Amara Emerson wrote:<br>
<br>
> Author: aemerson<br>
> Date: Fri May 3 06:36:35 2013<br>
> New Revision: 181009<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=181009&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=181009&view=rev</a><br>
> Log:<br>
> Add support for reading ARM ELF build attributes.<br>
><br>
> Build attribute sections can now be read if they exist via ELFObjectFile, and<br>
> the llvm-readobj tool has been extended with an option to dump this information<br>
> if requested. Regression tests are also included which exercise these features.<br>
><br>
> Also update the docs with a fixed ARM ABI link and a new link to the Addenda<br>
> which provides the build attributes specification.<br>
><br>
> Added:<br>
> llvm/trunk/include/llvm/Object/ELF_ARM.h<br>
> llvm/trunk/test/Object/Inputs/arm-attributes.elf-arm (with props)<br>
> llvm/trunk/test/Object/Inputs/trivial-object-test.elf-arm (with props)<br>
> llvm/trunk/test/Object/readobj-elf-arm-buildattrs.test<br>
> Removed:<br>
> llvm/trunk/lib/Target/ARM/ARMBuildAttrs.h<br>
> Modified:<br>
> llvm/trunk/docs/CompilerWriterInfo.rst<br>
> llvm/trunk/include/llvm/Object/ELF.h<br>
> llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp<br>
> llvm/trunk/tools/llvm-readobj/ELFDumper.cpp<br>
> llvm/trunk/tools/llvm-readobj/ObjDumper.h<br>
> llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp<br>
><br>
> Modified: llvm/trunk/docs/CompilerWriterInfo.rst<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CompilerWriterInfo.rst?rev=181009&r1=181008&r2=181009&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CompilerWriterInfo.rst?rev=181009&r1=181008&r2=181009&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/docs/CompilerWriterInfo.rst (original)<br>
> +++ llvm/trunk/docs/CompilerWriterInfo.rst Fri May 3 06:36:35 2013<br>
> @@ -18,7 +18,9 @@ ARM<br>
><br>
> * `ARM documentation <<a href="http://www.arm.com/documentation/" target="_blank">http://www.arm.com/documentation/</a>>`_ (`Processor Cores <<a href="http://www.arm.com/documentation/ARMProcessor_Cores/" target="_blank">http://www.arm.com/documentation/ARMProcessor_Cores/</a>>`_ Cores)<br>
><br>
> -* `ABI <<a href="http://www.arm.com/products/DevTools/ABI.html" target="_blank">http://www.arm.com/products/DevTools/ABI.html</a>>`_<br>
> +* `ELF ABI <<a href="http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044e/IHI0044E_aaelf.pdf" target="_blank">http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044e/IHI0044E_aaelf.pdf</a>>`_<br>
> +<br>
> +* `Addenda to the ARM ABI <<a href="http://infocenter.arm.com/help/topic/com.arm.doc.ihi0045d/IHI0045D_ABI_addenda.pdf" target="_blank">http://infocenter.arm.com/help/topic/com.arm.doc.ihi0045d/IHI0045D_ABI_addenda.pdf</a>>`_<br>
><br>
> * `ARM C Language Extensions <<a href="http://infocenter.arm.com/help/topic/com.arm.doc.ihi0053a/IHI0053A_acle.pdf" target="_blank">http://infocenter.arm.com/help/topic/com.arm.doc.ihi0053a/IHI0053A_acle.pdf</a>>`_<br>
><br>
><br>
> Modified: llvm/trunk/include/llvm/Object/ELF.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELF.h?rev=181009&r1=181008&r2=181009&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELF.h?rev=181009&r1=181008&r2=181009&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/include/llvm/Object/ELF.h (original)<br>
> +++ llvm/trunk/include/llvm/Object/ELF.h Fri May 3 06:36:35 2013<br>
> @@ -19,11 +19,13 @@<br>
> #include "llvm/ADT/SmallVector.h"<br>
> #include "llvm/ADT/StringSwitch.h"<br>
> #include "llvm/ADT/Triple.h"<br>
> +#include "llvm/Object/ELF_ARM.h"<br>
> #include "llvm/Object/ObjectFile.h"<br>
> #include "llvm/Support/Casting.h"<br>
> #include "llvm/Support/ELF.h"<br>
> #include "llvm/Support/Endian.h"<br>
> #include "llvm/Support/ErrorHandling.h"<br>
> +#include "llvm/Support/LEB128.h"<br>
> #include "llvm/Support/MemoryBuffer.h"<br>
> #include "llvm/Support/raw_ostream.h"<br>
> #include <algorithm><br>
> @@ -601,6 +603,7 @@ private:<br>
> const Elf_Shdr *dot_gnu_version_sec; // .gnu.version<br>
> const Elf_Shdr *dot_gnu_version_r_sec; // .gnu.version_r<br>
> const Elf_Shdr *dot_gnu_version_d_sec; // .gnu.version_d<br>
> + const Elf_Shdr *dot_arm_attributes_sec; // .ARM.attributes<br>
><br>
> // Pointer to SONAME entry in dynamic string table<br>
> // This is set the first time getLoadName is called.<br>
> @@ -643,6 +646,11 @@ private:<br>
> const Elf_Shdr *getRelSection(DataRefImpl Rel) const {<br>
> return getSection(Rel.w.b);<br>
> }<br>
> + // Helper to read a single ARM attribute at the given pointer and return the<br>
> + // read pointer moved forward to the next attribute location.<br>
> + uintptr_t readARMSingleAttribute(uintptr_t ReadPtr,<br>
> + ARMBuildAttrs::ARMGenericBuildAttrInfo &Attrs,<br>
> + SmallVector<unsigned, 16> &TagSet) const;<br>
><br>
> public:<br>
> bool isRelocationHasAddend(DataRefImpl Rel) const;<br>
> @@ -838,6 +846,18 @@ public:<br>
> return v->getType() == getELFType(ELFT::TargetEndianness == support::little,<br>
> ELFT::Is64Bits);<br>
> }<br>
> +<br>
> + /// \brief Read the ARM build attributes of this object file.<br>
> + /// \param Attrs The attributes container to put the attribute values.<br>
> + /// \param TagsSet A list of attribute tags that were read.<br>
> + error_code readARMBuildAttributes(<br>
> + ARMBuildAttrs::ARMGenericBuildAttrInfo &Attrs,<br>
> + SmallVector<unsigned, 16> &TagsSet) const;<br>
> +<br>
> + /// \brief Checks if an ARM build attributes section exists.<br>
> + bool hasARMBuildAttributes() const {<br>
> + return dot_arm_attributes_sec ? true : false;<br>
> + }<br>
> };<br>
><br>
> // Iterate through the version definitions, and place each Elf_Verdef<br>
> @@ -2330,6 +2350,7 @@ ELFObjectFile<ELFT>::ELFObjectFile(Memor<br>
> , dot_gnu_version_sec(0)<br>
> , dot_gnu_version_r_sec(0)<br>
> , dot_gnu_version_d_sec(0)<br>
> + , dot_arm_attributes_sec(0)<br>
> , dt_soname(0)<br>
> {<br>
><br>
> @@ -2421,6 +2442,13 @@ ELFObjectFile<ELFT>::ELFObjectFile(Memor<br>
> dot_gnu_version_r_sec = sh;<br>
> break;<br>
> }<br>
> + case ELF::SHT_ARM_ATTRIBUTES: {<br>
> + if (dot_arm_attributes_sec != NULL)<br>
> + // FIXME: Proper error handling.<br>
> + report_fatal_error("More than one .arm.attributes section!");<br>
> + dot_arm_attributes_sec = sh;<br>
> + break;<br>
> + }<br>
> }<br>
> ++sh;<br>
> }<br>
> @@ -2970,6 +2998,164 @@ static inline error_code GetELFSymbolVer<br>
> llvm_unreachable("Object passed to GetELFSymbolVersion() is not ELF");<br>
> }<br>
><br>
> +template<class ELFT><br>
> +error_code ELFObjectFile<ELFT>::readARMBuildAttributes(<br>
> + ARMBuildAttrs::ARMGenericBuildAttrInfo &Attrs,<br>
> + SmallVector<unsigned, 16> &TagsSet) const {<br>
> + if (getArch() != Triple::arm)<br>
> + return object_error::invalid_file_type;<br>
> + if (!dot_arm_attributes_sec)<br>
> + return object_error::parse_failed;<br>
> +<br>
> + const char *SecStart = (const char*)base() +<br>
> + dot_arm_attributes_sec->sh_offset;<br>
> + const char *SecEnd = SecStart + dot_arm_attributes_sec->sh_size;<br>
> + char format_version = *SecStart;<br>
> + if (format_version != ARMBuildAttrs::Format_Version)<br>
> + return object_error::parse_failed;<br>
> +<br>
> + uintptr_t SSectionPtr = (uintptr_t)SecStart + 1;<br>
> + uintptr_t ReadPtr = SSectionPtr;<br>
> + // Begin reading section after format-version byte<br>
> + while (ReadPtr < (uintptr_t)SecEnd) {<br>
> + // Read a subsection, starting with: <section-length> "vendor-name"<br>
> + // For now, we only care about the "aeabi" pseudo-vendor subsection.<br>
> + uint32_t SSectionLen = *(Elf_Word*)ReadPtr;<br>
> + ReadPtr += sizeof(uint32_t);<br>
> + StringRef Vendor((char*)(ReadPtr));<br>
> + ReadPtr += Vendor.size() + 1; // Vendor string + NUL byte<br>
> +<br>
> + if (Vendor != "aeabi") {<br>
> + SSectionPtr += SSectionLen;<br>
> + ReadPtr = SSectionPtr;<br>
> + continue; //skip to the next sub-section<br>
> + }<br>
> +<br>
> + bool FoundFileTag = false;<br>
> + uintptr_t SSSectionPtr = ReadPtr;<br>
> + uint32_t SSSectionLen = *(Elf_Word*)ReadPtr;<br>
> + // Found aeabi subsection, now find the File scope tag.<br>
> + while (ReadPtr < SSectionPtr + SSectionLen) {<br>
> + unsigned n = 0;<br>
> + uint64_t Tag = decodeULEB128((uint8_t*)ReadPtr, &n);<br>
> + ReadPtr += n;<br>
> + SSSectionLen = *(Elf_Word*)ReadPtr;<br>
> + if (Tag == ARMBuildAttrs::File) {<br>
> + FoundFileTag = true;<br>
> + break;<br>
> + }<br>
> + // We only handle File scope attributes, skip ahead to the next<br>
> + // sub-subsection.<br>
> + SSSectionPtr += SSSectionLen;<br>
> + ReadPtr = SSSectionPtr;<br>
> + }<br>
> +<br>
> + if (!FoundFileTag)<br>
> + return object_error::parse_failed;<br>
> +<br>
> + ReadPtr += sizeof(uint32_t);<br>
> + while (ReadPtr < SSSectionPtr + SSSectionLen) {<br>
> + // Read any number of attributes.<br>
> + // Attributes are pairs of <uleb128, uleb128> or <uleb128, NTBS>.<br>
> + ReadPtr = readARMSingleAttribute(ReadPtr, Attrs, TagsSet);<br>
> + }<br>
> + Attrs.setValid(true);<br>
> + }<br>
> + return object_error::success;<br>
> +}<br>
> +<br>
> +#define SWITCH_ARM_ATTR_READ_ULEB(X) case ARMBuildAttrs::X: \<br>
> + UlebValue = decodeULEB128((uint8_t*)ReadPtr, &n); \<br>
> + ReadPtr += n; \<br>
> + Attrs.Tag_##X = UlebValue; \<br>
> + TagsSet.push_back(tag); \<br>
> + break;<br>
> +<br>
> +template<class ELFT><br>
> +uintptr_t ELFObjectFile<ELFT>::readARMSingleAttribute(uintptr_t ReadPtr,<br>
> + ARMBuildAttrs::ARMGenericBuildAttrInfo &Attrs,<br>
> + SmallVector<unsigned, 16> &TagsSet) const {<br>
> + // The ABI says that tags in the range 0-63 must be handled by tools.<br>
> + unsigned n = 0;<br>
> + uint64_t tagInt = decodeULEB128((uint8_t*)ReadPtr, &n);<br>
> + ARMBuildAttrs::AttrType tag = (ARMBuildAttrs::AttrType)tagInt;<br>
> + ReadPtr += n;<br>
> + uint64_t UlebValue = 0;<br>
> + StringRef StrValue;<br>
> + switch (tag) {<br>
> + case ARMBuildAttrs::CPU_arch: // uleb128<br>
> + UlebValue = decodeULEB128((uint8_t*)ReadPtr, &n);<br>
> + ReadPtr += n;<br>
> + Attrs.Tag_CPU_arch = (ARMBuildAttrs::CPUArch)UlebValue;<br>
> + TagsSet.push_back(tag);<br>
> + break;<br>
> + case ARMBuildAttrs::CPU_raw_name: // NTBS<br>
> + StrValue = (char*)ReadPtr;<br>
> + Attrs.Tag_CPU_raw_name = StrValue;<br>
> + TagsSet.push_back(ARMBuildAttrs::CPU_raw_name);<br>
> + ReadPtr += StrValue.size() + 1;<br>
> + break;<br>
> + case ARMBuildAttrs::CPU_name: //NTBS<br>
> + StrValue = (char*)ReadPtr;<br>
> + Attrs.Tag_CPU_name = StrValue;<br>
> + TagsSet.push_back(ARMBuildAttrs::CPU_name);<br>
> + ReadPtr += StrValue.size() + 1;<br>
> + break;<br>
> + case ARMBuildAttrs::CPU_arch_profile: // uleb128<br>
> + UlebValue = decodeULEB128((uint8_t*)ReadPtr, &n);<br>
> + ReadPtr += n;<br>
> + Attrs.Tag_CPU_arch_profile =<br>
> + (ARMBuildAttrs::CPUArchProfile)UlebValue;<br>
> + TagsSet.push_back(tag);<br>
> + break;<br>
> + SWITCH_ARM_ATTR_READ_ULEB(ARM_ISA_use)<br>
> + SWITCH_ARM_ATTR_READ_ULEB(THUMB_ISA_use)<br>
> + SWITCH_ARM_ATTR_READ_ULEB(FP_arch)<br>
> + SWITCH_ARM_ATTR_READ_ULEB(WMMX_arch)<br>
> + SWITCH_ARM_ATTR_READ_ULEB(Advanced_SIMD_arch)<br>
> + SWITCH_ARM_ATTR_READ_ULEB(FP_HP_extension)<br>
> + SWITCH_ARM_ATTR_READ_ULEB(CPU_unaligned_access)<br>
> + SWITCH_ARM_ATTR_READ_ULEB(MPextension_use)<br>
> + SWITCH_ARM_ATTR_READ_ULEB(DIV_use)<br>
> + SWITCH_ARM_ATTR_READ_ULEB(T2EE_use)<br>
> + SWITCH_ARM_ATTR_READ_ULEB(Virtualization_use)<br>
> + SWITCH_ARM_ATTR_READ_ULEB(ABI_optimization_goals)<br>
> + SWITCH_ARM_ATTR_READ_ULEB(ABI_FP_optimization_goals)<br>
> + SWITCH_ARM_ATTR_READ_ULEB(PCS_config)<br>
> + SWITCH_ARM_ATTR_READ_ULEB(ABI_PCS_R9_use)<br>
> + SWITCH_ARM_ATTR_READ_ULEB(ABI_PCS_RW_data)<br>
> + SWITCH_ARM_ATTR_READ_ULEB(ABI_PCS_RO_data)<br>
> + SWITCH_ARM_ATTR_READ_ULEB(ABI_PCS_GOT_use)<br>
> + SWITCH_ARM_ATTR_READ_ULEB(ABI_PCS_wchar_t)<br>
> + SWITCH_ARM_ATTR_READ_ULEB(ABI_enum_size)<br>
> + SWITCH_ARM_ATTR_READ_ULEB(ABI_align8_needed)<br>
> + SWITCH_ARM_ATTR_READ_ULEB(ABI_align8_preserved)<br>
> + SWITCH_ARM_ATTR_READ_ULEB(ABI_FP_rounding)<br>
> + SWITCH_ARM_ATTR_READ_ULEB(ABI_FP_denormal)<br>
> + SWITCH_ARM_ATTR_READ_ULEB(ABI_FP_number_model)<br>
> + SWITCH_ARM_ATTR_READ_ULEB(ABI_FP_exceptions)<br>
> + SWITCH_ARM_ATTR_READ_ULEB(ABI_FP_user_exceptions)<br>
> + SWITCH_ARM_ATTR_READ_ULEB(ABI_HardFP_use)<br>
> + SWITCH_ARM_ATTR_READ_ULEB(ABI_VFP_args)<br>
> + default:<br>
> + // Unhandled build attribute tag, according to the spec we should be able<br>
> + // to infer the type of the value from (tag % 2) and skip over it.<br>
> + if (tag & 0x1) {<br>
> + // Value should be a null terminated byte string<br>
> + StrValue = (char*)ReadPtr;<br>
> + ReadPtr += StrValue.size() + 1;<br>
> + } else {<br>
> + // Value should be a uleb128<br>
> + UlebValue = decodeULEB128((uint8_t*)ReadPtr, &n);<br>
> + ReadPtr += n;<br>
> + }<br>
> + break;<br>
> + }<br>
> + return ReadPtr;<br>
> +}<br>
> +#undef SWITCH_ARM_ATTR_READ_ULEB<br>
> +<br>
> +<br>
> /// This function returns the hash value for a symbol in the .dynsym section<br>
> /// Name of the API remains consistent as specified in the libelf<br>
> /// REF : <a href="http://www.sco.com/developers/gabi/latest/ch5.dynamic.html#hash" target="_blank">http://www.sco.com/developers/gabi/latest/ch5.dynamic.html#hash</a><br>
><br>
> Added: llvm/trunk/include/llvm/Object/ELF_ARM.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELF_ARM.h?rev=181009&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELF_ARM.h?rev=181009&view=auto</a><br>
> ==============================================================================<br>
> --- llvm/trunk/include/llvm/Object/ELF_ARM.h (added)<br>
> +++ llvm/trunk/include/llvm/Object/ELF_ARM.h Fri May 3 06:36:35 2013<br>
> @@ -0,0 +1,339 @@<br>
> +//===-- ELF_ARM.h - ARM ELF ABI ---------------------------------*- C++ -*-===//<br>
> +//<br>
> +// The LLVM Compiler Infrastructure<br>
> +//<br>
> +// This file is distributed under the University of Illinois Open Source<br>
> +// License. See LICENSE.TXT for details.<br>
> +//<br>
> +//===----------------------------------------------------------------------===//<br>
> +//<br>
> +// This file contains enumerations and support routines for ARM build attributes<br>
> +// as defined in ARM ABI addenda document (ABI release 2.08).<br>
> +//<br>
> +//===----------------------------------------------------------------------===//<br>
> +<br>
> +#ifndef LLVM_OBJECT_ELF_ARM_H<br>
> +#define LLVM_OBJECT_ELF_ARM_H<br>
> +<br>
> +#include "llvm/ADT/SmallVector.h"<br>
> +#include "llvm/Support/Endian.h"<br>
> +<br>
> +namespace llvm {<br>
> +<br>
> +namespace ARMBuildAttrs {<br>
> +enum SpecialAttr {<br>
> + // This is for the .cpu asm attr. It translates into one or more<br>
> + // AttrType (below) entries in the .ARM.attributes section in the ELF.<br>
> + SEL_CPU<br>
> +};<br>
> +<br>
> +enum AttrType {<br>
> + // Rest correspond to ELF/.ARM.attributes<br>
> + File = 1,<br>
> + Section = 2,<br>
> + Symbol = 3,<br>
> + CPU_raw_name = 4,<br>
> + CPU_name = 5,<br>
> + CPU_arch = 6,<br>
> + CPU_arch_profile = 7,<br>
> + ARM_ISA_use = 8,<br>
> + THUMB_ISA_use = 9,<br>
> + FP_arch = 10,<br>
> + WMMX_arch = 11,<br>
> + Advanced_SIMD_arch = 12,<br>
> + PCS_config = 13,<br>
> + ABI_PCS_R9_use = 14,<br>
> + ABI_PCS_RW_data = 15,<br>
> + ABI_PCS_RO_data = 16,<br>
> + ABI_PCS_GOT_use = 17,<br>
> + ABI_PCS_wchar_t = 18,<br>
> + ABI_FP_rounding = 19,<br>
> + ABI_FP_denormal = 20,<br>
> + ABI_FP_exceptions = 21,<br>
> + ABI_FP_user_exceptions = 22,<br>
> + ABI_FP_number_model = 23,<br>
> + ABI_align8_needed = 24,<br>
> + ABI_align8_preserved = 25,<br>
> + ABI_enum_size = 26,<br>
> + ABI_HardFP_use = 27,<br>
> + ABI_VFP_args = 28,<br>
> + ABI_WMMX_args = 29,<br>
> + ABI_optimization_goals = 30,<br>
> + ABI_FP_optimization_goals = 31,<br>
> + compatibility = 32,<br>
> + CPU_unaligned_access = 34,<br>
> + FP_HP_extension = 36,<br>
> + ABI_FP_16bit_format = 38,<br>
> + MPextension_use = 42, // was 70, 2.08 ABI<br>
> + DIV_use = 44,<br>
> + nodefaults = 64,<br>
> + also_compatible_with = 65,<br>
> + T2EE_use = 66,<br>
> + conformance = 67,<br>
> + Virtualization_use = 68,<br>
> + MPextension_use_old = 70<br>
> +};<br>
> +<br>
> +// Magic numbers for .ARM.attributes<br>
> +enum AttrMagic {<br>
> + Format_Version = 0x41<br>
> +};<br>
> +<br>
> +// Legal Values for CPU_arch, (=6), uleb128<br>
> +enum CPUArch {<br>
> + Pre_v4 = 0,<br>
> + v4 = 1, // e.g. SA110<br>
> + v4T = 2, // e.g. ARM7TDMI<br>
> + v5T = 3, // e.g. ARM9TDMI<br>
> + v5TE = 4, // e.g. ARM946E_S<br>
> + v5TEJ = 5, // e.g. ARM926EJ_S<br>
> + v6 = 6, // e.g. ARM1136J_S<br>
> + v6KZ = 7, // e.g. ARM1176JZ_S<br>
> + v6T2 = 8, // e.g. ARM1156T2F_S<br>
> + v6K = 9, // e.g. ARM1136J_S<br>
> + v7 = 10, // e.g. Cortex A8, Cortex M3<br>
> + v6_M = 11, // e.g. Cortex M1<br>
> + v6S_M = 12, // v6_M with the System extensions<br>
> + v7E_M = 13, // v7_M with DSP extensions<br>
> + v8<br>
> +};<br>
> +<br>
> +enum CPUArchProfile { // (=7), uleb128<br>
> + Not_Applicable = 0, // pre v7, or cross-profile code<br>
> + ApplicationProfile = (0x41), // 'A' (e.g. for Cortex A8)<br>
> + RealTimeProfile = (0x52), // 'R' (e.g. for Cortex R4)<br>
> + MicroControllerProfile = (0x4D), // 'M' (e.g. for Cortex M3)<br>
> + SystemProfile = (0x53) // 'S' Application or real-time profile<br>
> +};<br>
> +<br>
> +// The following have a lot of common use cases<br>
> +enum {<br>
> + //ARMISAUse (=8), uleb128 and THUMBISAUse (=9), uleb128<br>
> + Not_Allowed = 0,<br>
> + Allowed = 1<br>
> +};<br>
> +<br>
> +enum {<br>
> + // FP_arch (=10), uleb128 (formerly Tag_VFP_arch = 10)<br>
> + AllowFPv2 = 2, // v2 FP ISA permitted (implies use of the v1 FP ISA)<br>
> + AllowFPv3A = 3, // v3 FP ISA permitted (implies use of the v2 FP ISA)<br>
> + AllowFPv3B = 4, // v3 FP ISA permitted, but only D0-D15, S0-S31<br>
> + AllowFPv4A = 5, // v4 FP ISA permitted (implies use of v3 FP ISA)<br>
> + AllowFPv4B = 6, // v4 FP ISA was permitted, but only D0-D15, S0-S31<br>
> + AllowV8FP = 7, // ARMv8-A FP ISA permitted<br>
> + AllowV8FPB = 8 // ARMv8-A FP ISA permitted, but only D0-D15, S0-D31<br>
> +};<br>
> +<br>
> +enum {<br>
> + // Tag_THUMB_ISA_use, (=9), uleb128<br>
> + AllowThumb32 = 2 // 32-bit Thumb (implies 16-bit instructions)<br>
> +};<br>
> +<br>
> +enum {<br>
> + // Tag_WMMX_arch, (=11), uleb128<br>
> + AllowWMMXv1 = 1, // The user permitted this entity to use WMMX v1<br>
> + AllowWMMXv2 = 2 // The user permitted this entity to use WMMX v2<br>
> +};<br>
> +<br>
> +enum {<br>
> + // Tag_ABI_FP_denormal, (=20), uleb128<br>
> + MightFlushToZero = 0, // Denormal numbers might be flushed to (+) zero<br>
> + IEEE754Denormal = 1 , // Depends on IEEE 754 denormal numbers<br>
> + PreserveFPSign = 2 // Sign when flushed-to-zero is preserved<br>
> +};<br>
> +<br>
> +enum {<br>
> + // Tag_ABI_FP_number_model, (=23), uleb128<br>
> + AllowNormal = 1, // Use IEEE 754 format normal numbers only<br>
> + AllowRTABI = 2, // numbers, infinities, and one quiet NaN (see [RTABI])<br>
> + AllowIEE754 = 3 // this code to use all the IEEE 754-defined FP encodings<br>
> +};<br>
> +<br>
> +enum {<br>
> + // Tag_ABI_FP_rounding, (=19), uleb128<br>
> + FPRoundingNearest = 0, // Use the IEEE 754 round to nearest rounding mode<br>
> + FPRoundingRuntime = 1 // Choose the IEEE 754 rounding mode at run time<br>
> +};<br>
> +<br>
> +enum {<br>
> + // Tag_DIV_use, (=44), uleb128<br>
> + AllowDIVThumb = 0, // Allow SDIV, UDIV on Thumb ISA, e.g. Cortex R4 or M3<br>
> + NotAllowedDIV = 1, // Disallow SDIV and UDIV<br>
> + AllowDIVv7a = 2 // Allow SDIV, UDIV on v7-a with integer div extension<br>
> +};<br>
> +<br>
> +enum {<br>
> + // Tag_Virtualization_use, (=42), uleb128<br>
> + TrustZone = 1, // Use of the TrustZone extension was permitted<br>
> + VirtExts = 2, // Use of virtualization extensions (HVC, ERET) permitted<br>
> + TrustZoneVirtExts = 3 // TrustZone and virtualization extensions permitted<br>
> +};<br>
> +<br>
> +enum {<br>
> + // Tag_PCS_config, (=13), uleb128<br>
> + PCS_none = 0, // No standard configuration used, or no information recorded<br>
> + PCS_bare = 1, // Bare platform configuration<br>
> + PCS_linux = 2, // Linux application configuration<br>
> + PCS_linux_dso = 3, // Linux DSO configuration<br>
> + PCS_palm_2004 = 4, // Palm OS 2004 configuration<br>
> + PCS_palm_future = 5, // Reserved to future Palm OS configuration<br>
> + PCS_symbian_2004 = 6, // Symbian OS 2004 configuration<br>
> + PCS_symbian_future = 7 // Reserved to future Symbian OS configuration<br>
> +};<br>
> +<br>
> +enum {<br>
> + // Tag_ABI_PCS_R9_use, (=14), uleb128<br>
> + PCS_R9_normal = 0, // R9 used as V6 (just another callee-saved register,<br>
> + // implied by omitting the tag)<br>
> + PCS_R9_SB = 1, // R9 used as SB, a global Static Base register<br>
> + PCS_R9_TLS = 2, // R9 used as a Thread Local Storage (TLS) pointer<br>
> + PCS_R9_none = 3 // R9 not used at all by code associated with<br>
> + // the attributed entity.<br>
> +};<br>
> +<br>
> +enum {<br>
> + // Tag_ABI_PCS_RW_data, (=15), uleb128<br>
> + PCS_RW_data_abs = 0, // RW static data permitted to be addressed absolutely<br>
> + PCS_RW_data_pcrel = 1, // RW static data was only permitted to be<br>
> + // addressed PC-relative.<br>
> + PCS_RW_data_sbrel = 2, // RW static data was only permitted to be addressed<br>
> + // SB-relative.<br>
> + PCS_RW_data_none = 3 // No permission to use RW static data<br>
> +};<br>
> +<br>
> +enum {<br>
> + // Tag_ABI_PCS_RO_data, (=16), uleb128<br>
> + PCS_RO_data_abs = 0, // RO static data permitted to be addressed absolutely<br>
> + PCS_RO_data_pcrel = 1, // RO static data was only permitted to be<br>
> + // addressed PC-relative.<br>
> + PCS_RO_data_none = 2 // No permission to use RO static data<br>
> +};<br>
> +<br>
> +enum {<br>
> + // Tag_ABI_PCS_GOT_use, (=17), uleb128<br>
> + PCS_GOT_none = 0, // No permission to import static data<br>
> + PCS_GOT_direct = 1, // Permission to address imported data directly<br>
> + PCS_GOT_indirect = 2 // The user permitted this entity to address imported<br>
> + // data indirectly (e.g. via a GOT)<br>
> +};<br>
> +<br>
> +enum {<br>
> + // Tag_ABI_PCS_wchar_t, (=18), uleb128<br>
> + PCS_wchar_t_disallowed = 0, // The user prohibited the use of wchar_t<br>
> + PCS_wchar_t_2 = 2, // The user intended the size of wchar_t to be 2<br>
> + PCS_wchar_t_4 = 4 // The user intended the size of wchar_t to be 4<br>
> +};<br>
> +<br>
> +enum {<br>
> + // Tag_ABI_enum_size, (=26), uleb128<br>
> + PCS_enum_size = 1, // Enum values occupy the smallest container big enough<br>
> + // to hold all their values.<br>
> + PCS_enum_size_32 = 2, // The user intended Enum containers to be 32-bit<br>
> + PCS_enum_size_abi32 = 3 // The user intended that every enumeration visible<br>
> + // across an ABI-complying interface contains a value needing 32 bits to<br>
> + // encode it; other enums can be containerized.<br>
> +};<br>
> +<br>
> +enum {<br>
> + // Tag_ABI_align_needed, (=24), uleb128<br>
> + PCS_Align_needed_disallowed = 0, // The user did not permit code to depend<br>
> + // the alignment of 8-byte data or data with extended (>8-byte) alignment.<br>
> + PCS_Align_needed_8 = 1, // Code was permitted to depend on the 8-byte<br>
> + // alignment of 8-byte data items.<br>
> + PCS_Align_needed_4 = 2, // Code was permitted to depend on the 4-byte<br>
> + // alignment of 8-byte data items.<br>
> + PCS_Align_needed_res = 3 // Reserved<br>
> + // OR: n (in 4..12) Code was permitted to depend on the 8-byte alignment of<br>
> + // 8-byte data items and the alignment of data items having up to 2^n byte<br>
> + // extended alignment.<br>
> +};<br>
> +<br>
> +enum {<br>
> + // Tag_ABI_align_preserved, (=25), uleb128<br>
> + PCS_Align_preserved_none = 0, // The user did not require code to preserve<br>
> + // 8-byte alignment of 8-byte data objects.<br>
> + PCS_Align_preserved_8 = 1, // Code was required to preserve 8-byte alignment<br>
> + // of 8-byte data objects.<br>
> + PCS_Align_preserved_8sp = 2, // Code was required to preserve 8-byte<br>
> + // alignment of 8-byte data objects and to ensure (SP MOD 8) = 0 at all<br>
> + // instruction boundaries (not just at function calls).<br>
> + PCS_Align_preserved_res = 3 // Reserved<br>
> + // OR: n (in 4..12) Code was required to preserve the alignments of case 2<br>
> + // and the alignment of data items having up to 2^n byte extended alignment<br>
> +};<br>
> +<br>
> +enum {<br>
> + // Tag_ABI_HardFP_use, (=27), uleb128<br>
> + HardFPImplied = 0, // FP use should be implied by Tag_FP_arch<br>
> + HardFP_SP_VFP = 1, // Use only SP FP instructions<br>
> + HardFP_Reserved = 2, // Reserved<br>
> + HardFP_ImpliedDup = 3 // Deprecated duplicate of the default HardFPImplied<br>
> +};<br>
> +<br>
> +enum {<br>
> + // Tag_ABI_VFP_args, (=28), uleb128<br>
> + VFPArgs_base = 0, // FP parameter/result passing using AAPCS, base variant<br>
> + VFPArgs_VFP = 1, // FP parameter/result passing using AAPCS, VFP variant<br>
> + VFPArgs_toolchain = 2, // FP parameter/result passing to conform to tool<br>
> + // chain-specific conventions<br>
> + VFPArgs_baseVFP = 3 // FP parameter/result passing using both base and VFP<br>
> + //variants. Did not permit non-variadic functions to pass FP params/results.<br>
> +};<br>
> +<br>
> +/// Contains build ARM aeabi attribute values.<br>
> +class ARMGenericBuildAttrInfo {<br>
> +public:<br>
> + ARMGenericBuildAttrInfo()<br>
> + : Valid(false) {}<br>
> +<br>
> + CPUArch Tag_CPU_arch;<br>
> + CPUArchProfile Tag_CPU_arch_profile;<br>
> + std::string Tag_CPU_raw_name;<br>
> + std::string Tag_CPU_name;<br>
> + unsigned Tag_ARM_ISA_use;<br>
> + unsigned Tag_THUMB_ISA_use;<br>
> + unsigned Tag_FP_arch;<br>
> + unsigned Tag_WMMX_arch;<br>
> + unsigned Tag_Advanced_SIMD_arch;<br>
> + unsigned Tag_FP_HP_extension;<br>
> + unsigned Tag_CPU_unaligned_access;<br>
> + unsigned Tag_MPextension_use;<br>
> + unsigned Tag_DIV_use;<br>
> + unsigned Tag_T2EE_use;<br>
> + unsigned Tag_Virtualization_use;<br>
> + unsigned Tag_ABI_optimization_goals;<br>
> + unsigned Tag_ABI_FP_optimization_goals;<br>
> +<br>
> + //PCS/ABI attributes<br>
> + unsigned Tag_PCS_config;<br>
> + unsigned Tag_ABI_PCS_R9_use;<br>
> + unsigned Tag_ABI_PCS_RW_data;<br>
> + unsigned Tag_ABI_PCS_RO_data;<br>
> + unsigned Tag_ABI_PCS_GOT_use;<br>
> + unsigned Tag_ABI_PCS_wchar_t;<br>
> + unsigned Tag_ABI_enum_size;<br>
> + unsigned Tag_ABI_align8_needed;<br>
> + unsigned Tag_ABI_align8_preserved;<br>
> +<br>
> + //FP<br>
> + unsigned Tag_ABI_FP_rounding;<br>
> + unsigned Tag_ABI_FP_denormal;<br>
> + unsigned Tag_ABI_FP_number_model;<br>
> + unsigned Tag_ABI_FP_exceptions;<br>
> + unsigned Tag_ABI_FP_user_exceptions;<br>
> + unsigned Tag_ABI_HardFP_use;<br>
> + unsigned Tag_ABI_VFP_args;<br>
> +<br>
> +private:<br>
> + bool Valid;<br>
> +<br>
> +public:<br>
> + /// Indicates whether this instance contains valid or default values.<br>
> + bool isValid() { return Valid; }<br>
> + void setValid(bool v) { Valid = v; }<br>
> +};<br>
> +<br>
> +}<br>
> +} // llvm<br>
> +<br>
> +#endif // LLVM_OBJECT_ELF_ARM_H<br>
><br>
> Modified: llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp?rev=181009&r1=181008&r2=181009&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp?rev=181009&r1=181008&r2=181009&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp (original)<br>
> +++ llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp Fri May 3 06:36:35 2013<br>
> @@ -15,7 +15,6 @@<br>
> #define DEBUG_TYPE "asm-printer"<br>
> #include "ARMAsmPrinter.h"<br>
> #include "ARM.h"<br>
> -#include "ARMBuildAttrs.h"<br>
> #include "ARMConstantPoolValue.h"<br>
> #include "ARMMachineFunctionInfo.h"<br>
> #include "ARMTargetMachine.h"<br>
> @@ -44,6 +43,7 @@<br>
> #include "llvm/MC/MCSectionMachO.h"<br>
> #include "llvm/MC/MCStreamer.h"<br>
> #include "llvm/MC/MCSymbol.h"<br>
> +#include "llvm/Object/ELF_ARM.h"<br>
> #include "llvm/Support/CommandLine.h"<br>
> #include "llvm/Support/Debug.h"<br>
> #include "llvm/Support/ELF.h"<br>
> @@ -90,7 +90,7 @@ namespace {<br>
> break;<br>
> /* GAS requires .fpu to be emitted regardless of EABI attribute */<br>
> case ARMBuildAttrs::Advanced_SIMD_arch:<br>
> - case ARMBuildAttrs::VFP_arch:<br>
> + case ARMBuildAttrs::FP_arch:<br>
> Streamer.EmitRawText(StringRef("\t.fpu ") + String.lower());<br>
> break;<br>
> }<br>
> @@ -798,24 +798,24 @@ void ARMAsmPrinter::emitAttributes() {<br>
><br>
> /* VFPv4 + .fpu */<br>
> if (Subtarget->hasVFP4()) {<br>
> - AttrEmitter->EmitAttribute(ARMBuildAttrs::VFP_arch,<br>
> + AttrEmitter->EmitAttribute(ARMBuildAttrs::FP_arch,<br>
> ARMBuildAttrs::AllowFPv4A);<br>
> if (emitFPU)<br>
> - AttrEmitter->EmitTextAttribute(ARMBuildAttrs::VFP_arch, "vfpv4");<br>
> + AttrEmitter->EmitTextAttribute(ARMBuildAttrs::FP_arch, "vfpv4");<br>
><br>
> /* VFPv3 + .fpu */<br>
> } else if (Subtarget->hasVFP3()) {<br>
> - AttrEmitter->EmitAttribute(ARMBuildAttrs::VFP_arch,<br>
> + AttrEmitter->EmitAttribute(ARMBuildAttrs::FP_arch,<br>
> ARMBuildAttrs::AllowFPv3A);<br>
> if (emitFPU)<br>
> - AttrEmitter->EmitTextAttribute(ARMBuildAttrs::VFP_arch, "vfpv3");<br>
> + AttrEmitter->EmitTextAttribute(ARMBuildAttrs::FP_arch, "vfpv3");<br>
><br>
> /* VFPv2 + .fpu */<br>
> } else if (Subtarget->hasVFP2()) {<br>
> - AttrEmitter->EmitAttribute(ARMBuildAttrs::VFP_arch,<br>
> + AttrEmitter->EmitAttribute(ARMBuildAttrs::FP_arch,<br>
> ARMBuildAttrs::AllowFPv2);<br>
> if (emitFPU)<br>
> - AttrEmitter->EmitTextAttribute(ARMBuildAttrs::VFP_arch, "vfpv2");<br>
> + AttrEmitter->EmitTextAttribute(ARMBuildAttrs::FP_arch, "vfpv2");<br>
> }<br>
><br>
> /* TODO: ARMBuildAttrs::Allowed is not completely accurate,<br>
><br>
> Removed: llvm/trunk/lib/Target/ARM/ARMBuildAttrs.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBuildAttrs.h?rev=181008&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBuildAttrs.h?rev=181008&view=auto</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Target/ARM/ARMBuildAttrs.h (original)<br>
> +++ llvm/trunk/lib/Target/ARM/ARMBuildAttrs.h (removed)<br>
> @@ -1,131 +0,0 @@<br>
> -//===-- ARMBuildAttrs.h - ARM Build Attributes ------------------*- C++ -*-===//<br>
> -//<br>
> -// The LLVM Compiler Infrastructure<br>
> -//<br>
> -// This file is distributed under the University of Illinois Open Source<br>
> -// License. See LICENSE.TXT for details.<br>
> -//<br>
> -//===----------------------------------------------------------------------===//<br>
> -//<br>
> -// This file contains enumerations and support routines for ARM build attributes<br>
> -// as defined in ARM ABI addenda document (ABI release 2.08).<br>
> -//<br>
> -//===----------------------------------------------------------------------===//<br>
> -<br>
> -#ifndef __TARGET_ARMBUILDATTRS_H__<br>
> -#define __TARGET_ARMBUILDATTRS_H__<br>
> -<br>
> -namespace ARMBuildAttrs {<br>
> - enum SpecialAttr {<br>
> - // This is for the .cpu asm attr. It translates into one or more<br>
> - // AttrType (below) entries in the .ARM.attributes section in the ELF.<br>
> - SEL_CPU<br>
> - };<br>
> -<br>
> - enum AttrType {<br>
> - // Rest correspond to ELF/.ARM.attributes<br>
> - File = 1,<br>
> - Section = 2,<br>
> - Symbol = 3,<br>
> - CPU_raw_name = 4,<br>
> - CPU_name = 5,<br>
> - CPU_arch = 6,<br>
> - CPU_arch_profile = 7,<br>
> - ARM_ISA_use = 8,<br>
> - THUMB_ISA_use = 9,<br>
> - VFP_arch = 10,<br>
> - WMMX_arch = 11,<br>
> - Advanced_SIMD_arch = 12,<br>
> - PCS_config = 13,<br>
> - ABI_PCS_R9_use = 14,<br>
> - ABI_PCS_RW_data = 15,<br>
> - ABI_PCS_RO_data = 16,<br>
> - ABI_PCS_GOT_use = 17,<br>
> - ABI_PCS_wchar_t = 18,<br>
> - ABI_FP_rounding = 19,<br>
> - ABI_FP_denormal = 20,<br>
> - ABI_FP_exceptions = 21,<br>
> - ABI_FP_user_exceptions = 22,<br>
> - ABI_FP_number_model = 23,<br>
> - ABI_align8_needed = 24,<br>
> - ABI_align8_preserved = 25,<br>
> - ABI_enum_size = 26,<br>
> - ABI_HardFP_use = 27,<br>
> - ABI_VFP_args = 28,<br>
> - ABI_WMMX_args = 29,<br>
> - ABI_optimization_goals = 30,<br>
> - ABI_FP_optimization_goals = 31,<br>
> - compatibility = 32,<br>
> - CPU_unaligned_access = 34,<br>
> - VFP_HP_extension = 36,<br>
> - ABI_FP_16bit_format = 38,<br>
> - MPextension_use = 42, // was 70, 2.08 ABI<br>
> - DIV_use = 44,<br>
> - nodefaults = 64,<br>
> - also_compatible_with = 65,<br>
> - T2EE_use = 66,<br>
> - conformance = 67,<br>
> - Virtualization_use = 68,<br>
> - MPextension_use_old = 70<br>
> - };<br>
> -<br>
> - // Magic numbers for .ARM.attributes<br>
> - enum AttrMagic {<br>
> - Format_Version = 0x41<br>
> - };<br>
> -<br>
> - // Legal Values for CPU_arch, (=6), uleb128<br>
> - enum CPUArch {<br>
> - Pre_v4 = 0,<br>
> - v4 = 1, // e.g. SA110<br>
> - v4T = 2, // e.g. ARM7TDMI<br>
> - v5T = 3, // e.g. ARM9TDMI<br>
> - v5TE = 4, // e.g. ARM946E_S<br>
> - v5TEJ = 5, // e.g. ARM926EJ_S<br>
> - v6 = 6, // e.g. ARM1136J_S<br>
> - v6KZ = 7, // e.g. ARM1176JZ_S<br>
> - v6T2 = 8, // e.g. ARM1156T2F_S<br>
> - v6K = 9, // e.g. ARM1136J_S<br>
> - v7 = 10, // e.g. Cortex A8, Cortex M3<br>
> - v6_M = 11, // e.g. Cortex M1<br>
> - v6S_M = 12, // v6_M with the System extensions<br>
> - v7E_M = 13 // v7_M with DSP extensions<br>
> - };<br>
> -<br>
> - enum CPUArchProfile { // (=7), uleb128<br>
> - Not_Applicable = 0, // pre v7, or cross-profile code<br>
> - ApplicationProfile = (0x41), // 'A' (e.g. for Cortex A8)<br>
> - RealTimeProfile = (0x52), // 'R' (e.g. for Cortex R4)<br>
> - MicroControllerProfile = (0x4D), // 'M' (e.g. for Cortex M3)<br>
> - SystemProfile = (0x53) // 'S' Application or real-time profile<br>
> - };<br>
> -<br>
> - // The following have a lot of common use cases<br>
> - enum {<br>
> - //ARMISAUse (=8), uleb128 and THUMBISAUse (=9), uleb128<br>
> - Not_Allowed = 0,<br>
> - Allowed = 1,<br>
> -<br>
> - // FP_arch (=10), uleb128 (formerly Tag_VFP_arch = 10)<br>
> - AllowFPv2 = 2, // v2 FP ISA permitted (implies use of the v1 FP ISA)<br>
> - AllowFPv3A = 3, // v3 FP ISA permitted (implies use of the v2 FP ISA)<br>
> - AllowFPv3B = 4, // v3 FP ISA permitted, but only D0-D15, S0-S31<br>
> - AllowFPv4A = 5, // v4 FP ISA permitted (implies use of v3 FP ISA)<br>
> - AllowFPv4B = 6, // v4 FP ISA was permitted, but only D0-D15, S0-S31<br>
> -<br>
> - // Tag_WMMX_arch, (=11), uleb128<br>
> - AllowThumb32 = 2, // 32-bit Thumb (implies 16-bit instructions)<br>
> -<br>
> - // Tag_WMMX_arch, (=11), uleb128<br>
> - AllowWMMXv1 = 2, // The user permitted this entity to use WMMX v2<br>
> -<br>
> - // Tag_ABI_FP_denormal, (=20), uleb128<br>
> - PreserveFPSign = 2, // sign when flushed-to-zero is preserved<br>
> -<br>
> - // Tag_ABI_FP_number_model, (=23), uleb128<br>
> - AllowRTABI = 2, // numbers, infinities, and one quiet NaN (see [RTABI])<br>
> - AllowIEE754 = 3 // this code to use all the IEEE 754-defined FP encodings<br>
> - };<br>
> -}<br>
> -<br>
> -#endif // __TARGET_ARMBUILDATTRS_H__<br>
><br>
> Added: llvm/trunk/test/Object/Inputs/arm-attributes.elf-arm<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/Inputs/arm-attributes.elf-arm?rev=181009&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/Inputs/arm-attributes.elf-arm?rev=181009&view=auto</a><br>
> ==============================================================================<br>
> Binary file - no diff available.<br>
><br>
> Propchange: llvm/trunk/test/Object/Inputs/arm-attributes.elf-arm<br>
> ------------------------------------------------------------------------------<br>
> svn:mime-type = application/octet-stream<br>
><br>
> Added: llvm/trunk/test/Object/Inputs/trivial-object-test.elf-arm<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/Inputs/trivial-object-test.elf-arm?rev=181009&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/Inputs/trivial-object-test.elf-arm?rev=181009&view=auto</a><br>
> ==============================================================================<br>
> Binary file - no diff available.<br>
><br>
> Propchange: llvm/trunk/test/Object/Inputs/trivial-object-test.elf-arm<br>
> ------------------------------------------------------------------------------<br>
> svn:mime-type = application/octet-stream<br>
><br>
> Added: llvm/trunk/test/Object/readobj-elf-arm-buildattrs.test<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/readobj-elf-arm-buildattrs.test?rev=181009&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/readobj-elf-arm-buildattrs.test?rev=181009&view=auto</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Object/readobj-elf-arm-buildattrs.test (added)<br>
> +++ llvm/trunk/test/Object/readobj-elf-arm-buildattrs.test Fri May 3 06:36:35 2013<br>
> @@ -0,0 +1,46 @@<br>
> +RUN: llvm-readobj -arm-buildattrs %p/Inputs/trivial-object-test.elf-arm \<br>
> +RUN: | FileCheck %s -check-prefix=SMALL<br>
> +RUN: llvm-readobj -arm-buildattrs %p/Inputs/arm-attributes.elf-arm \<br>
> +RUN: | FileCheck %s -check-prefix=LARGE<br>
> +<br>
> +SMALL: ARMBuildAttributes {<br>
> +SMALL: Tag_CPU_name: Cortex-A8<br>
> +SMALL: Tag_CPU_arch: 10<br>
> +SMALL: Tag_ARM_ISA_use: 1<br>
> +SMALL: Tag_THUMB_ISA_use: 2<br>
> +SMALL: Tag_FP_arch: 3<br>
> +SMALL: Tag_Advanced_SIMD_arch: 1<br>
> +SMALL: Tag_ABI_FP_denormal: 1<br>
> +SMALL: Tag_ABI_FP_exceptions: 1<br>
> +SMALL: Tag_ABI_FP_number_model: 3<br>
> +SMALL: Tag_ABI_align8_needed: 1<br>
> +SMALL: Tag_ABI_align8_preserved: 1<br>
> +SMALL: Tag_ABI_HardFP_use: 3<br>
> +SMALL: Tag_ABI_VFP_args: 1<br>
> +SMALL: Tag_DIV_use: 1<br>
> +SMALL: Tag_Virtualization_use: 1<br>
> +<br>
> +LARGE: ARMBuildAttributes {<br>
> +LARGE: Tag_CPU_name: iwmmxt2<br>
> +LARGE: Tag_CPU_arch: 4<br>
> +LARGE: Tag_ARM_ISA_use: 1<br>
> +LARGE: Tag_THUMB_ISA_use: 1<br>
> +LARGE: Tag_WMMX_arch: 2<br>
> +LARGE: Tag_Advanced_SIMD_arch: 1<br>
> +LARGE: Tag_ABI_PCS_RW_data: 3<br>
> +LARGE: Tag_ABI_PCS_GOT_use: 2<br>
> +LARGE: Tag_ABI_PCS_wchar_t: 4<br>
> +LARGE: Tag_ABI_FP_rounding: 1<br>
> +LARGE: Tag_ABI_FP_denormal: 1<br>
> +LARGE: Tag_ABI_FP_exceptions: 1<br>
> +LARGE: Tag_ABI_FP_number_model: 3<br>
> +LARGE: Tag_ABI_align8_needed: 1<br>
> +LARGE: Tag_ABI_align8_preserved: 1<br>
> +LARGE: Tag_ABI_enum_size: 2<br>
> +LARGE: Tag_ABI_HardFP_use: 3<br>
> +LARGE: Tag_ABI_VFP_args: 1<br>
> +LARGE: Tag_ABI_optimization_goals: 1<br>
> +LARGE: Tag_CPU_unaligned_access: 1<br>
> +LARGE: Tag_FP_HP_extension: 1<br>
> +LARGE: Tag_DIV_use: 1<br>
> +LARGE: Tag_T2EE_use: 1<br>
><br>
> Modified: llvm/trunk/tools/llvm-readobj/ELFDumper.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ELFDumper.cpp?rev=181009&r1=181008&r2=181009&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ELFDumper.cpp?rev=181009&r1=181008&r2=181009&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/tools/llvm-readobj/ELFDumper.cpp (original)<br>
> +++ llvm/trunk/tools/llvm-readobj/ELFDumper.cpp Fri May 3 06:36:35 2013<br>
> @@ -51,6 +51,7 @@ public:<br>
> virtual void printDynamicTable() LLVM_OVERRIDE;<br>
> virtual void printNeededLibraries() LLVM_OVERRIDE;<br>
> virtual void printProgramHeaders() LLVM_OVERRIDE;<br>
> + virtual void printARMBuildAttributes() LLVM_OVERRIDE;<br>
><br>
> private:<br>
> typedef ELFObjectFile<ELFT> ELFO;<br>
> @@ -858,3 +859,65 @@ void ELFDumper<ELFT>::printProgramHeader<br>
> W.printNumber("Alignment", PI->p_align);<br>
> }<br>
> }<br>
> +<br>
> +#define LLVM_READOBJ_ARMATTR_NUMCASE(X) case ARMBuildAttrs::X: \<br>
> + W.printNumber(" Tag_" #X, BuildAttrs.Tag_##X); \<br>
> + break; \<br>
> +<br>
> +#define LLVM_READOBJ_ARMATTR_STRCASE(X) case ARMBuildAttrs::X: \<br>
> + W.printString(" Tag_" #X, BuildAttrs.Tag_##X); \<br>
> + break; \<br>
> +<br>
> +template<class ELFT><br>
> +void ELFDumper<ELFT>::printARMBuildAttributes() {<br>
> + if (Obj->getArch() != Triple::arm || !Obj->hasARMBuildAttributes())<br>
> + return;<br>
> + ARMBuildAttrs::ARMGenericBuildAttrInfo BuildAttrs;<br>
> + SmallVector<unsigned, 16> AttrsRead;<br>
> + error_code EC = Obj->readARMBuildAttributes(BuildAttrs, AttrsRead);<br>
> + if (error(EC))<br>
> + return;<br>
> +<br>
> + DictScope D(W, "ARMBuildAttributes");<br>
> +<br>
> + for (SmallVector<unsigned, 16>::iterator I = AttrsRead.begin(),<br>
> + E = AttrsRead.end(); I != E; ++I) {<br>
> + switch (*I) {<br>
> + LLVM_READOBJ_ARMATTR_STRCASE(CPU_name)<br>
> + LLVM_READOBJ_ARMATTR_STRCASE(CPU_raw_name)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(CPU_arch)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(CPU_arch_profile)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(ARM_ISA_use)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(THUMB_ISA_use)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(FP_arch)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(WMMX_arch)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(Advanced_SIMD_arch)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(PCS_config)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(ABI_PCS_R9_use)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(ABI_PCS_RW_data)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(ABI_PCS_RO_data)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(ABI_PCS_GOT_use)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(ABI_PCS_wchar_t)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(ABI_FP_rounding)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(ABI_FP_denormal)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(ABI_FP_exceptions)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(ABI_FP_user_exceptions)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(ABI_FP_number_model)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(ABI_align8_needed)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(ABI_align8_preserved)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(ABI_enum_size)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(ABI_HardFP_use)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(ABI_VFP_args)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(CPU_unaligned_access)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(FP_HP_extension)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(MPextension_use)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(DIV_use)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(T2EE_use)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(Virtualization_use)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(ABI_optimization_goals)<br>
> + LLVM_READOBJ_ARMATTR_NUMCASE(ABI_FP_optimization_goals)<br>
> + default:<br>
> + break;<br>
> + }<br>
> + }<br>
> +}<br>
><br>
> Modified: llvm/trunk/tools/llvm-readobj/ObjDumper.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ObjDumper.h?rev=181009&r1=181008&r2=181009&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ObjDumper.h?rev=181009&r1=181008&r2=181009&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/tools/llvm-readobj/ObjDumper.h (original)<br>
> +++ llvm/trunk/tools/llvm-readobj/ObjDumper.h Fri May 3 06:36:35 2013<br>
> @@ -39,6 +39,7 @@ public:<br>
> virtual void printDynamicTable() { }<br>
> virtual void printNeededLibraries() { }<br>
> virtual void printProgramHeaders() { }<br>
> + virtual void printARMBuildAttributes() { }<br>
><br>
> protected:<br>
> StreamWriter& W;<br>
><br>
> Modified: llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp?rev=181009&r1=181008&r2=181009&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp?rev=181009&r1=181008&r2=181009&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp (original)<br>
> +++ llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp Fri May 3 06:36:35 2013<br>
> @@ -128,6 +128,10 @@ namespace opts {<br>
> // -expand-relocs<br>
> cl::opt<bool> ExpandRelocs("expand-relocs",<br>
> cl::desc("Expand each shown relocation to multiple lines"));<br>
> +<br>
> + // -arm-buildattrs<br>
> + cl::opt<bool> ArmBuildAttrs("arm-buildattrs",<br>
> + cl::desc("Display ARM ELF build attributes"));<br>
> } // namespace opts<br>
><br>
> namespace llvm {<br>
> @@ -221,6 +225,8 @@ static void dumpObject(const ObjectFile<br>
> Dumper->printNeededLibraries();<br>
> if (opts::ProgramHeaders)<br>
> Dumper->printProgramHeaders();<br>
> + if (opts::ArmBuildAttrs)<br>
> + Dumper->printARMBuildAttributes();<br>
> }<br>
><br>
><br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>