| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It is not useful to return the data beyond VirtualSize it's less than
SizeOfRawData.
An implementation detail of COFF requires the section size to be rounded
up to a multiple of FileAlignment; this means that SizeOfRawData is not
representative of how large the section is. Instead, we should cap it
to VirtualSize when this occurs as it represents the true size of the
section.
Note that this is only relevant in executable files because this
rounding doesn't occur in object files (and VirtualSize is always zero).
llvm-svn: 219388
|
|
|
|
| |
llvm-svn: 219383
|
|
|
|
| |
llvm-svn: 219324
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
It can only return null if passed a corrupted reference with a null Ref.p.
Checking for null is then an issue for asserts to check for internal
consistency, not control flow to check for invalid input.
I didn't add an assert(sec != nullptr) because toSec itself has a far more
complete assert.
llvm-svn: 219235
|
|
|
|
|
|
|
|
|
| |
There is no need to compute the coff_section of the symbol just to compare the
pointer.
Inspired by the ELF implementation.
llvm-svn: 219233
|
|
|
|
| |
llvm-svn: 218996
|
|
|
|
|
|
|
|
|
| |
This patch adds another iterator to access the delay-load import table
and use it from llvm-readobj.
http://reviews.llvm.org/D5594
llvm-svn: 218933
|
|
|
|
|
|
|
|
| |
This patch defines a new iterator for the imported symbols.
Make a change to COFFDumper to use that iterator to print
out imported symbols and its ordinals.
llvm-svn: 218915
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When the flag is given, the command prints out the COFF import table.
Currently only the import table directory will be printed.
I'm going to make another patch to print out the imported symbols.
The implementation of import directory entry iterator in
COFFObjectFile.cpp was buggy. This patch fixes that too.
http://reviews.llvm.org/D5569
llvm-svn: 218891
|
|
|
|
|
|
|
|
|
|
|
|
| |
Users of getSectionContents shouldn't try to pass in BSS or virtual
sections. In all instances, this is a bug in the code calling this
routine.
N.B. Some COFF implementations (like CL) will mark their BSS sections as
taking space on disk. This would confuse COFFObjectFile into thinking
the section is larger than the file.
llvm-svn: 218549
|
|
|
|
|
|
|
| |
The byte has no endianness, so these types don't make sense.
uint8_t should be used instead.
llvm-svn: 217631
|
|
|
|
| |
llvm-svn: 217499
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds support for reading the "bigobj" variant of COFF produced by
cl's /bigobj and mingw's -mbig-obj.
The most significant difference that bigobj brings is more than 2**16
sections to COFF.
bigobj brings a few interesting differences with it:
- It doesn't have a Characteristics field in the file header.
- It doesn't have a SizeOfOptionalHeader field in the file header (it's
only used in executable files).
- Auxiliary symbol records have the same width as a symbol table entry.
Since symbol table entries are bigger, so are auxiliary symbol
records.
Write support will come soon.
Differential Revision: http://reviews.llvm.org/D5259
llvm-svn: 217496
|
|
|
|
|
|
| |
just letting them be implicitly created.
llvm-svn: 216525
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
This matches the behavior of GNU objdump.
llvm-svn: 215844
|
|
|
|
| |
llvm-svn: 215224
|
|
|
|
| |
llvm-svn: 215219
|
|
|
|
| |
llvm-svn: 214377
|
|
|
|
|
|
|
| |
Once the objects are constructed, they own the buffer. Passing a unique_ptr
makes that clear.
llvm-svn: 211595
|
|
|
|
|
|
|
|
|
|
| |
This allows us to just use a std::unique_ptr to store the pointer to the buffer.
The flip side is that they have to support releasing the buffer back to the
caller.
Overall this looks like a more efficient and less brittle api.
llvm-svn: 211542
|
|
|
|
| |
llvm-svn: 210871
|
|
|
|
|
|
| |
This should make sure that most new uses use the std prefix.
llvm-svn: 210835
|
|
|
|
|
|
| |
instead of comparing to nullptr.
llvm-svn: 206252
|
|
|
|
|
|
|
| |
Add type name mappings for the ARM COFF relocations. This allows for objdump to
provide a more useful description of relocations in disassembly inline form.
llvm-svn: 205834
|
|
|
|
| |
llvm-svn: 205577
|
|
|
|
|
|
|
|
|
|
|
|
| |
This has the following advantages:
* Less code.
* The old ELF implementation was wrong for non-relocatable objects.
* The old ELF implementation (and I think MachO) was wrong for thumb.
No current testcase since this is only used from MCJIT and it only uses
relocatable objects and I don't think it supports thumb yet.
llvm-svn: 205508
|
|
|
|
|
|
| |
All existing users explicitly ask for an address or a file offset.
llvm-svn: 205503
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit r205479.
It turns out that nm does use addresses, it is just that every reasonable
relocatable ELF object has sections with address 0. I have no idea if those
exist in reality, but it at least it shows that llvm-nm should use the name
address.
The added test was includes an unusual .o file with non 0 section addresses. I
created it by hacking ELFObjectWriter.cpp.
Really sorry for the churn.
llvm-svn: 205493
|
|
|
|
|
|
|
|
|
|
|
| |
What llvm-nm prints depends on the file format. On ELF for example, if the
file is relocatable, it prints offsets. If it is not, it prints addresses.
Since it doesn't really need to care what it is that it is printing, use the
generic term value.
Fix or implement getSymbolValue to keep llvm-nm working.
llvm-svn: 205479
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
entry at a time.
Some targets require more than one relocation entry to perform a relocation.
This change allows processRelocationRef to process more than one relocation
entry at a time by passing the relocation iterator itself instead of just
the relocation entry.
Related to <rdar://problem/16199095>
llvm-svn: 204439
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
NumberOfRelocations field in COFF section table is only 16-bit wide. If an
object has more than 65535 relocations, the number of relocations is stored
to VirtualAddress field in the first relocation field, and a special flag
(IMAGE_SCN_LNK_NRELOC_OVFL) is set to Characteristics field.
In test we cheated a bit. I made up a test file so that it has
IMAGE_SCN_LNK_NRELOC_OVFL flag but the number of relocations is much smaller
than 65535. This is to avoid checking in a large test file just to test a
file with many relocations.
Differential Revision: http://llvm-reviews.chandlerc.com/D3139
llvm-svn: 204418
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The current state of affairs has auxiliary symbols described as a big
bag of bytes. This is less than satisfying, it detracts from the YAML
file as being human readable.
Instead, allow for symbols to optionally contain their auxiliary data.
This allows us to have a much higher level way of describing things like
weak symbols, function definitions and section definitions.
This depends on D3105.
Differential Revision: http://llvm-reviews.chandlerc.com/D3092
llvm-svn: 204214
|
|
|
|
|
|
| |
Differential Revision: http://llvm-reviews.chandlerc.com/D3103
llvm-svn: 204199
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
it work with range-based for loops.
Reviewers: ruiu
Reviewed By: ruiu
CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D3097
llvm-svn: 204120
|
|
|
|
|
|
|
| |
Add the Windows COFF ARM object file magic. This enables the LLVM tools to
interact with COFF object files for Windows on ARM.
llvm-svn: 203761
|
|
|
|
|
|
|
|
|
|
| |
This compiles with no changes to clang/lld/lldb with MSVC and includes
overloads to various functions which are used by those projects and llvm
which have OwningPtr's as parameters. This should allow out of tree
projects some time to move. There are also no changes to libs/Target,
which should help out of tree targets have time to move, if necessary.
llvm-svn: 203083
|
|
|
|
| |
llvm-svn: 202957
|
|
|
|
|
|
|
|
|
| |
COFF object files with 0 as string table size are currently rejected. This
prevents us from reading object files written by tools like cvtres that
violate the PECOFF spec and write 0 instead of 4 for the size of an empty
string table.
llvm-svn: 202292
|
|
|
|
| |
llvm-svn: 202210
|
|
|
|
|
|
|
|
| |
Offsets past the range of single-slash encoding are encoded as base64,
padded to 6 characters, and prefixed with two slashes. This encoding is
undocumented but used by MSVC.
llvm-svn: 201940
|
|
|
|
|
|
|
|
|
|
|
| |
This interface allows IRObjectFile to be implemented without having dummy
methods for all section and segment related methods.
Both llvm-ar and llvm-nm are changed to use it. Unfortunately the mangler is
still not plugged in since it requires some refactoring to make a Module hold
a DataLayout.
llvm-svn: 201881
|
|
|
|
|
|
| |
Some versions of libstdc++ forbid using cstdint in C++98 mode.
llvm-svn: 201812
|
|
|
|
| |
llvm-svn: 201805
|
|
|
|
|
|
|
| |
VA can be 64 bit, as the image base can be larger than 4GB, so we need to
handle 64 bit VAs properly.
llvm-svn: 201803
|
|
|
|
| |
llvm-svn: 201769
|
|
|
|
|
|
|
| |
SEH table addresses are VA in COFF file. In this patch we convert VA to RVA
before printing it, because dumpbin prints them as RVAs.
llvm-svn: 201760
|
|
|
|
| |
llvm-svn: 201108
|
|
|
|
|
|
|
|
|
|
| |
It is not clear how much we should try to expose in getFlags. For example,
should there be a SF_Object and a SF_Text?
But for information that is already being exposed, we may as well use it in
llvm-nm.
llvm-svn: 200820
|