History log of /llvm-project/llvm/lib/Object/Archive.cpp (Results 76 – 100 of 166)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 694210cd 02-May-2016 Rafael Espindola <rafael.espindola@gmail.com>

Expose a getFullName for thin archive members.

It will be used in lld.

llvm-svn: 268226


# b550cb17 18-Apr-2016 Mehdi Amini <mehdi.amini@apple.com>

[NFC] Header cleanup

Removed some unused headers, replaced some headers with forward class declarations.

Found using simple scripts like this one:
clear && ack --cpp -l '#include "llvm/ADT/IndexedM

[NFC] Header cleanup

Removed some unused headers, replaced some headers with forward class declarations.

Found using simple scripts like this one:
clear && ack --cpp -l '#include "llvm/ADT/IndexedMap.h"' | xargs grep -L 'IndexedMap[<]' | xargs grep -n --color=auto 'IndexedMap'

Patch by Eugene Kosov <claprix@yandex.ru>

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266595

show more ...


# 3fcdf6ae 06-Apr-2016 Kevin Enderby <enderby@apple.com>

Thread Expected<...> up from createMachOObjectFile() to allow llvm-objdump to produce a real error message

Produce the first specific error message for a malformed Mach-O file describing
the problem

Thread Expected<...> up from createMachOObjectFile() to allow llvm-objdump to produce a real error message

Produce the first specific error message for a malformed Mach-O file describing
the problem instead of the generic message for object_error::parse_failed of
"Invalid data was encountered while parsing the file”.  Many more good error
messages will follow after this first one.

This is built on Lang Hames’ great work of adding the ’Error' class for
structured error handling and threading Error through MachOObjectFile
construction. And making createMachOObjectFile return Expected<...> .

So to to get the error to the llvm-obdump tool, I changed the stack of
these methods to also return Expected<...> :

object::ObjectFile::createObjectFile()
object::SymbolicFile::createSymbolicFile()
object::createBinary()

Then finally in ParseInputMachO() in MachODump.cpp the error can
be reported and the specific error message can be printed in llvm-objdump
and can be seen in the existing test case for the existing malformed binary
but with the updated error message.

Converting these interfaces to Expected<> from ErrorOr<> does involve
touching a number of places. To contain the changes for now use of
errorToErrorCode() and errorOrToExpected() are used where the callers
are yet to be converted.

Also there some were bugs in the existing code that did not deal with the
old ErrorOr<> return values. So now with Expected<> since they must be
checked and the error handled, I added a TODO and a comment:
“// TODO: Actually report errors helpfully” and a call something like
consumeError(ObjOrErr.takeError()) so the buggy code will not crash
since needed to deal with the Error.

Note there is one fix also needed to lld/COFF/InputFiles.cpp that goes along
with this that I will commit right after this. So expect lld not to built
after this commit and before the next one.

llvm-svn: 265606

show more ...


# f84646cd 31-Mar-2016 Peter Collingbourne <peter@pcc.me.uk>

Object: Correctly read thin archives containing absolute paths.

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

llvm-svn: 265065


Revision tags: llvmorg-3.8.0, llvmorg-3.8.0-rc3
# 98372e32 16-Feb-2016 Vedant Kumar <vsk@apple.com>

Simplify users of StringRef::{l,r}trim (NFC)

r260925 introduced a version of the *trim methods which is preferable
when trimming a single kind of character. Update all users in llvm.

llvm-svn: 2609

Simplify users of StringRef::{l,r}trim (NFC)

r260925 introduced a version of the *trim methods which is preferable
when trimming a single kind of character. Update all users in llvm.

llvm-svn: 260926

show more ...


Revision tags: llvmorg-3.8.0-rc2, llvmorg-3.8.0-rc1, llvmorg-3.7.1, llvmorg-3.7.1-rc2, llvmorg-3.7.1-rc1
# 7a96942a 05-Nov-2015 Kevin Enderby <enderby@apple.com>

Reapply r250906 with many suggested updates from Rafael Espindola.
The needed lld matching changes to be submitted immediately next,
but this revision will cause lld failures with this alone which is

Reapply r250906 with many suggested updates from Rafael Espindola.
The needed lld matching changes to be submitted immediately next,
but this revision will cause lld failures with this alone which is expected.

