[lld] r319304 - [ELF] Make sure SHT_ARM_ATTRIBUTES is only recognized by Arm Targets

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 29 02:20:46 PST 2017


Author: psmith
Date: Wed Nov 29 02:20:46 2017
New Revision: 319304

URL: http://llvm.org/viewvc/llvm-project?rev=319304&view=rev
Log:
[ELF] Make sure SHT_ARM_ATTRIBUTES is only recognized by Arm Targets

The SHT_ARM_ATTRIBUTES section type is in the processor specific space
adding guard to make sure that it is only recognized when EMachine is
EM_ARM.


Modified:
    lld/trunk/ELF/InputFiles.cpp

Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=319304&r1=319303&r2=319304&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Wed Nov 29 02:20:46 2017
@@ -471,6 +471,8 @@ InputSectionBase *ObjFile<ELFT>::createI
 
   switch (Sec.sh_type) {
   case SHT_ARM_ATTRIBUTES: {
+    if (Config->EMachine != EM_ARM)
+      break;
     ARMAttributeParser Attributes;
     ArrayRef<uint8_t> Contents = check(this->getObj().getSectionContents(&Sec));
     Attributes.Parse(Contents, /*isLittle*/Config->EKind == ELF32LEKind);




More information about the llvm-commits mailing list