Commit Graph

82 Commits

Author SHA1 Message Date
Simon Atanasyan ba5929771a [obj2yaml] Recognize input file format using llvm::object::ObjectFile
interface methods isCOFF().

The '-coff' command line option has been removed. It was not used in any
test cases.

The patch reviewed by Michael Spencer.

llvm-svn: 208157
2014-05-07 05:18:51 +00:00
David Majnemer 798e548955 Object: Output .file symbols properly
obj2yaml would emit the NUL bytes padding the auxiliary file symbol
records.  Trimming them looks nicer.

llvm-svn: 204314
2014-03-20 06:29:02 +00:00
David Majnemer ed98b68ed8 Object: Abstract out the determination of function line symbols
No functionality change.

llvm-svn: 204313
2014-03-20 06:28:55 +00:00
David Majnemer ddf28f2b79 Object: Provide a richer means of describing auxiliary symbols
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
2014-03-19 04:47:47 +00:00
Alexey Samsonov 27dc839406 [C++11] Change the interface of getCOFF{Section,Relocation,Symbol} to make 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
2014-03-18 06:53:02 +00:00
Ahmed Charles 56440fd820 Replace OwningPtr<T> with std::unique_ptr<T>.
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
2014-03-06 05:51:42 +00:00
Ahmed Charles 96c9d95f51 [C++11] Replace OwningPtr::take() with OwningPtr::release().
llvm-svn: 202957
2014-03-05 10:19:29 +00:00
Rafael Espindola b5155a572f Change the begin and end methods in ObjectFile to match the style guide.
llvm-svn: 201108
2014-02-10 20:24:04 +00:00
NAKAMURA Takumi bee5c53819 llvm/tools: Prune redundant target_link_libraries.
llvm-svn: 200559
2014-01-31 17:40:06 +00:00
Rafael Espindola 5e812afaeb 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
2014-01-30 02:49:50 +00:00
NAKAMURA Takumi b5c4b87690 [CMake] Update LLVM_LINK_COMPONENTS for each CMakeLists.txt.
llvm-svn: 196908
2013-12-10 11:13:32 +00:00
Rafael Espindola 44fee4e0eb Remove several unused variables.
Patch by Alp Toker.

llvm-svn: 191757
2013-10-01 13:32:03 +00:00
Rafael Espindola 28c2e33362 Don't link with the archive library programs that don't use it.
llvm-svn: 184081
2013-06-17 15:29:46 +00:00
Rui Ueyama 82ebd8e36d readobj: Dump PE/COFF optional records.
These records are mandatory for executables and are used by the loader.

Reviewers: rafael

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D939

llvm-svn: 183852
2013-06-12 19:10:33 +00:00
Rafael Espindola e2e741ecdd Print symbol names in relocations when dumping COFF as YAML.
llvm-svn: 183403
2013-06-06 13:06:17 +00:00
Rafael Espindola 8e71301637 Move BinaryRef to a new include/llvm/Object/YAML.h file.
It will be used for ELF dumping too.

llvm-svn: 183287
2013-06-05 02:32:26 +00:00
Rafael Espindola 93f33235e5 Remove dead code.
Thanks to Sean Silva for noticing it!

llvm-svn: 183148
2013-06-03 19:42:57 +00:00
Rafael Espindola 3f1c99a67c Rename COFFYaml.h to COFFYAML.h for consistency.
llvm-svn: 183042
2013-05-31 20:38:27 +00:00
Rafael Espindola a3310e0b9e Don't allocate temporary string for section data.
llvm-svn: 183040
2013-05-31 20:26:44 +00:00
Rafael Espindola c823f00ed1 Use std::list so that we have a stable iterator.
I will try to avoid creating these std::strings, but for now this gets
the tests passing with libc++.

llvm-svn: 182405
2013-05-21 18:53:50 +00:00
Rafael Espindola f5bb53f19f Convert obj2yaml to use yamlio.
llvm-svn: 182169
2013-05-17 22:58:42 +00:00
Rafael Espindola b1a19a8a0f Remove dead code.
This is part of a future patch to use yamlio that incorrectly ended up in a
cleanup patch.

Thanks to Benjamin Kramer for reporting it.

llvm-svn: 179938
2013-04-20 11:06:34 +00:00
Rafael Espindola 4ef5ed769e These can be void.
llvm-svn: 179923
2013-04-20 03:33:09 +00:00
Rafael Espindola 9225772c6e Rename obj2yaml local namespace to avoid conflicts with llvm::yaml.
llvm-svn: 179922
2013-04-20 03:16:59 +00:00
Rafael Espindola 02c0780f08 Remove local namespace yaml to avoid confusion with llvm::yaml.
llvm-svn: 179921
2013-04-20 03:13:00 +00:00
Rafael Espindola a5497efe93 Small obj2yaml cleanups.
* using namespace llvm.
* whitespace.
* early return.

llvm-svn: 179920
2013-04-20 02:55:00 +00:00
Chandler Carruth 3fa99abfae Remove a global 'endl' variable from the other file as well.
llvm-svn: 179010
2013-04-08 08:55:18 +00:00
Chandler Carruth 1819289607 Clean up namespaces in obj2yaml.cpp.
llvm-svn: 179009
2013-04-08 08:55:14 +00:00
Chandler Carruth c224e25d49 Cleanup the formatting of obj2yaml.cpp.
I couldn't touch this file and not clean it up some. These reformattings
brought to you by clang-format, with some minor adjustments by me. More
spring cleaning to follow here.

llvm-svn: 179004
2013-04-08 08:39:59 +00:00
Chandler Carruth 741c00df17 Don't define our own global 'endl' variable. While technically it had
internal linkage and so wasn't a patent bug, it doesn't make any sense
here. We can avoid even calling operator<< by just embedding the newline
in the string literals that were already being streamed out. It also
gives the impression of some line-ending agnosticisms which is not
present, and that flushing happens when it doesn't.

If we want to use std::endl, we could do that, but honestly it doesn't
seem remotely worth it. Using '\n' directly is much more clear when
working with raw_ostream.

It also happens to fix builds with old crufty GCC STL implementations
that include std::endl into the global namespace (or headers written to
be compatible with such atrocities).

llvm-svn: 179003
2013-04-08 08:30:47 +00:00
Rafael Espindola 601b6d4e33 Fix include guards to match new location.
llvm-svn: 178877
2013-04-05 15:31:16 +00:00
Rafael Espindola 87a0290941 Move obj2yaml to tools to sort out make's dependencies.
llvm-svn: 178835
2013-04-05 02:57:22 +00:00