[lld] r189138 - [lld][ELF][Cleanup] Section associated with the relocation traversed

Shankar Easwaran shankare at codeaurora.org
Fri Aug 23 13:03:31 PDT 2013


Author: shankare
Date: Fri Aug 23 15:03:31 2013
New Revision: 189138

URL: http://llvm.org/viewvc/llvm-project?rev=189138&view=rev
Log:
[lld][ELF][Cleanup] Section associated with the relocation traversed

There is no change in functionality, this uses the defined way to access
the relocation section that belongs to a particular section.

Modified:
    lld/trunk/lib/ReaderWriter/ELF/File.h

Modified: lld/trunk/lib/ReaderWriter/ELF/File.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/File.h?rev=189138&r1=189137&r2=189138&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/File.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/File.h Fri Aug 23 15:03:31 2013
@@ -185,14 +185,12 @@ public:
         _sectionSymbols[section];
 
       if (section->sh_type == llvm::ELF::SHT_RELA) {
-        auto sectionName = _objFile->getSectionName(section);
+        auto sHdr = _objFile->getSection(section->sh_info);
+
+        auto sectionName = _objFile->getSectionName(sHdr);
         if (!sectionName)
           return error_code(sectionName);
 
-        // Get rid of the leading .rela so Atoms can use their own section
-        // name to find the relocs.
-        *sectionName = sectionName->drop_front(5);
-
         auto rai(_objFile->begin_rela(section));
         auto rae(_objFile->end_rela(section));
 
@@ -201,14 +199,12 @@ public:
       }
 
       if (section->sh_type == llvm::ELF::SHT_REL) {
-        auto sectionName = _objFile->getSectionName(section);
+        auto sHdr = _objFile->getSection(section->sh_info);
+
+        auto sectionName = _objFile->getSectionName(sHdr);
         if (!sectionName)
           return error_code(sectionName);
 
-        // Get rid of the leading .rel so Atoms can use their own section
-        // name to find the relocs.
-        *sectionName = sectionName->drop_front(4);
-
         auto ri(_objFile->begin_rel(section));
         auto re(_objFile->end_rel(section));
 





More information about the llvm-commits mailing list