llvm.org GIT mirror llvm / 19d7322
Implement sectionContainsSymbol for ELF. Patch by Nico Rieck! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178677 91177308-0d34-0410-b5e6-96231b3b80d8 Eric Christopher 7 years ago
2 changed file(s) with 13 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
13771377 error_code ELFObjectFile::sectionContainsSymbol(DataRefImpl Sec,
13781378 DataRefImpl Symb,
13791379 bool &Result) const {
1380 // FIXME: Unimplemented.
1381 Result = false;
1380 validateSymbol(Symb);
1381
1382 const Elf_Shdr *sec = reinterpret_cast(Sec.p);
1383 const Elf_Sym *symb = getSymbol(Symb);
1384
1385 unsigned shndx = symb->st_shndx;
1386 bool Reserved = shndx >= ELF::SHN_LORESERVE
1387 && shndx <= ELF::SHN_HIRESERVE;
1388
1389 Result = !Reserved && (sec == getSection(symb->st_shndx));
13821390 return object_error::success;
13831391 }
13841392
11 RUN: | FileCheck %s
22
33 CHECK: Disassembly of section .text:
4 CHECK: .text:
4 CHECK: dext:
55 CHECK: 0: 08 00 e0 03 jr $ra
66 CHECK: 4: 43 49 82 7c dext $2, $4, 5, 10
7 CHECK: dextu:
78 CHECK: 8: 08 00 e0 03 jr $ra
89 CHECK: c: 83 28 82 7c dext $2, $4, 2, 6
10 CHECK: dextm:
911 CHECK: 10: 08 00 e0 03 jr $ra
1012 CHECK: 14: 43 09 82 7c dext $2, $4, 5, 2