History log of /llvm-project/llvm/lib/Object/MachOObjectFile.cpp (Results 201 – 225 of 491)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1f472eac 21-Jan-2016 Kevin Enderby <enderby@apple.com>

Fix MachOObjectFile::getSymbolSection() to not call report_fatal_error()
but to return object_error::parse_failed.  Then made the code in llvm-nm
do for Mach-O files what is done in the darwin native

Fix MachOObjectFile::getSymbolSection() to not call report_fatal_error()
but to return object_error::parse_failed.  Then made the code in llvm-nm
do for Mach-O files what is done in the darwin native tools which is to
print "(?,?)" or just "s" for bad section indexes. Also added a test to show
it prints the bad section index of "42" when printing the fields as raw hex.

llvm-svn: 258434

show more ...


Revision tags: llvmorg-3.8.0-rc1
# 15576e1c 06-Dec-2015 Craig Topper <craig.topper@gmail.com>

Use make_range to reduce mentions of iterator type. NFC

llvm-svn: 254872


Revision tags: llvmorg-3.7.1, llvmorg-3.7.1-rc2, llvmorg-3.7.1-rc1
# de833225 12-Nov-2015 Kuba Brecka <kuba.brecka@gmail.com>

[Object, MachO] Mark symbols from DATA and BSS sections as ST_Data

In `MachOObjectFile::getSymbolType` we currently always return `SymbolRef::ST_Function` for symbols from any section. In order for

[Object, MachO] Mark symbols from DATA and BSS sections as ST_Data

In `MachOObjectFile::getSymbolType` we currently always return `SymbolRef::ST_Function` for symbols from any section. In order for llvm-symbolizer to correctly symbolize Mach-O globals, symbols from data and BSS sections should return `SymbolRef::ST_Data`.

Differential Revision: http://reviews.llvm.org/D14576

llvm-svn: 252867

show more ...


# 46e642f8 08-Oct-2015 Kevin Enderby <enderby@apple.com>

Fix a bug in llvm-objdump’s printing of Objective-C meta data
from malformed Mach-O files that caused a crash because of a
section header had a size that extended past the end of the file.

rdar://22

Fix a bug in llvm-objdump’s printing of Objective-C meta data
from malformed Mach-O files that caused a crash because of a
section header had a size that extended past the end of the file.

rdar://22983603

llvm-svn: 249768

show more ...


# 10c80e79 22-Sep-2015 NAKAMURA Takumi <geek4civic@gmail.com>

Prune trailing whitespaces.

llvm-svn: 248265


# 0a7d0ad9 22-Sep-2015 NAKAMURA Takumi <geek4civic@gmail.com>

Untabify.

llvm-svn: 248264


# a9cb538a 22-Sep-2015 NAKAMURA Takumi <geek4civic@gmail.com>

Reformat blank lines.

llvm-svn: 248263


# 84965031 22-Sep-2015 NAKAMURA Takumi <geek4civic@gmail.com>

Reformat comment lines.

llvm-svn: 248262


# 70ad98ac 22-Sep-2015 NAKAMURA Takumi <geek4civic@gmail.com>

Reformat.

llvm-svn: 248261


# 0013be16 21-Sep-2015 Craig Topper <craig.topper@gmail.com>

Use makeArrayRef or None to avoid unnecessarily mentioning the ArrayRef type extra times. NFC

llvm-svn: 248140


Revision tags: llvmorg-3.7.0, llvmorg-3.7.0-rc4
# 68961bba 25-Aug-2015 Davide Italiano <davide@freebsd.org>

[MachO] Move trivial accessors to header.

Requested by: Jim Grosbach.

llvm-svn: 245963


# 933e2307 25-Aug-2015 Davide Italiano <davide@freebsd.org>

[MachO] Introduce MinVersion API.

While introducing support for MinVersionLoadCommand in llvm-readobj I noticed there's
no API to extract Major/Minor/Update components conveniently. Currently consum

[MachO] Introduce MinVersion API.

While introducing support for MinVersionLoadCommand in llvm-readobj I noticed there's
no API to extract Major/Minor/Update components conveniently. Currently consumers
do the bit twiddling on their own, but this will change from now on.

I'll convert llvm-objdump (and llvm-readobj) in a later commit.

Differential Revision: http://reviews.llvm.org/D12282
Reviewed by: rafael

llvm-svn: 245938

show more ...


Revision tags: 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
# be8b0ea8 07-Jul-2015 Rafael Espindola <rafael.espindola@gmail.com>

Delete UnknownAddress. It is a perfectly valid symbol value.

getSymbolValue now returns a value that in convenient for most callers:
* 0 for undefined
* symbol size for common symbols
* offset/addre

Delete UnknownAddress. It is a perfectly valid symbol value.

getSymbolValue now returns a value that in convenient for most callers:
* 0 for undefined
* symbol size for common symbols
* offset/address for symbols the rest

Code that needs something more specific can check getSymbolFlags.

llvm-svn: 241605

show more ...


# 7e7be92c 07-Jul-2015 Rafael Espindola <rafael.espindola@gmail.com>

Common symbols don't have a value.

At least not in the interface exposed by ObjectFile. This matches what ELF and
COFF implement.

Adjust existing code that was expecting them to have values. No ove

Common symbols don't have a value.

At least not in the interface exposed by ObjectFile. This matches what ELF and
COFF implement.

Adjust existing code that was expecting them to have values. No overall
functionality change intended.

Another option would be to change the interface and the ELF and COFF
implementations to say that the value of a common symbol is its size.

llvm-svn: 241593

show more ...


# d8247727 07-Jul-2015 Rafael Espindola <rafael.espindola@gmail.com>

Common symbols are not undefined, at least for ObjectFile.

They are implemented like that in some object formats, but for the interface
provided by lib/Object, SF_Undefined and SF_Common are differe

Common symbols are not undefined, at least for ObjectFile.

They are implemented like that in some object formats, but for the interface
provided by lib/Object, SF_Undefined and SF_Common are different things.

This matches the ELF and COFF implementation and fixes llvm-nm for MachO.

llvm-svn: 241587

show more ...


# 05cbccc6 07-Jul-2015 Rafael Espindola <rafael.espindola@gmail.com>

Simplify, NFC.

In these two contexts we really just want the raw n_value. No need to use
getSymbolValue which checks for special cases where, semantically, the symbol
has no value.

llvm-svn: 241584


# 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


# dea0016f 03-Jul-2015 Rafael Espindola <rafael.espindola@gmail.com>

Use getValue instead of getAddress in a few MachO only cases.

In MachO the value of the symbol is always the address, so we can use the
simpler function.

llvm-svn: 241364


# 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


# e9c58c74 30-Jun-2015 Rafael Espindola <rafael.espindola@gmail.com>

Implement containsSymbol with other lower level methods.

llvm-svn: 241112


# 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


# 0ad71d98 30-Jun-2015 Rafael Espindola <rafael.espindola@gmail.com>

Move function to the only file that uses it.

llvm-svn: 241040


12345678910>>...20