aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/XCOFFObjectFile.cpp
AgeCommit message (Collapse)AuthorFilesLines
2021-08-03[llvm-readobj][XCOFF] Fix the error dumping for the firstEsme-Yi1-1/+4
item of StringTable. Summary: For the string table in XCOFF, the first 4 bytes contains the length of the string table, so we should print the string entries from fifth bytes. This patch also adds tests for llvm-readobj dumping the string table. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D105522
2021-07-05[llvm-readobj][XCOFF] Add support for printing the String Table.Esme-Yi1-0/+4
Summary: The patch adds the StringTable dumping to llvm-readobj. Currently only XCOFF is supported. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D104613
2021-06-14[AIX][XCOFF] emit vector info of traceback table.zhijian1-87/+59
Summary: emit vector info of traceback table. Reviewers: Jason Liu,Hubert Tong Differential Revision: https://reviews.llvm.org/D93659
2021-06-10[XCOFF][llvm-objdump] Dump the debug type in `--section-headers` option.Esme-Yi1-0/+5
Summary: Add XCOFF recognition of debug section types under `--section-headers` option. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D103079
2021-06-10[llvm-objdump][XCOFF] Enable the -l (--line-numbers) option.Esme-Yi1-2/+7
Summary: Add support for dumping line number information for XCOFF object files in llvm-objdump. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D101272
2021-06-07[ELF] getRelocatedSection: remove the check for ET_REL object fileAmir Ayupov1-1/+1
getRelocatedSection interface should not check that the object file is relocatable, as executable files may have relocations preserved with `--emit-relocs` linker flag. The relocations are useful in context of post-link binary analysis for function reference identification. For example, BOLT relies on relocations to perform function reordering. Reviewed By: MaskRay, jhenderson Differential Revision: https://reviews.llvm.org/D102296
2021-06-07[XCOFF][AIX] Enable tooling support for 64 bit symbol table parsingjasonliu1-101/+130
Add in the ability of parsing symbol table for 64 bit object. Reviewed By: jhenderson, DiggerLin Differential Revision: https://reviews.llvm.org/D85774
2021-03-17[XCOFF][llvm-dwarfdump] llvm-dwarfdump support for XCOFFChen Zheng1-3/+18
Author: hubert.reinterpretcast, shchenz Reviewed By: jasonliu, echristo Differential Revision: https://reviews.llvm.org/D97186
2021-01-22[llvm] Use static_assert instead of assert (NFC)Kazu Hirata1-1/+2
Identified with misc-static-assert.
2020-12-22Replace `T(x)` with `reinterpret_cast<T>(x)` everywhere it means ↵Arthur O'Dwyer1-2/+2
reinterpret_cast. NFC. Differential Revision: https://reviews.llvm.org/D76572
2020-12-11[AIX][XCOFF] emit traceback table for function in aixdiggerlin1-23/+0
SUMMARY: 1. added a new option -xcoff-traceback-table to control whether generate traceback table for function. 2. implement the functionality of emit traceback table of a function. Reviewers: hubert.reinterpretcast, Jason Liu Differential Revision: https://reviews.llvm.org/D92398
2020-11-27[AIX][XCOFF][NFC] Change geNumberOfVRSaved function name to getNumberOfVRSaved.diggerlin1-1/+1
SUMMARY: Change geNumberOfVRSaved function name to getNumberOfVRSaved of class TBVectorExt Reviewers: hubert.reinterpretcast, Jason Liu Differential Revision: https://reviews.llvm.org/D92225
2020-11-24[NFC][AIX][XCOFF] change function name from getNumofGPRsSaved to ↵diggerlin1-1/+1
getNumOfGPRsSaved change function name from getNumofGPRsSaved to getNumOfGPRsSaved for class XCOFFTracebackTable Reviewers: Jason Liu Differential Revision: https://reviews.llvm.org/D91882
2020-11-19[AIX][XCOFF][Patch2] decode vector information and extent long table of the ↵diggerlin1-5/+109
traceback table of the xcoff. SUMMARY: 1. decode the Vector extension if has_vec is set 2. decode long table fields, if longtbtable is set. There is conflict on the bit order of HasVectorInfoMask and HasExtensionTableMask between AIX os header and IBM aix compiler XLC. In the /usr/include/sys/debug.h defines static constexpr uint32_t HasVectorInfoMask = 0x0040'0000; static constexpr uint32_t HasExtensionTableMask = 0x0080'0000; but the XLC defines as static constexpr uint32_t HasVectorInfoMask = 0x0080'0000; static constexpr uint32_t HasExtensionTableMask = 0x0040'0000; we follows the definition of the IBM AIX compiler XLC here. Reviewer: Jason Liu Differential Revision: https://reviews.llvm.org/D86461
2020-08-17[AIX][XCOFF][Patch1] Provide decoding trace back table information API for ↵diggerlin1-0/+215
xcoff object file for llvm-objdump -d SUMMARY: 1. This patch provided API for decoding the traceback table info and unit test for the these API. 2. Another patchs will do the following things: 2.1 added a new option --traceback-table to decode the trace back table information for xcoff object file when using llvm-objdump to disassemble the xcoff objfile. 2.2 print out the traceback table information for llvm-objdump. Reviewers: Jason liu, Hubert Tong, James Henderson Differential Revision: https://reviews.llvm.org/D81585
2020-06-08[XCOFF][AIX] report_fatal_error when an overflow section is neededjasonliu1-2/+1
If there are more than 65534 relocation entries in a single section, we should generate an overflow section. Since we don't support overflow section for now, we should generate an error. Differential revision: https://reviews.llvm.org/D81104
2020-06-05Re-land "Migrate Binary::checkOffset from error_code to Error, NFC"Reid Kleckner1-4/+6
This reverts commit 38f3ba591e3a64fa5bbe684b3171c7bda6c5b527. Fix the XCOFF error handling. Unlike std::error_code, Error must be consumed or handled.
2020-06-05Revert "Migrate Binary::checkOffset from error_code to Error, NFC"Nico Weber1-2/+2
This reverts commit 74bd98829d82312676a60c5c2d142e20691b2f13. Breaks LLVM::section-headers.test everywhere, see e.g. http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/29940/steps/test-check-all/logs/FAIL%3A%20LLVM%3A%3Asection-headers.test
2020-06-05Migrate Binary::checkOffset from error_code to Error, NFCReid Kleckner1-2/+2
In my use case, this saved 100ms of time doing one-time-initialization for std::error_code().
2020-05-27ObjectFile.h - reduce unnecessary includes to forward declarations. NFC.Simon Pilgrim1-0/+1
Fix SubtargetFeature.h include dependency in XCOFFObjectFile.cpp
2020-04-18[Object] Change uint32_t getSymbolFlags() to Expected<uint32_t> ↵vgxbj1-1/+1
getSymbolFlags(). This change enables getSymbolFlags() to return errors which benefit error reporting in clients. Differential Revision: https://reviews.llvm.org/D77860
2020-04-06[llvm-objdump][XCOFF] Use symbol index+symbol name + storage mapping class ↵diggerlin1-0/+4
as label for -D SUMMARY: For the llvm-objdump -D, the symbol name is used as a label in the disassembly for the specific address (when a symbol address is equal to the virtual address in the dump). In XCOFF, multiple symbols may have the same name, being differentiated by their storage mapping class. It is helpful to print the QualName and not just the name when forming the output label for a csect symbol. The symbol index further removes any ambiguity caused by duplicate names. To maintain compatibility with the binutils objdump, the XCOFF-specific --symbol-description option is added to enable the enhanced format. Reviewers: hubert.reinterpretcast, James Henderson, Jason Liu ,daltenty Subscribers: wuzish, nemanjai, hiraditya Differential Revision: https://reviews.llvm.org/D72973
2020-03-27[llvm-objdump][XCOFF][AIX] Implement -r optionjasonliu1-25/+68
Summary: Implement several XCOFF hooks to get '-r' option working for llvm-objdump -r. Reviewer: DiggerLin, hubert.reinterpretcast, jhenderson, MaskRay Differential Revision: https://reviews.llvm.org/D75131
2020-02-10Revert "Remove redundant "std::move"s in return statements"Bill Wendling1-10/+10
The build failed with error: call to deleted constructor of 'llvm::Error' errors. This reverts commit 1c2241a7936bf85aa68aef94bd40c3ba77d8ddf2.
2020-02-10Remove redundant "std::move"s in return statementsBill Wendling1-10/+10
2020-01-30[XCOFF][AIX] Support basic relocation type on AIXjasonliu1-0/+1
Summary: This patch intends to support three most common relocation type on AIX: R_POS, R_TOC, R_RBR. These three relocation type will be needed for object file generation on AIX for small code model. We will have follow up patches to bring relocation support for large code model on AIX. Reviewers: hubert.reinterpretcast, daltenty, DiggerLin Differential Revision: https://reviews.llvm.org/D72027
2019-11-19The patch is the compiler error specific on the compile error on CMVCdiggerlin1-3/+5
SUMMARY: CMVC has a compiler error on the const uint64_t OffsetToRaw = is64Bit() ? toSection64(Sec)->FileOffsetToRawData : toSection32(Sec)->FileOffsetToRawData; while gcc compiler do not have the problem. I have to change the code to uint64_t OffsetToRaw; if (is64Bit()) OffsetToRaw = toSection64(Sec)->FileOffsetToRawData; else OffsetToRaw = toSection32(Sec)->FileOffsetToRawData; Reviewers: Sean Fertile Subscribers: rupprecht, seiyai,hiraditya Differential Revision: https://reviews.llvm.org/D70255
2019-11-19implement printing out raw section data of xcoff objectfile for llvm-objdumpdiggerlin1-8/+17
SUMMARY: implement printing out raw section data of xcoff objectfile for llvm-objdump and option -D --disassemble-all option for llvm-objdump Reviewers: Sean Fertile Subscribers: rupprecht, seiyai,hiraditya Differential Revision: https://reviews.llvm.org/D70255
2019-11-18Revert "implement printing out raw section data of xcoff objectfile for ↵Leonard Chan1-17/+8
llvm-objdump" This reverts commit 8f8a9f3437d4517f674395da30edb59d5514f7bc. Reverting since this patch seems to break a lot of llvm buildbots.
2019-11-18implement printing out raw section data of xcoff objectfile for llvm-objdumpdiggerlin1-8/+17
SUMMARY: implement printing out raw section data of xcoff objectfile for llvm-objdump and option -D --disassemble-all option for llvm-objdump Reviewers: Sean Fertile Subscribers: rupprecht, seiyai,hiraditya Differential Revision: https://reviews.llvm.org/D70255
2019-11-07Revert "[XCOFF] Fix link errors from explicit template instantiation"Reid Kleckner1-4/+0
This reverts commit c989993ba1a666f04f7aee7df51d9f4de0588b71. maskray already fixed the explicit instantiation definition in the .cpp file, and these extern template declarations seem to be causing warnings that I don't understand.
2019-11-07[XCOFF] Fix link errors from explicit template instantiationReid Kleckner1-0/+4
I happen to be using clang-cl+lld-link locally, and I get these link errors: lld-link: error: undefined symbol: public: unsigned short __cdecl llvm::object::XCOFFSectionHeader<struct llvm::object::XCOFFSectionHeader64>::getSectionType(void) const >>> referenced by C:\src\llvm-project\llvm\tools\llvm-readobj\XCOFFDumper.cpp:106 >>> tools\llvm-readobj\CMakeFiles\llvm-readobj.dir\XCOFFDumper.cpp.obj:(public: virtual void __cdecl `anonymous namespace'::XCOFFDumper::printSectionHeaders(void)) I suspect this is because the explicit template instaniation appears before the inline method definitions in the .cpp file, so they aren't available at the point of instantiation. Move the explicit instantiation later. Also, forward declare the explicit instantiation for good measure.
2019-11-07[XCOFF] Move explicit instantions after member function definitions to fix ↵Fangrui Song1-4/+4
clang builds
2019-11-07Using crtp to refactor the xcoff section headerdiggerlin1-8/+19
SUMMARY: According to https://reviews.llvm.org/D68575#inline-617586, Create a NFC patch for it. Using crtp to refactor the xcoff section header Move the define of SectionFlagsReservedMask and SectionFlagsTypeMask from XCOFFDumper.cpp to XCOFFObjectFile.h Reviewers: hubert.reinterpretcast,jasonliu Subscribers: rupprecht, seiyai,hiraditya Differential Revision: https://reviews.llvm.org/D69131
2019-10-15[XCOFF]implement parsing relocation information for 32-bit xcoff object fileDigger Lin1-4/+68
Summary: Parsing the relocation entry information for 32-bit xcoff object file including deal with the relocation overflow. Reviewers: hubert.reinterpretcast, jasonliu, sfertile, xingxue. Subscribers: hiraditya, rupprecht, seiya Differential Revision: https://reviews.llvm.org/D67008 llvm-svn: 374946
2019-10-15revert git test commitDigger Lin1-1/+1
llvm-svn: 374898
2019-10-15a test commit accessDigger Lin1-1/+1
llvm-svn: 374897
2019-08-27[XCOFF][AIX] Generate symbol table entries with llvm-readobjJason Liu1-20/+143
Summary: This patch implements main entry and auxiliary entries of symbol table generation for llvm-readobj on AIX. The source code of aix_xcoff_xlc_test8.o (compile with xlc) is: -bash-4.2$ cat test8.c extern int i; extern int TestforXcoff; extern int fun(int i); static int static_i; char* p="abcd"; int fun1(int j) { static_i++; j++; j=j+*p; return j; } int main() { i++; fun(i); return fun1(i); } Patch provided by DiggerLin Differential Revision: https://reviews.llvm.org/D65240 llvm-svn: 370097
2019-08-15[llvm] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere1-1/+1
Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. llvm-svn: 369013
2019-08-12[XCOFF] Use a single symbolic constant for the size of an embeded name. [NFC]Sean Fertile1-9/+9
Convert SymbolNameSize and SectionNameSize into just `NameSize`. The length of a name embeded in a symbol table entry or section header table entry is length 8 for Sections, Symbols and Files. No need to have a distinct constant for each one. Also removes the Size argument to 'generateStringRef' as the size is always 'XCOFF::NameSize'. llvm-svn: 368584
2019-07-22[Object][XCOFF] Remove extra includes from XCOFF related files. [NFC]Sean Fertile1-5/+0
Differential Revision: https://reviews.llvm.org/D60885 llvm-svn: 366723
2019-07-09Try to appease the Windows build bots.Sean Fertile1-4/+12
Several of the conditonal operators commited in llvm-svn: 365524 fail to compile on the windows buildbots. Converting to an if and early return to try to fix. llvm-svn: 365535
2019-07-09[Object][XCOFF] Add support for 64-bit file header and section header dumping.Sean Fertile1-149/+253
Adds a readobj dumper for 32-bit and 64-bit section header tables, and extend support for the file-header dumping to include 64-bit object files. Also refactors the binary file parsing to be done in a helper function in an attempt to cleanup error handeling. Differential Revision: https://reviews.llvm.org/D63843 llvm-svn: 365524
2019-05-28[XCOFF] Implement parsing symbol table for xcoffobjfile and output as yaml ↵Jason Liu1-39/+163
format Summary: This patch implement parsing symbol table for xcoffobjfile and output as yaml format. Parsing auxiliary entries of a symbol will be in a separate patch. The XCOFF object file (aix_xcoff.o) used in the test comes from -bash-4.2$ cat test.c extern int i; extern int TestforXcoff; int main() { i++; TestforXcoff--; } Patch by DiggerLin Reviewers: sfertile, hubert.reinterpretcast, MaskRay, daltenty Differential Revision: https://reviews.llvm.org/D61532 llvm-svn: 361832
2019-05-14[Object] Change ObjectFile::getSectionContents to return ↵Fangrui Song1-3/+2
Expected<ArrayRef<uint8_t>> Change std::error_code getSectionContents(DataRefImpl, StringRef &) const; to Expected<ArrayRef<uint8_t>> getSectionContents(DataRefImpl) const; Many object formats use ArrayRef<uint8_t> as the underlying type, which is generally better than StringRef to represent binary data, so change the type to decrease the number of type conversions. Reviewed By: ruiu, sbc100 Differential Revision: https://reviews.llvm.org/D61781 llvm-svn: 360648
2019-05-03[Object][XCOFF] Add an XCOFF dumper for llvm-readobj.Sean Fertile1-7/+34
Patch adds support for dumping of file headers with llvm-readobj. XCOFF object files are added to test dumping a well formed file, and dumping both negative timestamps and negative symbol counts, both of which are allowed in the XCOFF definition. Differential Revision: https://reviews.llvm.org/D60878 llvm-svn: 359878
2019-05-02[Object] Change getSectionName() to return Expected<StringRef>Fangrui Song1-5/+3
Summary: It currently receives an output parameter and returns std::error_code. Expected<StringRef> fits for this purpose perfectly. Differential Revision: https://reviews.llvm.org/D61421 llvm-svn: 359774
2019-04-25[Object][XCOFF] Add intial support for section header table.Sean Fertile1-29/+83
Adds a representation of the section header table to XCOFFObjectFile, and implements enough to dump the section headers with llvm-obdump. Differential Revision: https://reviews.llvm.org/D60784 llvm-svn: 359244
2019-04-04[XCOFF] Add functionality for parsing AIX XCOFF object file headersHubert Tong1-0/+270
Summary: 1. Add functionality for parsing AIX XCOFF object files headers. 2. Only support 32-bit AIX XCOFF object files in this patch. 3. Print out the AIX XCOFF object file header in YAML format. Reviewers: sfertile, hubert.reinterpretcast, jasonliu, mstorsjo, zturner, rnk Reviewed By: sfertile, hubert.reinterpretcast Subscribers: jsji, mgorny, hiraditya, jdoerfert, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59419 Patch by Digger Lin llvm-svn: 357663