This removes the eating of the error in Archive::Child::getSize() when the characters
in the size field in the archive header for the member is not a number. To do this we
have all of the needed methods return ErrorOr to push them up until we get out of lib.
Then the tools and can handle the error in whatever way is appropriate for that tool.

So the solution is to plumb all the ErrorOr stuff through everything that touches archives.
This include its iterators as one can create an Archive object but the first or any other
Child object may fail to be created due to a bad size field in its header.

Thanks to Lang Hames on the changes making child_iterator contain an
ErrorOr<Child> instead of a Child and the needed changes to ErrorOr.h to add
operator overloading for * and -> .

We don’t want to use llvm_unreachable() as it calls abort() and is produces a “crash”
and using report_fatal_error() to move the error checking will cause the program to
stop, neither of which are really correct in library code. There are still some uses of
these that should be cleaned up in this library code for other than the size field.

The test cases use archives with text files so one can see the non-digit character,
in this case a ‘%’, in the size field.

These changes will require corresponding changes to the lld project. That will be
committed immediately after this change. But this revision will cause lld failures
with this alone which is expected.

llvm-svn: 252192

show more ...


# cc86d824 03-Nov-2015 Rafael Espindola <rafael.espindola@gmail.com>

This never returns end(), simplify to use Child instead of iterator. NFC.

llvm-svn: 251876


# 43358761 31-Oct-2015 Rafael Espindola <rafael.espindola@gmail.com>

Don't store a Child to the first regular member.

This is a bit ugly, but has a few advantages:
* Archive is now easy to copy since there is no Archive -> Child -> Archive
loop.
* It makes it clear

Don't store a Child to the first regular member.

This is a bit ugly, but has a few advantages:
* Archive is now easy to copy since there is no Archive -> Child -> Archive
loop.
* It makes it clear that we already checked for errors when finding the Child
data.

llvm-svn: 251750

show more ...


# 4a782fbf 31-Oct-2015 Rafael Espindola <rafael.espindola@gmail.com>

Simplify handling of archive Symbol tables.

We only need to store a StringRef.

llvm-svn: 251748


# 8f23882f 31-Oct-2015 Rafael Espindola <rafael.espindola@gmail.com>

Simplify the handling of the archive string table.

We only need to store a StringRef

llvm-svn: 251746


# da9dd050 21-Oct-2015 Kevin Enderby <enderby@apple.com>

Backing out commit r250906 as it broke lld.

llvm-svn: 250908


# e3bf4fd5 21-Oct-2015 Kevin Enderby <enderby@apple.com>

This removes the eating of the error in Archive::Child::getSize() when the characters
in the size field in the archive header for the member is not a number. To do this we
have all of the needed met

This removes the eating of the error in Archive::Child::getSize() when the characters
in the size field in the archive header for the member is not a number. To do this we
have all of the needed methods return ErrorOr to push them up until we get out of lib.
Then the tools and can handle the error in whatever way is appropriate for that tool.

So the solution is to plumb all the ErrorOr stuff through everything that touches archives.
This include its iterators as one can create an Archive object but the first or any other
Child object may fail to be created due to a bad size field in its header.

Thanks to Lang Hames on the changes making child_iterator contain an
ErrorOr<Child> instead of a Child and the needed changes to ErrorOr.h to add
operator overloading for * and -> .

We don’t want to use llvm_unreachable() as it calls abort() and is produces a “crash”
and using report_fatal_error() to move the error checking will cause the program to
stop, neither of which are really correct in library code. There are still some uses of
these that should be cleaned up in this library code for other than the size field.

Also corrected the code where the size gets us to the “at the end of the archive”
which is OK but past the end of the archive will return object_error::parse_failed now.

The test cases use archives with text files so one can see the non-digit character,
in this case a ‘%’, in the size field.

llvm-svn: 250906

show more ...


# 1c1add44 13-Oct-2015 Kevin Enderby <enderby@apple.com>

Tweak to r250117 and change to use ErrorOr and drop isSizeValid for
ArchiveMemberHeader, suggestion by Rafael Espíndola.

Also The clang-x86-win2008-selfhost bot still does not like the
malformed-mac

Tweak to r250117 and change to use ErrorOr and drop isSizeValid for
ArchiveMemberHeader, suggestion by Rafael Espíndola.

