summaryrefslogtreecommitdiffstats
path: root/llvm/include/llvm-c/Object.h
Commit message (Collapse)AuthorAgeFilesLines
* Wrap C APIs with pragmas enforcing -Werror=strict-prototypesDuncan P. N. Exon Smith2019-11-191-6/+3
| | | | | | | | | Force `-Werror=strict-prototypes` so that C API tests fail to compile if we add a non-prototype declaration. This should help avoid regressions like bddecba4b333f7772029b4937d2c34f9f2fda6ca was fixing. https://reviews.llvm.org/D70285 rdar://problem/57203137
* [LLVM-C] Add Accessor for Mach-O Universal Binary SlicesRobert Widmann2019-05-251-0/+16
| | | | | | | | | | | | | | | | Summary: Allow for retrieving an object file corresponding to an architecture-specific slice in a Mach-O universal binary file. Reviewers: whitequark, deadalnix Reviewed By: whitequark Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60378 llvm-svn: 361705
* Fix a typoAlexander Kornienko2019-04-101-2/+2
| | | | llvm-svn: 358092
* [LLVM-C] Add Section and Symbol Iterator Accessors for Object File BinariesRobert Widmann2019-04-091-11/+63
| | | | | | | | | | | | | | | | Summary: This brings us to full feature parity with the old API, so I've deprecated it and updated the tests. I'll do a follow-up patch to do some more cleanup and documentation work in this header. Reviewers: whitequark, deadalnix Reviewed By: whitequark Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60407 llvm-svn: 358037
* [LLVM-C] Allow Access to the Type of a BinaryRobert Widmann2019-04-071-0/+26
| | | | | | | | | | | | | | | | Summary: Add an accessor for the type of a binary file. Reviewers: whitequark, deadalnix Reviewed By: whitequark Subscribers: hiraditya, aheejin, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60366 llvm-svn: 357872
* [LLVM-C] Begin to Expose A More General Binary InterfaceRobert Widmann2019-04-051-0/+39
| | | | | | | | | | | | | | | | | | | | | Summary: Provides a new type, `LLVMBinaryRef`, and a binding to `llvm::object::createBinary` for more general interoperation with binary files than `LLVMObjectFileRef`. It also provides the proper non-consuming API for input buffers and populates an out parameter for error handling if necessary - two things the previous API did not do. In a follow-up, I'll define section and symbol iterators and begin to build upon the existing test infrastructure. This patch is a first step towards deprecating that API and replacing it with something more robust. Reviewers: deadalnix, whitequark Reviewed By: whitequark Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60322 llvm-svn: 357822
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+4
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Reorganize the C API headers to improve build times.Eric Christopher2015-12-181-1/+1
| | | | | | | | | Type specific declarations have been moved to Type.h and error handling routines have been moved to ErrorHandling.h. Both are included in Core.h so nothing should change for projects directly including the headers, but transitive dependencies may be affected. llvm-svn: 255965
* Remove getRelocationAddress.Rafael Espindola2015-07-061-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Originally added in r139314. Back then it didn't actually get the address, it got whatever value the relocation used: address or offset. The values in different object formats are: * MachO: Always an offset. * COFF: Always an address, but when talking about the virtual address of sections it says: "for simplicity, compilers should set this to zero". * ELF: An offset for .o files and and address for .so files. In the case of the .so, the relocation in not linked to any section (sh_info is 0). We can't really compute an offset. Some API mappings would be: * Use getAddress for everything. It would be quite cumbersome. To compute the address elf has to follow sh_info, which can be corrupted and therefore the method has to return an ErrorOr. The address of the section is also the same for every relocation in a section, so we shouldn't have to check the error and fetch the value for every relocation. * Use a getValue and make it up to the user to know what it is getting. * Use a getOffset and: * Assert for dynamic ELF objects. That is a very peculiar case and it is probably fair to ask any tool that wants to support it to use ELF.h. The only tool we have that reads those (llvm-readobj) already does that. The only other use case I can think of is a dynamic linker. * Check that COFF .obj files have sections with zero virtual address spaces. If it turns out that some assembler/compiler produces these, we can change COFFObjectFile::getRelocationOffset to subtract it. Given COFF format, this can be done without the need for ErrorOr. The getRelocationAddress method was never implemented for COFF. It also had exactly one use in a very peculiar case: a shortcut for adding the section value to a pcrel reloc on MachO. Given that, I don't expect that there is any use out there of the C API. If that is not the case, let me know and I will add it back with the implementation inlined and do a proper deprecation. llvm-svn: 241450
* Convert getFileOffset to getOffset and move it to its only user.Rafael Espindola2014-04-211-1/+0
| | | | | | | | | | | | | We normally don't drop functions from the C API's, but in this case I think we can: * The old implementation of getFileOffset was fairly broken * The introduction of LLVMGetSymbolFileOffset was itself a C api breaking change as it removed LLVMGetSymbolOffset. * It is an incredibly specialized use case. The only reason MCJIT needs it is because of its odd position of being a dynamic linker of .o files. llvm-svn: 206750
* include/llvm-c: Whitespace.NAKAMURA Takumi2013-10-231-1/+0
| | | | llvm-svn: 193253
* Move C++ code out of the C headers and into either C++ headersEric Christopher2013-04-221-46/+0
| | | | | | | or the C++ files themselves. This enables people to use just a C compiler to interoperate with LLVM. llvm-svn: 180063
* Revert r178713Evan Cheng2013-04-041-6/+2
| | | | llvm-svn: 178769
* Make it possible to include llvm-c without including C++ headers. Patch by ↵Evan Cheng2013-04-031-2/+6
| | | | | | Filip Pizlo. llvm-svn: 178713
* Organize LLVM C API docs into doxygen modules; add docsGregory Szorc2012-03-211-0/+10
| | | | | | | | | | | | | | | | This gives a lot of love to the docs for the C API. Like Clang's documentation, the C API is now organized into a Doxygen "module" (LLVMC). Each C header file is a child of the main module. Some modules (like Core) have a hierarchy of there own. The produced documentation is thus better organized (before everything was in one monolithic list). This patch also includes a lot of new documentation for APIs in Core.h. It doesn't document them all, but is better than none. Function docs are missing @param and @return annotation, but the documentation body now commonly provides help details (like the expected llvm::Value sub-type to expect). llvm-svn: 153157
* Fixed ObjectFile functions:Danil Malyshev2011-11-291-1/+2
| | | | | | | | | | | - getSymbolOffset() renamed as getSymbolFileOffset() - getSymbolFileOffset(), getSymbolAddress(), getRelocationAddress() returns same result for ELFObjectFile, MachOObjectFile and COFFObjectFile. - added getRelocationOffset() - fixed MachOObjectFile::getSymbolSize() - fixed MachOObjectFile::getSymbolSection() - fixed MachOObjectFile::getSymbolOffset() for symbols without section data. llvm-svn: 145408
* Revert r145180 as it is causing test failures on all the bots.Chandler Carruth2011-11-271-2/+1
| | | | | | | | | | | | | Original commit message: Fixed ObjectFile functions: - getSymbolOffset() renamed as getSymbolFileOffset() - getSymbolFileOffset(), getSymbolAddress(), getRelocationAddress() returns same result for ELFObjectFile, MachOObjectFile and COFFObjectFile. - added getRelocationOffset() - fixed MachOObjectFile::getSymbolSize() - fixed MachOObjectFile::getSymbolSection() - fixed MachOObjectFile::getSymbolOffset() for symbols without section data. llvm-svn: 145182
* Fixed ObjectFile functions:Danil Malyshev2011-11-271-1/+2
| | | | | | | | | | | - getSymbolOffset() renamed as getSymbolFileOffset() - getSymbolFileOffset(), getSymbolAddress(), getRelocationAddress() returns same result for ELFObjectFile, MachOObjectFile and COFFObjectFile. - added getRelocationOffset() - fixed MachOObjectFile::getSymbolSize() - fixed MachOObjectFile::getSymbolSection() - fixed MachOObjectFile::getSymbolOffset() for symbols without section data. llvm-svn: 145180
* Expose relocation accessors through the libObject C API.Owen Anderson2011-10-271-0/+10
| | | | llvm-svn: 143109
* Add relocation iterators to the libObject C API.Owen Anderson2011-10-271-0/+20
| | | | llvm-svn: 143107
* Use LLVMBool for a function that logically returns a boolean value.Owen Anderson2011-10-211-1/+1
| | | | llvm-svn: 142683
* Fix typo.Owen Anderson2011-10-211-1/+1
| | | | llvm-svn: 142681
* Bind libObject API for obtaining the section containing a Symbol.Owen Anderson2011-10-211-0/+2
| | | | llvm-svn: 142667
* Expand the coverage of the libObject C bindings to include more SectionRef ↵Owen Anderson2011-10-211-2/+31
| | | | | | accessors as well as Symbol iterators. llvm-svn: 142661
* Change relocation API to be per section. This time without breaking GCC.Michael J. Spencer2011-10-071-4/+4
| | | | llvm-svn: 141385
* Revert 141376 and 141377 due to breaking the build.Bill Wendling2011-10-071-4/+4
| | | | | | | | | | | | | | | | --- Reverse-merging r141377 into '.': U tools/llvm-objdump/MachODump.cpp --- Reverse-merging r141376 into '.': U include/llvm/Object/COFF.h U include/llvm/Object/ObjectFile.h U include/llvm-c/Object.h U tools/llvm-objdump/llvm-objdump.cpp U lib/Object/MachOObjectFile.cpp U lib/Object/COFFObjectFile.cpp U lib/Object/Object.cpp U lib/Object/ELFObjectFile.cpp llvm-svn: 141379
* Change relocation API to be per section.Michael J. Spencer2011-10-071-4/+4
| | | | llvm-svn: 141376
* Add a set of C bindings for the Object interface.Eric Christopher2011-04-031-0/+77
Patch by Patrick Walton! llvm-svn: 128798
OpenPOWER on IntegriCloud