aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/XCOFFObjectFile.cpp
AgeCommit message (Collapse)AuthorFilesLines
2024-09-20[Object][NFC] Add extern template declarations needed by llvm-objdump (#109156)Thomas Fransham1-10/+13
These symbols are implicitly imported from the LLVM shared library by llvm-objdump on ELF like platforms, but for windows they need to be explicitly exported when LLVM is built as shared library. I also add visibility macros for XCOFFObjectFile::getExceptionEntries that can't automatically be added by clang tooling since it doesn't store the source locations for explicit function template instantiations.
2024-07-14[NFC] Fix some typos (#98791)c8ef1-1/+1
2024-06-21[llvm-objdump] enable file-headers option of llvm-objdump for XCOFF object ↵zhijian lin1-3/+5
files (#96104) the patch enable file-headers option of llvm-objdump for XCOFF object files
2024-02-20[XCOFF] Support the subtype flag in DWARF section headers (#81667)stephenpeckham1-0/+6
The section headers for XCOFF files have a subtype flag for Dwarf sections. This PR updates obj2yaml, yaml2obj, and llvm-readobj so that they recognize the subtype.
2023-11-26[XCOFF] make related SD symbols as isFunction (#69553)Chen Zheng1-10/+46
This will help tools like llvm-symbolizer recognizes more functions.
2023-11-15[XCOFF]refactor isFunction, NFC (#72232)Chen Zheng1-14/+10
suggested in review of https://github.com/llvm/llvm-project/pull/69553 This is actually not an NFC as isFunction() does not return false for some "invalid" object, instead it returns the errors to its caller. But since there is no such invalid object in the LIT tests, so no case changes.
2023-10-12[XCOFF][OBJECT] get symbol size by calling XCOFF interfaces (#67304)Chen Zheng1-11/+16
Computing the symbol size as the gap between sorted symbols are not right for XCOFF. For XCOFF, the size info is stored in aux symbol and can be got from existing XCOFF interface `getSymbolSize()`. This patch changes XCOFFObjectFile to call this API to get sizes for symbols.
2023-07-13[PowerPC][MC] Set 'future' as default CPU type of XCOFFQiu Chaofan1-0/+4
For Power on Linux (both LE and BE), ELFObjectFile returns 'future' as default CPU type if mcpu is not specified, so that all necessary features will be enabled in MC. While for XCOFF, the default CPU type is always null, which makes tools like llvm-objdump not able to recognize prefixed instructions, unless specifying --mcpu=pwr10 or --mattr=+prefix-instrs manually. Reviewed By: nemanjai Differential Revision: https://reviews.llvm.org/D155089
2023-07-06[AIX][XCOFF] print out the traceback infozhijian1-6/+14
Summary: Adding a new option -traceback-table to print out the traceback info of xcoff ojbect file. Reviewers: James Henderson, Fangrui Song, Stephen Peckham, Xing Xue Differential Revision: https://reviews.llvm.org/D89049
2023-06-26Move SubtargetFeature.h from MC to TargetParserJob Noorman1-1/+1
SubtargetFeature.h is currently part of MC while it doesn't depend on anything in MC. Since some LLVM components might have the need to work with target features without necessarily needing MC, it might be worthwhile to move SubtargetFeature.h to a different location. This will reduce the dependencies of said components. Note that I choose TargetParser as the destination because that's where Triple lives and SubtargetFeatures feels related to that. This issues came up during a JITLink review (D149522). JITLink would like to avoid a dependency on MC while still needing to store target features. Reviewed By: MaskRay, arsenm Differential Revision: https://reviews.llvm.org/D150549
2023-01-16[llvm-objdump][RISCV] Use new common method to parse ARCH RISCV attributeElena Lepilkina1-1/+1
Differential Revision: https://reviews.llvm.org/D139553
2023-01-05Move from llvm::makeArrayRef to ArrayRef deduction guides - llvm/ partserge-sans-paille1-1/+1
Use deduction guides instead of helper functions. The only non-automatic changes have been: 1. ArrayRef(some_uint8_pointer, 0) needs to be changed into ArrayRef(some_uint8_pointer, (size_t)0) to avoid an ambiguous call with ArrayRef((uint8_t*), (uint8_t*)) 2. CVSymbol sym(makeArrayRef(symStorage)); needed to be rewritten as CVSymbol sym{ArrayRef(symStorage)}; otherwise the compiler is confused and thinks we have a (bad) function prototype. There was a few similar situation across the codebase. 3. ADL doesn't seem to work the same for deduction-guides and functions, so at some point the llvm namespace must be explicitly stated. 4. The "reference mode" of makeArrayRef(ArrayRef<T> &) that acts as no-op is not supported (a constructor cannot achieve that). Per reviewers' comment, some useless makeArrayRef have been removed in the process. This is a follow-up to https://reviews.llvm.org/D140896 that introduced the deduction guides. Differential Revision: https://reviews.llvm.org/D140955
2022-12-09Revert D139098 "[Alignment] Use Align for ObjectFile::getSectionAlignment"Guillaume Chatelet1-2/+3
This breaks lld. This reverts commit 10c47465e2505ddfee4e62a2ab2e535abea3ec56.
2022-12-09[Alignment] Use Align for ObjectFile::getSectionAlignmentGuillaume Chatelet1-3/+2
Differential Revision: https://reviews.llvm.org/D139098
2022-11-21[XCOFF] llvm-readobj support display symbol table of loader section of xcoff ↵zhijian1-0/+28
object file. Reviewers: James Henderson, Esme Yi Differential Revision: https://reviews.llvm.org/D135887
2022-11-19Revert "[XCOFF] llvvm-readobj support display symbol table of loader section ↵Vitaly Buka1-28/+0
of xcoff object file." Use of uninitialized value. This reverts commit 037f5c283a2278ef156189be48db0738323206bd.
2022-11-18[XCOFF] llvvm-readobj support display symbol table of loader section of ↵zhijian1-0/+28
xcoff object file. Reviewers: James Henderson, Esme Yi Differential Revision: https://reviews.llvm.org/D135887
2022-10-15[Object] Fix a warningKazu Hirata1-2/+2
This patch fixes: llvm/lib/Object/XCOFFObjectFile.cpp:1001:20: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
2022-09-21Refactor XCOFFObjectFile::getImportFileTable.zhijian1-38/+2
Summary: 1. Refactor with XCOFFObjectFile::getImportFileTable with function getSectionFileOffsetToRawData instead of getLoaderSectionAddress 2. Delete the function getLoaderSectionAddress. Reviewers: James Henderson,Esme Yi Differential Revision: https://reviews.llvm.org/D134280
2022-09-19fixed a compiler error as description inzhijian1-1/+1
https://lab.llvm.org/buildbot/#/builders/174/builds/13432 XCOFFObjectFile.cpp:805:12: error: reinterpret_cast from 'unsigned long' to 'uintptr_t' (aka 'unsigned int') is not allowed return reinterpret_cast<uintptr_t>(0ul);
2022-09-19fixed a compiler error as description inzhijian1-1/+1
https://lab.llvm.org/buildbot/#/builders/216/builds/9977 XCOFFOtFile.cpp: error C3487: 'unsigned long': all return expressions must deduce to the same type: previously it was 'uintptr_t'
2022-09-19Fix MSVC warning "all return expressions must deduce to the same type"Simon Pilgrim1-1/+1
2022-09-19[AIX] llvm-readobj support a new option --exception-section for xcoff object ↵zhijian1-0/+98
file. Summary: llvm-readobj support a new option --exception-section for xcoff object file. https://www.ibm.com/docs/en/aix/7.2?topic=formats-xcoff-object-file-format#XCOFF__iua3i23ajbau Reviewers: James Henderson,Paul Scoropan Differential Revision: https://reviews.llvm.org/D133030
2022-06-20[llvm] Don't use Optional::getValue (NFC)Kazu Hirata1-2/+2
2022-02-28[llvm-objcopy] Initial XCOFF32 support.esmeyi1-0/+13
Summary: This is an initial implementation of lvm-objcopy for XCOFF32. Currently only supports simple copying, op-passthrough to follow. Reviewed By: jhenderson, shchenz Differential Revision: https://reviews.llvm.org/D97656
2022-02-17Title: Export unique symbol list with llvm-nm new option "--export-symbols"zhijian1-0/+10
Summary: the patch implement of following functionality. 1. export the symbols from archive or object files. 2. sort the export symbols. (based on same symbol name and visibility) 3. delete the duplicate export symbols (based on same symbol name and visibility) 4. print out the unique and sorted export symbols (print the symbol name and visibility). there are two new options are add in the patch 1. --export-symbols (enable the functionality of export unique symbol) 2. --no-rsrc (exclude the symbol name begin with "__rsrc" from be exporting from xcoff object file) Export symbol list for xcoff object file has the same functionality as The patch has the same functionality as https://www.ibm.com/docs/en/xl-c-aix/13.1.0?topic=library-exporting-symbols-createexportlist-utility Reviewers: James Henderson,Fangrui Song Differential Revision: https://reviews.llvm.org/D112735
2022-01-17Reland https://reviews.llvm.org/D113825 after fixing the test expectations.esmeyi1-1/+5
2022-01-12Revert "[llvm-readobj][XCOFF] dump auxiliary symbols."Nico Weber1-5/+1
This reverts commit aad49c8eb9849be57c562f8e2b7fbbe816183343. Breaks tests on Windows, see comments on https://reviews.llvm.org/D113825
2022-01-12[llvm-readobj][XCOFF] dump auxiliary symbols.Esme-Yi1-1/+5
Summary: The patch adds support for dumping auxiliary symbols in llvm-readobj for XCOFF. Reviewed By: jhenderson, Higuoxing Differential Revision: https://reviews.llvm.org/D113825
2021-10-26[AIX][XCOFF] parsing xcoff object file auxiliary headerzhijian1-2/+19
Summary: The patch supports parsing the xcoff object file auxiliary header with llvm-readobj with option "auxiliary-headers" the format of auxiliary header as https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/filesreference/XCOFF.html#XCOFF__fyovh386shar Reviewers: James Henderson, Jason Liu, Hubert Tong, Esme yi, Sean Fertile. Differential Revision: https://reviews.llvm.org/D82549
2021-10-11[Object] Deduplicate the three createError functionsRaphael Isemann1-4/+0
The Object library currently has three identical functions that translate a Twine into a parser error. Until recently these functions have coexisted peacefully, but since D110320 Clang with enabled modules is now diagnosing that we have several definitions of `createError` in Object. This patch just merges them all and puts them into Object's `Error.h` where the error code for `parse_failed` is also defined which seems cleaner and unbreaks the bots. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D111541
2021-10-11[XCOFF] Improve error message context.Esme-Yi1-27/+67
Summary: This patch improves the error message context of the XCOFF interfaces by providing more details. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D110320
2021-10-05Silence an implicit conversion warning on the bit shift result in MSVC; NFCAaron Ballman1-1/+1
2021-10-01[AIX]implement the --syms and using "symbol index and qualname" for --sym ↵zhijian1-4/+117
--symbol--description for llvm-objdump for xcoff Summary: for xcoff : implement the getSymbolFlag and getSymbolType() for option --syms. llvm-objdump --sym , if the symbol is label, print the containing section for the symbol too. when using llvm-objdump --sym --symbol--description, print the symbol index and qualname for symbol. for example: --symbol-description 00000000000000c0 l .text (csect: (idx: 2) .foov[PR]) (idx: 3) .foov and without --symbol-description 00000000000000c0 l .text (csect: .foov) .foov Reviewers: James Henderson,Esme Yi Differential Revision: https://reviews.llvm.org/D109452
2021-09-14[yaml2obj][XCOFF] add the SectionIndex field for symbol.Esme-Yi1-1/+3
Summary: Add the SectionIndex field for symbol. 1: a symbol can reference a section by SectionName or SectionIndex. 2: a symbol can reference a section by both SectionName and SectionIndex. 3: if both Section and SectionIndex are specified, but the two values refer to different sections, an error will be reported. 4: an invalid SectionIndex is allowed. 5: if a symbol references a non-existent section by SectionName, an error will be reported. Reviewed By: jhenderson, Higuoxing Differential Revision: https://reviews.llvm.org/D109566
2021-09-13[XCOFF] Fix the program abortion issue in XCOFFObjectFile::getSectionContents.Esme-Yi1-2/+3
Summary: Use std::move(E) to avoid `Program aborted due to an unhandled Error` Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D109567
2021-08-26[llvm-readobj][XCOFF] Add support for `--needed-libs` option.Esme-Yi1-0/+73
Summary: This patch is trying to add support for llvm-readobj --needed-libs option under XCOFF. For XCOFF, the needed libraries can be found from the Import File ID Name Table of the Loader Section. Currently, I am using binary inputs in the test since yaml2obj does not yet support for writing the Loader Section and the import file table. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D106643
2021-08-19[AIX][XCOFF] 64-bit relocation reading supportMaryam Benimmar1-60/+137
Support XCOFFDumper relocation reading support This patch is part of D103696 partition Reviewed By: daltenty, Helflym Differential Revision: https://reviews.llvm.org/D104646
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