COFF: Implement sectionContainsSymbol for relocatable files only.
authorMichael J. Spencer <bigcheesegs@gmail.com>
Thu, 13 Oct 2011 20:36:54 +0000 (20:36 +0000)
committerMichael J. Spencer <bigcheesegs@gmail.com>
Thu, 13 Oct 2011 20:36:54 +0000 (20:36 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141884 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Object/COFFObjectFile.cpp

index e84eb914fc749a20588f90bf7c55d5d0787ac3b0..750c34d12a1850a70935127df8cc257b4fbc2850 100644 (file)
@@ -369,8 +369,14 @@ error_code COFFObjectFile::isSectionBSS(DataRefImpl Sec,
 error_code COFFObjectFile::sectionContainsSymbol(DataRefImpl Sec,
                                                  DataRefImpl Symb,
                                                  bool &Result) const {
-  // FIXME: Unimplemented.
-  Result = false;
+  const coff_section *sec = toSec(Sec);
+  const coff_symbol *symb = toSymb(Symb);
+  const coff_section *symb_sec;
+  if (error_code ec = getSection(symb->SectionNumber, symb_sec)) return ec;
+  if (symb_sec == sec)
+    Result = true;
+  else
+    Result = false;
   return object_error::success;
 }