Also The clang-x86-win2008-selfhost bot still does not like the
malformed-machos 00000031.a test, so removing it for now. All
the other bots are fine with it however.

llvm-svn: 250222

show more ...


# 90395545 12-Oct-2015 Kevin Enderby <enderby@apple.com>

Fixed bugs in llvm-obdump while parsing Mach-O files from malformed archives
that caused aborts. This was because of the characters of the ‘Size’ field in
the archive header did not contain decimal

Fixed bugs in llvm-obdump while parsing Mach-O files from malformed archives
that caused aborts. This was because of the characters of the ‘Size’ field in
the archive header did not contain decimal characters.

rdar://22983603

llvm-svn: 250117

show more ...


# 483ad200 08-Oct-2015 Rafael Espindola <rafael.espindola@gmail.com>

Handle Archive::getNumberOfSymbols being called in an archive with no symbols.

No change in llvm, but will be tested from lld.

llvm-svn: 249709


Revision tags: llvmorg-3.7.0, llvmorg-3.7.0-rc4, llvmorg-3.7.0-rc3, studio-1.4, llvmorg-3.7.0-rc2
# be9ab268 22-Jul-2015 Rafael Espindola <rafael.espindola@gmail.com>

Fix fetching the symbol table of a thin archive.

We were trying to read it as an external file.

llvm-svn: 242926


Revision tags: llvmorg-3.7.0-rc1
# f662e00a 15-Jul-2015 Rafael Espindola <rafael.espindola@gmail.com>

Simplify a few uses of remove_filename by using parent_path instead.

llvm-svn: 242334


# 4b83cb53 14-Jul-2015 Rafael Espindola <rafael.espindola@gmail.com>

Add support for reading members out of thin archives.

For now the Archive owns the buffers of the thin archive members.
This makes for a simple API, but all the buffers are destructed
only when the

Add support for reading members out of thin archives.

For now the Archive owns the buffers of the thin archive members.
This makes for a simple API, but all the buffers are destructed
only when the archive is destructed. This should be fine since we
close the files after mmap so we should not hit an open file
limit.

llvm-svn: 242215

show more ...


# 2b05416b 14-Jul-2015 Rafael Espindola <rafael.espindola@gmail.com>

Add a herper function. NFC.

llvm-svn: 242100


# c60d0d2a 13-Jul-2015 Rafael Espindola <rafael.espindola@gmail.com>

Fix reading archive members with / in the name.

This is important for thin archives.

llvm-svn: 242082


# 4104fe8a 08-Jul-2015 Rafael Espindola <rafael.espindola@gmail.com>

Don't reject an archive with just a symbol table.

It is pretty unambiguous how to interpret it and gnu ar accepts it too.

llvm-svn: 241750


# c91177e4 08-Jul-2015 Rafael Espindola <rafael.espindola@gmail.com>

Disallow Archive::child_iterator that don't point to an archive.

NFC, just less error prone.

llvm-svn: 241747


Revision tags: llvmorg-3.6.2, llvmorg-3.6.2-rc1
# 7d099195 09-Jun-2015 Rui Ueyama <ruiu@google.com>

Remove object_error::success and use std::error_code() instead

make_error_code(object_error) is slow because object::object_category()
uses a ManagedStatic variable. But the real problem is that the

Remove object_error::success and use std::error_code() instead

make_error_code(object_error) is slow because object::object_category()
uses a ManagedStatic variable. But the real problem is that the function is
called too frequently. This patch uses std::error_code() instead of
object_error::success. In most cases, we return "success", so this patch
reduces number of function calls to that function.

http://reviews.llvm.org/D10333

llvm-svn: 239409

show more ...


# 407e0976 26-May-2015 Rui Ueyama <ruiu@google.com>

Object: Add Archive::getNumberOfSymbols().

Add a function that returns number of symbols in archive headers.

llvm-svn: 238213


Revision tags: llvmorg-3.6.1, llvmorg-3.6.1-rc1, llvmorg-3.5.2, llvmorg-3.5.2-rc1
# 3206b79d 02-Mar-2015 Rui Ueyama <ruiu@google.com>

Use read{16,32,64}{le,be}() instead of *reinterpret_cast<u{little,big}{16,32,64}_t>().

llvm-svn: 231016


1234567