Revision tags: llvmorg-3.8.0, llvmorg-3.8.0-rc3, llvmorg-3.8.0-rc2, llvmorg-3.8.0-rc1, llvmorg-3.7.1, llvmorg-3.7.1-rc2, llvmorg-3.7.1-rc1, llvmorg-3.7.0, llvmorg-3.7.0-rc4, llvmorg-3.7.0-rc3, studio-1.4 |
|
#
8bab889b |
| 07-Aug-2015 |
Rafael Espindola <rafael.espindola@gmail.com> |
Convert getSymbolSection to return an ErrorOr.
This function can actually fail since the symbol contains an index to the section and that can be invalid.
llvm-svn: 244375
|
Revision tags: llvmorg-3.7.0-rc2, llvmorg-3.7.0-rc1 |
|
#
76ad2321 |
| 06-Jul-2015 |
Rafael Espindola <rafael.espindola@gmail.com> |
Remove getRelocationAddress.
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
Remove getRelocationAddress.
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
show more ...
|
#
ed067c45 |
| 03-Jul-2015 |
Rafael Espindola <rafael.espindola@gmail.com> |
Return ErrorOr from getSymbolAddress.
It can fail trying to get the section on ELF and COFF. This makes sure the error is handled.
llvm-svn: 241366
|
#
5d0c2ffa |
| 02-Jul-2015 |
Rafael Espindola <rafael.espindola@gmail.com> |
Return ErrorOr from SymbolRef::getName.
This function can really fail since the string table offset can be out of bounds.
Using ErrorOr makes sure the error is checked.
Hopefully a lot of the boil
Return ErrorOr from SymbolRef::getName.
This function can really fail since the string table offset can be out of bounds.
Using ErrorOr makes sure the error is checked.
Hopefully a lot of the boilerplate code in tools/* can go away once we have a diagnostic manager in Object.
llvm-svn: 241297
show more ...
|
#
10fcac7b |
| 30-Jun-2015 |
Rafael Espindola <rafael.espindola@gmail.com> |
Use ErrorOr in getRelocationAdress.
We can probably do better in this method, but this is an improvement and enables further ErrorOr cleanups.
llvm-svn: 241114
|
#
41bb4325 |
| 30-Jun-2015 |
Rafael Espindola <rafael.espindola@gmail.com> |
Don't return error_code from a function that doesn't fail.
llvm-svn: 241042
|
#
99c041b7 |
| 30-Jun-2015 |
Rafael Espindola <rafael.espindola@gmail.com> |
Don't return error_code from a function that doesn't fail.
llvm-svn: 241033
|
#
96d071cd |
| 29-Jun-2015 |
Rafael Espindola <rafael.espindola@gmail.com> |
Don't return error_code from function that never fails.
llvm-svn: 241021
|
Revision tags: llvmorg-3.6.2 |
|
#
d7a32ea4 |
| 24-Jun-2015 |
Rafael Espindola <rafael.espindola@gmail.com> |
Change how symbol sizes are handled in lib/Object.
COFF and MachO only define symbol sizes for common symbols. Reflect that in the class hierarchy by having a method for common symbols only in the b
Change how symbol sizes are handled in lib/Object.
COFF and MachO only define symbol sizes for common symbols. Reflect that in the class hierarchy by having a method for common symbols only in the base and a general one in ELF.
This avoids the need of using a magic value for the size, which had a few problems * Most callers didn't check for it. * The ones that did could not tell the magic value from a file actually having that value.
llvm-svn: 240529
show more ...
|
Revision tags: llvmorg-3.6.2-rc1 |
|
#
37070a5a |
| 03-Jun-2015 |
Rafael Espindola <rafael.espindola@gmail.com> |
Move to llvm-objdump a large amount of code to that is only used there.
llvm-svn: 238898
|
#
5eb02e45 |
| 01-Jun-2015 |
Rafael Espindola <rafael.espindola@gmail.com> |
Simplify another function that doesn't fail.
llvm-svn: 238703
|
Revision tags: llvmorg-3.6.1, llvmorg-3.6.1-rc1, llvmorg-3.5.2, llvmorg-3.5.2-rc1, llvmorg-3.6.0, llvmorg-3.6.0-rc4, llvmorg-3.6.0-rc3, llvmorg-3.6.0-rc2, llvmorg-3.6.0-rc1, llvmorg-3.5.1, llvmorg-3.5.1-rc2, llvmorg-3.5.1-rc1 |
|
#
80291274 |
| 08-Oct-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
Remove bogus std::error_code returns form SectionRef.
There are two methods in SectionRef that can fail:
* getName: The index into the string table can be invalid. * getContents: The section might
Remove bogus std::error_code returns form SectionRef.
There are two methods in SectionRef that can fail:
* getName: The index into the string table can be invalid. * getContents: The section might point to invalid contents.
Every other method will always succeed and returning and std::error_code just complicates the code. For example, a section can have an invalid alignment, but if we are able to get to the section structure at all and create a SectionRef, we will always be able to read that invalid alignment.
llvm-svn: 219314
show more ...
|
#
5a121b2e |
| 05-Sep-2014 |
Bjorn Steinbrink <bsteinbr@gmail.com> |
Restore the ability to check if LLVMCreateObjectFile was successful
Summary: Until r216870 LLVMCreateObjectFile returned nullptr in case of an error, so callers could check if the call was successfu
Restore the ability to check if LLVMCreateObjectFile was successful
Summary: Until r216870 LLVMCreateObjectFile returned nullptr in case of an error, so callers could check if the call was successful. Now, it always returns an OwningBinary wrapped as an LLVMObjectFileRef, so callers can't check if the call was successul.
This results in a segfault running e.g.
llvm-c-test --object-list-sections < /dev/null
So the old behaviour should be restored.
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D5143
llvm-svn: 217279
show more ...
|
Revision tags: llvmorg-3.5.0, llvmorg-3.5.0-rc4, llvmorg-3.5.0-rc3 |
|
#
48af1c2a |
| 19-Aug-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
Don't own the buffer in object::Binary.
Owning the buffer is somewhat inflexible. Some Binaries have sub Binaries (like Archive) and we had to create dummy buffers just to handle that. It is also a
Don't own the buffer in object::Binary.
Owning the buffer is somewhat inflexible. Some Binaries have sub Binaries (like Archive) and we had to create dummy buffers just to handle that. It is also a bad fit for IRObjectFile where the Module wants to own the buffer too.
Keeping this ownership would make supporting IR inside native objects particularly painful.
This patch focuses in lib/Object. If something elsewhere used to own an Binary, now it also owns a MemoryBuffer.
This patch introduces a few new types.
* MemoryBufferRef. This is just a pair of StringRefs for the data and name. This is to MemoryBuffer as StringRef is to std::string. * OwningBinary. A combination of Binary and a MemoryBuffer. This is needed for convenience functions that take a filename and return both the buffer and the Binary using that buffer.
The C api now uses OwningBinary to avoid any change in semantics. I will start a new thread to see if we want to change it and how.
llvm-svn: 216002
show more ...
|
Revision tags: llvmorg-3.5.0-rc2 |
|
#
437b0d58 |
| 31-Jul-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
Use std::unique_ptr to make the ownership explicit.
llvm-svn: 214377
|
Revision tags: llvmorg-3.5.0-rc1 |
|
#
6304e941 |
| 23-Jun-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
Pass a std::unique_ptr& to the create??? methods is lib/Object.
This makes the buffer ownership on error conditions very natural. The buffer is only moved out of the argument if an object is constru
Pass a std::unique_ptr& to the create??? methods is lib/Object.
This makes the buffer ownership on error conditions very natural. The buffer is only moved out of the argument if an object is constructed that now owns the buffer.
llvm-svn: 211546
show more ...
|
#
db4ed0bd |
| 13-Jun-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
Remove 'using std::errro_code' from lib.
llvm-svn: 210871
|
#
3acea398 |
| 12-Jun-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
Don't use 'using std::error_code' in include/llvm.
This should make sure that most new uses use the std prefix.
llvm-svn: 210835
|
Revision tags: llvmorg-3.4.2, llvmorg-3.4.2-rc1, llvmorg-3.4.1, llvmorg-3.4.1-rc2 |
|
#
6956b1a5 |
| 21-Apr-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
Convert getFileOffset to getOffset and move it to its only user.
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 fa
Convert getFileOffset to getOffset and move it to its only user.
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
show more ...
|
#
2617dcce |
| 15-Apr-2014 |
Craig Topper <craig.topper@gmail.com> |
[C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr.
llvm-svn: 206252
|
Revision tags: llvmorg-3.4.1-rc1 |
|
#
b5155a57 |
| 10-Feb-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
Change the begin and end methods in ObjectFile to match the style guide.
llvm-svn: 201108
|
#
5e812afa |
| 30-Jan-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
Simplify the handling of iterators in ObjectFile.
None of the object file formats reported error on iterator increment. In retrospect, that is not too surprising: no object format stores symbols or
Simplify the handling of iterators in ObjectFile.
None of the object file formats reported error on iterator increment. In retrospect, that is not too surprising: no object format stores symbols or sections in a linked list or other structure that requires chasing pointers. As a consequence, all error checking can be done on begin() and end().
This reduces the text segment of bin/llvm-readobj in my machine from 521233 to 518526 bytes.
llvm-svn: 200442
show more ...
|
#
51cc3602 |
| 22-Jan-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
Change createObjectFile to return an ErrorOr.
llvm-svn: 199776
|
#
8a8cd2ba |
| 07-Jan-2014 |
Chandler Carruth <chandlerc@gmail.com> |
Re-sort all of the includes with ./utils/sort_includes.py so that subsequent changes are easier to review. About to fix some layering issues, and wanted to separate out the necessary churn.
Also com
Re-sort all of the includes with ./utils/sort_includes.py so that subsequent changes are easier to review. About to fix some layering issues, and wanted to separate out the necessary churn.
Also comment and sink the include of "Windows.h" in three .inc files to match the usage in Memory.inc.
llvm-svn: 198685
show more ...
|
Revision tags: llvmorg-3.4.0, llvmorg-3.4.0-rc3, llvmorg-3.4.0-rc2, llvmorg-3.4.0-rc1, llvmorg-3.3.1-rc1, llvmorg-3.3.0 |
|
#
806f0064 |
| 05-Jun-2013 |
Rafael Espindola <rafael.espindola@gmail.com> |
Handle relocations that don't point to symbols.
In ELF (as in MachO), not all relocations point to symbols. Represent this properly by using a symbol_iterator instead of a SymbolRef. Update llvm-rea
Handle relocations that don't point to symbols.
In ELF (as in MachO), not all relocations point to symbols. Represent this properly by using a symbol_iterator instead of a SymbolRef. Update llvm-readobj ELF's dumper to handle relocatios without symbols.
llvm-svn: 183284
show more ...
|