Commit Graph

4355 Commits

Author SHA1 Message Date
Sean Silva 0a409cf04a [yaml2obj] Add support for sh_addralign via `AddressAlign` key.
For consistency, change the address in the test case from 0xDEADBEEF to
0xCAFEBABE since 0xCAFEBABE that actually has a 2-byte alignment.

llvm-svn: 183962
2013-06-14 00:38:02 +00:00
Sean Silva 46dffffb39 [yaml2obj] Add support for specifying raw section content.
llvm-svn: 183955
2013-06-13 22:20:01 +00:00
Sean Silva f4bfcedfe5 [yaml2obj] Add sh_addr via `Address` key.
llvm-svn: 183954
2013-06-13 22:19:54 +00:00
Sean Silva 3820593160 [yaml2obj] Initial ELF section support.
The current functionality is extremely basic and a bit rough around the
edges, but it will flesh out in future commits.

llvm-svn: 183953
2013-06-13 22:19:48 +00:00
Rafael Espindola 4f35da77a6 Don't use PathV1.h in Signals.h.
llvm-svn: 183947
2013-06-13 21:16:58 +00:00
Rafael Espindola 280e5cb653 Don't use PathV1.h in FileUtilities.h.
llvm-svn: 183941
2013-06-13 20:41:00 +00:00
Rafael Espindola 7c1023ad27 Avoid using PathV1.h in Program.h.
llvm-svn: 183940
2013-06-13 20:25:38 +00:00
Rafael Espindola 4c7ad8fc27 Have sys::FindProgramByName return a std::string.
llvm-svn: 183928
2013-06-13 19:25:37 +00:00
Rafael Espindola e7a629fb33 Further reduce usage of sys::Path in bugpoint.
llvm-svn: 183912
2013-06-13 16:22:26 +00:00
Rafael Espindola c0bbe36245 Try to fix the build with libstdc++ 4.4.
llvm-svn: 183909
2013-06-13 15:52:54 +00:00
Rafael Espindola b851d42f47 Reduce sys::Path usage in bugpoint.
llvm-svn: 183908
2013-06-13 15:47:11 +00:00
Rafael Espindola cb2eca0f91 Remove the program class.
It was only used to implement ExecuteAndWait and ExecuteNoWait. Expose just
those two functions and make Execute and Wait implementations details.

llvm-svn: 183864
2013-06-12 20:58:35 +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 71affba988 Inline Path::isBitcodeFile into only use and remove it.
llvm-svn: 183840
2013-06-12 15:13:57 +00:00
Rafael Espindola d1fcac9126 Include PathV1.h in files that use it.
This is preparation for replacing Path.h with PathV2.h.

llvm-svn: 183782
2013-06-11 20:00:56 +00:00
Rafael Espindola 46ed353313 Convert another use of sys::identifyFileType.
No functionality change.

llvm-svn: 183759
2013-06-11 18:05:26 +00:00
Sean Silva 864dd75093 Fix dubious type name similar to member name.
Should bring bots back to life.

llvm-svn: 183715
2013-06-11 00:13:52 +00:00
Sean Silva f99309cb08 [yaml2obj] Initial ELF support.
Currently, only emitting the ELF header is supported (no sections or
segments).

The ELFYAML code organization is broadly similar to the COFFYAML code.

llvm-svn: 183711
2013-06-10 23:44:15 +00:00
Rafael Espindola 1dc43065a7 Pass a StringRef to sys::identifyFileType.
llvm-svn: 183669
2013-06-10 15:27:39 +00:00
Alexey Samsonov 35c987dc11 [llvm-symbolizer] rewrite r183213 in a more clear way
llvm-svn: 183526
2013-06-07 15:25:27 +00:00
Kevin Enderby 273ae01b03 Teach llvm-objdump with the -macho parser how to use the data in code table
from the LC_DATA_IN_CODE load command.  And when disassembling print
the data in code formatted for the kind of data it and not disassemble those
bytes.

I added the format specific functionality to the derived class MachOObjectFile
since these tables only appears in Mach-O object files. This is my first
attempt to modify the libObject stuff so if folks have better suggestions
how to fit this in or suggestions on the implementation please let me know.

rdar://11791371

llvm-svn: 183424
2013-06-06 17:20:50 +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
Sean Silva 5fbb154d04 Add BinaryRef binary_size() method.
This avoids making assumptions about the data representation.

llvm-svn: 183349
2013-06-05 23:32:27 +00:00
Sean Silva 23f3b82790 Add writeAsBinary(raw_ostream &) method to BinaryRef.
Previously, yaml2coff.cpp had a writeHexData static helper function to
do this, but it is generally useful functionality.

Also, validate hex strings up-front to avoid running having to handle
errors "deep inside" the yaml2obj code (it also gives better diagnostics
than it used to).

llvm-svn: 183345
2013-06-05 22:59:00 +00:00
Sean Silva 3b76e4044b yaml2obj: split out COFF logic into separate file
llvm-svn: 183335
2013-06-05 19:56:47 +00:00
Sean Silva 741cebbea0 yaml2obj: add -format=<fmt> to choose input YAML interpretation
See the comment in yaml2obj.cpp for why this is currently needed.
Eventually we can get rid of this, but for now it is needed in order to
make forward progress with adding ELF support, and should be
straightforward to remove later.

Also, preserve the default of COFF, to avoid breaking existing tests.
This policy can easily be changed later though.

llvm-svn: 183332
2013-06-05 18:51:34 +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 806f006490 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
2013-06-05 01:33:53 +00:00
Bob Wilson 16522c01dc Remove "-Wl,-seg1addr -Wl,0xE0000000" from link options.
Specifying the load address for Darwin i386 dylibs was a performance
optimization for dyld that is not relevant for x86_64 or arm. We can just
remove this now.

llvm-svn: 183230
2013-06-04 15:26:37 +00:00
Alexey Samsonov 5239d58c8e [llvm-symbolizer] Avoid calling slow getSymbolSize for Mach-O files. Assume that symbols with zero size are in fact large enough.
llvm-svn: 183213
2013-06-04 07:57:38 +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
Alexey Samsonov 213527d9c9 Correct handling invalid filename in llvm-symbolizer
llvm-svn: 183102
2013-06-03 14:12:39 +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
Bill Wendling 70b1400e6d Don't reach into the middle of TargetMachine and cache one of its ivars.
Not only does this break encapsulation, it's gross.

llvm-svn: 182876
2013-05-29 20:37:19 +00:00
NAKAMURA Takumi d5c2e60b19 llvm-objdump.cpp: Appease MSC16 x64. utostr(n++) causes internal compiler error.
llvm-svn: 182722
2013-05-27 00:02:48 +00:00
Michael J. Spencer df1ecbd734 Replace Count{Leading,Trailing}Zeros_{32,64} with count{Leading,Trailing}Zeros.
llvm-svn: 182680
2013-05-24 22:23:49 +00:00
Ahmed Bougacha aa79068157 MC: Disassembled CFG reconstruction.
This patch builds on some existing code to do CFG reconstruction from
a disassembled binary:
- MCModule represents the binary, and has a list of MCAtoms.
- MCAtom represents either disassembled instructions (MCTextAtom), or
  contiguous data (MCDataAtom), and covers a specific range of addresses.
- MCBasicBlock and MCFunction form the reconstructed CFG. An MCBB is
  backed by an MCTextAtom, and has the usual successors/predecessors.
- MCObjectDisassembler creates a module from an ObjectFile using a
  disassembler. It first builds an atom for each section. It can also
  construct the CFG, and this splits the text atoms into basic blocks.

MCModule and MCAtom were only sketched out; MCFunction and MCBB were
implemented under the experimental "-cfg" llvm-objdump -macho option.
This cleans them up for further use; llvm-objdump -d -cfg now generates
graphviz files for each function found in the binary.

In the future, MCObjectDisassembler may be the right place to do
"intelligent" disassembly: for example, handling constant islands is just
a matter of splitting the atom, using information that may be available
in the ObjectFile. Also, better initial atom formation than just using
sections is possible using symbols (and things like Mach-O's
function_starts load command).

This brings two minor regressions in llvm-objdump -macho -cfg:
- The printing of a relocation's referenced symbol.
- An annotation on loop BBs, i.e., which are their own successor.

Relocation printing is replaced by the MCSymbolizer; the basic CFG
annotation will be superseded by more related functionality.

llvm-svn: 182628
2013-05-24 01:07:04 +00:00
Ahmed Bougacha ad1084de84 Add MCSymbolizer for symbolic/annotated disassembly.
This is a basic first step towards symbolization of disassembled
instructions. This used to be done using externally provided (C API)
callbacks. This patch introduces:
- the MCSymbolizer class, that mimics the same functions that were used
  in the X86 and ARM disassemblers to symbolize immediate operands and
  to annotate loads based off PC (for things like c string literals).
- the MCExternalSymbolizer class, which implements the old C API.
- the MCRelocationInfo class, which provides a way for targets to
  translate relocations (either object::RelocationRef, or disassembler
  C API VariantKinds) to MCExprs.
- the MCObjectSymbolizer class, which does symbolization using what it
  finds in an object::ObjectFile. This makes simple symbolization (with
  no fancy relocation stuff) work for all object formats!
- x86-64 Mach-O and ELF MCRelocationInfos.
- A basic ARM Mach-O MCRelocationInfo, that provides just enough to
  support the C API VariantKinds.

Most of what works in otool (the only user of the old symbolization API
that I know of) for x86-64 symbolic disassembly (-tvV) works, namely:
- symbol references: call _foo; jmp 15 <_foo+50>
- relocations:       call _foo-_bar; call _foo-4
- __cf?string:       leaq 193(%rip), %rax ## literal pool for "hello"
Stub support is the main missing part (because libObject doesn't know,
among other things, about mach-o indirect symbols).

As for the MCSymbolizer API, instead of relying on the disassemblers
to call the tryAdding* methods, maybe this could be done automagically
using InstrInfo? For instance, even though PC-relative LEAs are used
to get the address of string literals in a typical Mach-O file, a MOV
would be used in an ELF file. And right now, the explicit symbolization
only recognizes PC-relative LEAs. InstrInfo should have already have
most of what is needed to know what to symbolize, so this can
definitely be improved.

I'd also like to remove object::RelocationRef::getValueString (it seems
only used by relocation printing in objdump), as simply printing the
created MCExpr is definitely enough (and cleaner than string concats).

llvm-svn: 182625
2013-05-24 00:39:57 +00:00
Bill Wendling f44b2a2e2d The command line options need to be processed before we create the TargetMachine.
Move the processing of the command line options to right before we create the
TargetMachine instead of after.
<rdar://problem/13468287>

llvm-svn: 182611
2013-05-23 21:21:50 +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
Tim Northover 79ab7f736f Print uint64_t -debug text correctly on 32-bit hosts
On 32-bit hosts %p can print garbage when given a uint64_t, we should
use %llx instead. This only affects the output of the debugging text
produced by lli.

llvm-svn: 182209
2013-05-19 09:55:06 +00:00
Rafael Espindola e6211f7a0c Fix the configure build.
llvm-svn: 182172
2013-05-17 23:20:58 +00:00
Rafael Espindola f5bb53f19f Convert obj2yaml to use yamlio.
llvm-svn: 182169
2013-05-17 22:58:42 +00:00
David Tweed 2e7efedd39 Minor changes to the MCJITTest unittests to use the correct API for finalizing
the JIT object (including XFAIL an ARM test that now needs fixing). Also renames
internal function for consistency.

llvm-svn: 182085
2013-05-17 10:01:46 +00:00
Ahmed Bougacha 0835ca12ef llvm-objdump: Initialize MCDisassembler once instead of for each section.
llvm-svn: 182054
2013-05-16 21:28:23 +00:00
David Blaikie 041f1aa3e2 Use only explicit bool conversion operators
BitVector/SmallBitVector::reference::operator bool remain implicit since
they model more exactly a bool, rather than something else that can be
boolean tested.

The most common (non-buggy) case are where such objects are used as
return expressions in bool-returning functions or as boolean function
arguments. In those cases I've used (& added if necessary) a named
function to provide the equivalent (or sometimes negative, depending on
convenient wording) test.

One behavior change (YAMLParser) was made, though no test case is
included as I'm not sure how to reach that code path. Essentially any
comparison of llvm::yaml::document_iterators would be invalid if neither
iterator was at the end.

This helped uncover a couple of bugs in Clang - test cases provided for
those in a separate commit along with similar changes to `operator bool`
instances in Clang.

llvm-svn: 181868
2013-05-15 07:36:59 +00:00
Filip Pizlo 9bc53e8467 SectionMemoryManager shouldn't be a JITMemoryManager. Previously, the
EngineBuilder interface required a JITMemoryManager even if it was being used 
to construct an MCJIT. But the MCJIT actually wants a RTDyldMemoryManager. 
Consequently, the SectionMemoryManager, which is meant for MCJIT, derived 
from the JITMemoryManager and then stubbed out a bunch of JITMemoryManager 
methods that weren't relevant to the MCJIT.

This patch fixes the situation: it teaches the EngineBuilder that 
RTDyldMemoryManager is a supertype of JITMemoryManager, and that it's 
appropriate to pass a RTDyldMemoryManager instead of a JITMemoryManager if 
we're using the MCJIT. This allows us to remove the stub methods from 
SectionMemoryManager, and make SectionMemoryManager a direct subtype of 
RTDyldMemoryManager.

llvm-svn: 181820
2013-05-14 19:29:00 +00:00
Rafael Espindola 227144c23c Remove the MachineMove class.
It was just a less powerful and more confusing version of
MCCFIInstruction. A side effect is that, since MCCFIInstruction uses
dwarf register numbers, calls to getDwarfRegNum are pushed out, which
should allow further simplifications.

I left the MachineModuleInfo::addFrameMove interface unchanged since
this patch was already fairly big.

llvm-svn: 181680
2013-05-13 01:16:13 +00:00
Rafael Espindola 2f44bf236e Introduce convenience typedefs for the 4 ELF object types.
llvm-svn: 181509
2013-05-09 13:13:28 +00:00
Rafael Espindola 0d15f7313f Change getRelocationAdditionalInfo to be ELF only.
It was only implemented for ELF where it collected the Addend, so this
patch also renames it to getRelocationAddend.

llvm-svn: 181502
2013-05-09 03:39:05 +00:00
Daniel Malea 3c5bed1670 Add DebugIR pass -- emits IR file and replace source lines with IR lines in MD
- requires existing debug information to be present
- fixes up file name and line number information in metadata
- emits a "<orig_filename>-debug.ll" succinct IR file (without !dbg metadata
  or debug intrinsics) that can be read by a debugger
- initialize pass in opt tool to enable the "-debug-ir" flag
- lit tests to follow

llvm-svn: 181467
2013-05-08 20:44:14 +00:00
Rafael Espindola 9a383405a7 Remove exception handling support from the old JIT.
llvm-svn: 181354
2013-05-07 20:53:59 +00:00
Rafael Espindola fa4513a178 Split Alignment out of the Section Characteristics.
The alignment is just a byte in the middle of Characteristics, not an
independent flag. Making it an independent field in the yaml
representation makes it more yamlio friendly.

llvm-svn: 181243
2013-05-06 20:11:21 +00:00
Rafael Espindola 92fd9619f5 Remove some redundant includes in llvm-mc.cpp.
Patch by Jun Koi!

llvm-svn: 181231
2013-05-06 18:19:24 +00:00
Rafael Espindola 914d31ffd3 Optimize llvm-link too.
This takes the linking of almost all modules in a clang build from 6:32
to 0:19.

llvm-svn: 181105
2013-05-04 05:30:49 +00:00
Rafael Espindola a8023c1c9f Last batch of cleanups to Linker.h.
Update comments, fix * placement, fix method names that are not
used in clang, add a linkInModule that takes a Mode and put it
in Linker.cpp.

llvm-svn: 181099
2013-05-04 03:06:50 +00:00
Rafael Espindola 0229acaa0f Don't construct or delete a module on the Linker.
The linker is now responsible only for actually linking the modules, it
is up to the clients to create and destroy them.

llvm-svn: 181098
2013-05-04 02:43:00 +00:00
Rafael Espindola 40bbfa1080 Remove unused members and constructor arguments.
llvm-svn: 181096
2013-05-04 02:28:57 +00:00
Rafael Espindola 75f9655afb Add missing header.
llvm-svn: 181095
2013-05-04 02:21:46 +00:00
Amara Emerson d9104c0359 Revert r181009.
llvm-svn: 181079
2013-05-03 23:57:17 +00:00
Amara Emerson 2f54d9fe10 Add support for reading ARM ELF build attributes.
Build attribute sections can now be read if they exist via ELFObjectFile, and
the llvm-readobj tool has been extended with an option to dump this information
if requested. Regression tests are also included which exercise these features.

Also update the docs with a fixed ARM ABI link and a new link to the Addenda
which provides the build attributes specification.

llvm-svn: 181009
2013-05-03 11:36:35 +00:00
Bill Wendling d0a790a523 Remove redundant flag.
llvm-svn: 180967
2013-05-02 22:52:47 +00:00
Bill Wendling 2d8b299dbd We don't want FP elimination when doing an Apple-style build.
llvm-svn: 180949
2013-05-02 21:09:03 +00:00
Rafael Espindola 6e040c0be2 Use llvm/Object/MachO.h in macho-dumper. Drop the old macho parser.
For Mach-O there were 2 implementations for parsing object files. A
standalone llvm/Object/MachOObject.h and llvm/Object/MachO.h which
implements the generic interface in llvm/Object/ObjectFile.h.

This patch adds the missing features to MachO.h, moves macho-dump to
use MachO.h and removes ObjectFile.h.

In addition to making sure that check-all is clean, I checked that the
new version produces exactly the same output in all Mach-O files in a
llvm+clang build directory (including executables and shared
libraries).

To test the performance, I ran macho-dump over all the files in a
llvm+clang build directory again, but this time redirecting the output
to /dev/null. Both the old and new versions take about 4.6 seconds
(2.5 user) to finish.

llvm-svn: 180624
2013-04-26 20:07:33 +00:00
Rafael Espindola 1e48387962 Clarify getRelocationAddress x getRelocationOffset a bit.
getRelocationAddress is for dynamic libraries and executables,
getRelocationOffset for relocatable objects.

Mark the getRelocationAddress of COFF and MachO as not implemented yet. Add a
test of ELF's. llvm-readobj -r now prints the same values as readelf -r.

llvm-svn: 180259
2013-04-25 12:28:45 +00:00
Rafael Espindola ba5899c563 Don't compute a std::vector<uint8_t> just to write it out a stream.
llvm-svn: 180247
2013-04-25 03:07:42 +00:00
Rafael Espindola 75c3036d4b Use pointers to iterate over symbols.
While here, don't report a dummy symbol for relocations that don't have symbols.
We used to says such relocations were for the first defined symbol, but now we
return end_symbols(). The llvm-readobj output change agrees with otool.

llvm-svn: 180214
2013-04-24 19:47:55 +00:00
Rafael Espindola cc111b2bc9 Don't produce an empty llvm.compiler.used in LTO.
LTO was always creating an empty llvm.compiler.used. With this patch we
now first check if there is anything to be added first.

Unfortunately, there is no good way to test libLTO in isolation as it needs gold
or ld64, but there are bots doing LTO builds that found this problem.

llvm-svn: 180202
2013-04-24 17:54:35 +00:00
Rafael Espindola 7f08d1b9a8 Fix typo.
llvm-svn: 180137
2013-04-23 19:39:34 +00:00
Rafael Espindola ad3b97537b Simplify yaml2obj a bit.
The COFFParser now contains only a COFFYAML::Object and the string table
(which is recomputed, not serialized).

The structs in COFFParser now all begin with a Header field with what is
actually on the COFF object. The other fields are things that are semantically
part of the struct (relocations in a section for exmaple), but are not actually
represented that way in the object file.

llvm-svn: 180134
2013-04-23 19:26:43 +00:00
Rafael Espindola b716e622ae Write relocations in yaml2obj.
llvm-svn: 180115
2013-04-23 15:53:02 +00:00
Nico Rieck 0ab8e602c9 llvm-readobj: Dump more COFF auxiliary records
llvm-svn: 180007
2013-04-22 08:35:11 +00:00
Nico Rieck a711deef13 llvm-readobj: Check for null section pointer
llvm-svn: 180006
2013-04-22 08:34:59 +00:00
Nico Rieck a8de653747 llvm-readobj: Do not print NULL StringRefs
llvm-svn: 180005
2013-04-22 08:34:46 +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
Rafael Espindola 4685073430 Remove COFFYAML::Header.
Instead, use MappingNormalization to directly parse COFF::header. Also change
the naming convention of the helper classes to be a bit shorter.

llvm-svn: 179917
2013-04-20 02:02:25 +00:00
Rafael Espindola 2b4e6b8de2 Remove COFFYAML::Relocation.
Use MappingNormalization to read a COFF::relocation directly.

No functionality change.

llvm-svn: 179891
2013-04-19 21:28:07 +00:00
Rafael Espindola feef8c2469 Don't read one command past the end.
Thanks to Evgeniy Stepanov for reporting this.

It might be a good idea to add a command iterator abstraction to MachO.h, but
this fixes the bug for now.

llvm-svn: 179848
2013-04-19 11:36:47 +00:00
Rafael Espindola 56f976f6bd At Jim Grosbach's request detemplate Object/MachO.h.
We are still able to handle mixed endian objects by swapping one struct at a
time.

llvm-svn: 179778
2013-04-18 18:08:55 +00:00
Peter Collingbourne 2f495b93ee Add support for subsections to the ELF assembler. Fixes PR8717.
Differential Revision: http://llvm-reviews.chandlerc.com/D598

llvm-svn: 179725
2013-04-17 21:18:16 +00:00
Alexey Samsonov 209095cd9f llvm-objdump: Don't print contents of BSS sections: it makes no sense and crashes llvm-objdump on relocated objects with large bss
llvm-svn: 179589
2013-04-16 10:53:11 +00:00
Rafael Espindola 2fa9f53c62 Remove getters now that we can specialize structs on the host endianness.
llvm-svn: 179534
2013-04-15 16:08:02 +00:00
Andy Gibbs b23ea72e48 Replace uses of the deprecated std::auto_ptr with OwningPtr.
This is a rework of the broken parts in r179373 which were subsequently reverted in r179374 due to incompatibility with C++98 compilers.  This version should be ok under C++98.

llvm-svn: 179520
2013-04-15 12:06:32 +00:00
Eric Christopher 13637e900e Revert "Recommit r179497 after fixing uninitialized variable." until
I can fix the testcases here:

http://lab.llvm.org:8011/builders/clang-native-arm-cortex-a9/builds/6952

This reverts commit r179512 due to testcases specifying triples
that they didn't actually mean and causing failures on other platforms.

llvm-svn: 179513
2013-04-15 07:31:37 +00:00
Eric Christopher fc2beaa136 Recommit r179497 after fixing uninitialized variable.
llvm-svn: 179512
2013-04-15 07:07:21 +00:00
Eric Christopher 1f140317e3 Revert "Remove some unused triple and data layout."
This reverts commit r179497 and the accompanying commit as it broke random platforms that aren't osx.

llvm-svn: 179499
2013-04-14 23:35:36 +00:00
Eric Christopher e1876a2b79 If we've specified a triple on the command line then go ahead
and use that as the default triple for the module and target
data layout.

llvm-svn: 179497
2013-04-14 23:32:40 +00:00
Rafael Espindola 9b709259e1 Finish templating MachObjectFile over endianness.
We are now able to handle big endian macho files in llvm-readobject. Thanks to
David Fang for providing the object files.

llvm-svn: 179440
2013-04-13 01:45:40 +00:00
Benjamin Kramer dae0851237 Revert broken pieces of r179373.
You can't copy an OwningPtr, and move semantics aren't available in C++98.

llvm-svn: 179374
2013-04-12 12:13:51 +00:00
Andy Gibbs 95777550a9 Replace uses of the deprecated std::auto_ptr with OwningPtr.
llvm-svn: 179373
2013-04-12 10:56:28 +00:00
Nico Rieck d6df0547fe Teach llvm-readobj to print ELF program headers
llvm-svn: 179363
2013-04-12 04:07:39 +00:00
Nico Rieck f3f0b79704 Add -expand-relocs to llvm-readobj
This option expands shown relocations from single line to a dictionary
format:

  Relocation {
    Offset: 0x4
    Type: R_386_32 (1)
    Symbol: sym
    Info: 0x0
  }

llvm-svn: 179359
2013-04-12 04:01:52 +00:00
Rafael Espindola ecf1320579 Add 179294 back, but don't use bit fields so that it works on big endian hosts.
Original message:

Print more information about relocations.

With this patch llvm-readobj now prints if a relocation is pcrel, its length,
if it is extern and if it is scattered.

It also refactors the code a bit to use bit fields instead of shifts and
masks all over the place.

llvm-svn: 179345
2013-04-12 00:17:33 +00:00
Rafael Espindola e2742a038c Revert my last two commits while I debug what is wrong in a big endian host.
llvm-svn: 179303
2013-04-11 17:46:10 +00:00
Rafael Espindola 708a44d464 Print more information about relocations.
With this patch llvm-readobj now prints if a relocation is pcrel, its length,
if it is extern and if it is scattered.

It also refactors the code a bit to use bit fields instead of shifts and
masks all over the place.

llvm-svn: 179294
2013-04-11 16:31:37 +00:00
Rafael Espindola 93f4a62a25 Simplify the code. No functionality change.
llvm-svn: 179259
2013-04-11 03:34:37 +00:00
Rafael Espindola 641c9bcfd5 Template MachOObjectFile over endianness too.
llvm-svn: 179179
2013-04-10 15:33:44 +00:00
Rafael Espindola eaae687d3e Template the MachO types over endianness.
For now they are still only used as little endian.

llvm-svn: 179147
2013-04-10 03:48:25 +00:00
Rafael Espindola c2413f59e4 Convert MachOObjectFile to a template.
For now it is templated only on being 64 or 32 bits. I will add little/big
endian next.

llvm-svn: 179097
2013-04-09 14:49:08 +00:00
Rafael Espindola c0406e162c Template the MachO types over the word size.
llvm-svn: 179051
2013-04-08 20:45:01 +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 d665259104 Implement MachOObjectFile::getHeader directly.
llvm-svn: 178994
2013-04-07 19:26:57 +00:00
Rafael Espindola 3c50f06202 Remove LoadCommandInfo now that we always have a pointer to the command.
LoadCommandInfo was needed to keep a command and its offset in the file. Now
that we always have a pointer to the command, we don't need the offset.

llvm-svn: 178991
2013-04-07 18:42:06 +00:00
Rafael Espindola 224208b868 Add MachOObjectFile::LoadCommandInfo.
This avoids using MachOObject::getLoadCommandInfo.

llvm-svn: 178990
2013-04-07 18:08:12 +00:00
Rafael Espindola 5ffc079c8a Remove MachOObjectFile::getObject.
llvm-svn: 178986
2013-04-07 16:07:35 +00:00
Rafael Espindola 31fce89645 Remove two uses of getObject.
llvm-svn: 178985
2013-04-07 15:46:05 +00:00
Rafael Espindola 79bb550577 Remove usage of InMemoryStruct in getSymbol.
llvm-svn: 178984
2013-04-07 15:35:18 +00:00
Rafael Espindola 6f5d6c7e78 Remove a use of InMemoryStruct in llvm-readobj.
llvm-svn: 178981
2013-04-07 15:05:12 +00:00
Rafael Espindola 0944c13e6b Make getObject const. Remove a const_cast.
llvm-svn: 178980
2013-04-07 14:50:40 +00:00
Rafael Espindola b7b11f7bac Remove last use of InMemoryStruct in llvm-objdump.
llvm-svn: 178979
2013-04-07 14:40:18 +00:00
Rafael Espindola 7be6ead7a4 Remove dead code.
llvm-svn: 178977
2013-04-07 14:30:21 +00:00
Rafael Espindola 91e626ebd2 Remove unused argument.
llvm-svn: 178976
2013-04-07 14:25:39 +00:00
Rafael Espindola 3add3e9c4a Move yaml2obj to tools too.
llvm-svn: 178904
2013-04-05 20:00:35 +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 b0f76a4b75 Don't fetch pointers from a InMemoryStruct.
InMemoryStruct is extremely dangerous as it returns data from an internal
buffer when the endiannes doesn't match. This should fix the tests on big
endian hosts.

llvm-svn: 178875
2013-04-05 15:15:22 +00:00
Alexey Samsonov d2069321e0 llvm-symbolizer: correctly parse filenames given in quotes
llvm-svn: 178859
2013-04-05 09:22:24 +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
Rafael Espindola 76f92277ca Don't export symbols in every binary on linux.
On freebsd this makes sure that symbols are exported on the binaries that need
them. The net result is that we should get symbols in the binaries that need
them on every platform.

On linux x86-64 this reduces the size of the bin directory from 262MB to 250MB.

Patch by Stephen Checkoway.

llvm-svn: 178725
2013-04-04 01:01:32 +00:00
Eric Christopher 9cad53cfec Implements low-level object file format specific output for COFF and
ELF with support for:

- File headers
- Section headers + data
- Relocations
- Symbols
- Unwind data (only COFF/Win64)

The output format follows a few rules:
- Values are almost always output one per line (as elf-dump/coff-dump already do). - Many values are translated to something readable (like enum names), with the raw value in parentheses.
- Hex numbers are output in uppercase, prefixed with "0x".
- Flags are sorted alphabetically.
- Lists and groups are always delimited.

Example output:
---------- snip ----------
Sections [
  Section {
    Index: 1
    Name: .text (5)
    Type: SHT_PROGBITS (0x1)
    Flags [ (0x6)
      SHF_ALLOC (0x2)
      SHF_EXECINSTR (0x4)
    ]
    Address: 0x0
    Offset: 0x40
    Size: 33
    Link: 0
    Info: 0
    AddressAlignment: 16
    EntrySize: 0
    Relocations [
      0x6 R_386_32 .rodata.str1.1 0x0
      0xB R_386_PC32 puts 0x0
      0x12 R_386_32 .rodata.str1.1 0x0
      0x17 R_386_PC32 puts 0x0
    ]
    SectionData (
      0000: 83EC04C7 04240000 0000E8FC FFFFFFC7  |.....$..........|
      0010: 04240600 0000E8FC FFFFFF31 C083C404  |.$.........1....|
      0020: C3                                   |.|
    )
  }
]
---------- snip ----------

Relocations and symbols can be output standalone or together with the section header as displayed in the example.
This feature set supports all tests in test/MC/COFF and test/MC/ELF (and I suspect all additional tests using elf-dump), making elf-dump and coff-dump deprecated.

Patch by Nico Rieck!

llvm-svn: 178679
2013-04-03 18:31:38 +00:00
Eric Christopher 2d4b3a6b94 Don't disassemble symbols with an unknown address or size.
Patch by Nico Rieck!

llvm-svn: 178678
2013-04-03 18:31:23 +00:00
Bob Wilson f36f15fc06 Run the ObjCARCContract pass for LTO. <rdar://problem/13538084>
llvm-svn: 178385
2013-03-29 23:28:55 +00:00
Chandler Carruth 60d7006e99 Manually update the dependencies in the Makefiles. It turns out that all
that work on the LLVMBuild based dependency specification didn't
actually work, we just now maintain dependencies in *3* places instead
of 2. Yay.

There may still be some missing dependencies, I'm still sifting through
the bots and my builds, but this is a step in the right direction.

llvm-svn: 177988
2013-03-26 03:45:47 +00:00
Chandler Carruth e60e57bee5 Split out the IRReader header and the utility functions it provides into
its own library. These functions are bridging between the bitcode reader
and the ll parser which are in different libraries. Previously we didn't
have any good library to do this, and instead played fast and loose with
a "header only" set of interfaces in the Support library. This really
doesn't work well as evidenced by the recent attempt to add timing logic
to the these routines.

As part of this, make them normal functions rather than weird inline
functions, and sink the implementation into the library. Also clean up
the header to be nice and minimal.

This requires updating lots of build system dependencies to specify that
the IRReader library is needed, and several source files to not
implicitly rely upon the header file to transitively include all manner
of other headers.

If you are using IRReader.h, this commit will break you (the header
moved) and you'll need to also update your library usage to include
'irreader'. I will commit the corresponding change to Clang momentarily.

llvm-svn: 177971
2013-03-26 02:25:37 +00:00
Shankar Easwaran 82050340c6 [tools][llvm-readobj] print the name of the section when iterating the symbol table / dynamic symbol table
llvm-svn: 177873
2013-03-25 16:06:51 +00:00
Eli Bendersky 138b684882 Remove stale comment
llvm-svn: 177410
2013-03-19 16:04:02 +00:00
Alexey Samsonov dd71c5b84a Fix for r177390: map values are pointers, use DeleteContainerSeconds() instead of .clear()
llvm-svn: 177409
2013-03-19 15:33:18 +00:00
Dmitry Vyukov e8504e269f llvm-symbolizer: flush internal caches functionality
llvm-svn: 177390
2013-03-19 10:24:42 +00:00
Rafael Espindola bd5bd89e77 Build LLVMgold.so on FreeBSD using cmake.
Patch by Stephen Checkoway.

llvm-svn: 177233
2013-03-17 12:01:05 +00:00
Lang Hames dfa3f8f449 Make LTO codegen use a PassManager, rather than a FunctionPassManager, for the
codegen passes. This brings it in to line with clang and llc's codegen setup,
and tidies up the code.

If I understand correctly, adding ModulePasses to a FunctionPassManager is
bogus. It only seems to explode if an added ModulePass depends on a
FunctionPass though, which might be why this code has survived so long.

Fixes <rdar://problem/13386816>.

llvm-svn: 176977
2013-03-13 21:18:46 +00:00
Daniel Malea 6e9b040649 Connect LLVM CMake build scripts to LLDB's CMake scripts:
- if you have LLDB checked out in $llvm/tools, CMake will build it now!
- LLDB is known to build on Linux with libstdc++ and GCC 4.6/4.7 or Clang 3.3
- to run lldb tests, do "make check-lldb" after a build

llvm-svn: 176307
2013-02-28 23:15:15 +00:00
Bill Wendling c7e0a04433 Add the -disable-opt option to LTO. This adds:
- Consistency with opt (which supports the same option with the same meaning and
  description).
- Debugging gold plugin-based linking without optimizations getting in the way.
- Debugging programs linked with the gold plugin while preserving the original
  debug info.
- Fine-grained control over LTO passes using the gold plugin in combination with
  opt (or clang/dragonegg).

Patch by Cristiano Giuffrida!

llvm-svn: 176257
2013-02-28 14:11:10 +00:00
Shankar Easwaran e0bdc946ab print TLS segment
llvm-svn: 176192
2013-02-27 17:57:17 +00:00
Eli Bendersky 6f5d70efe9 Try to get rid of a -wunitialized warning: explicitly initialize the pointer
to NULL and use asserts to check in relevant places.

llvm-svn: 176134
2013-02-26 23:04:17 +00:00
Matt Arsenault bceea5dfea Fix auto_ptr is deprecated warnings
llvm-svn: 176123
2013-02-26 21:20:35 +00:00
Andrew Kaylor cf99fd5709 Provide workaround for PR 15130.
This changes the RecordingMemoryManager in lli to use mapped memory rather than malloc to allocate memory for sections and uses a 'near' MemoryBlock to keep the allocations together.  This works around a problem in MCJIT where relocations are applied to a generated image immediately oupon generation, which isn't appropriate for the remote case.

llvm-svn: 176057
2013-02-25 23:00:19 +00:00
Michael J. Spencer ed820958c8 [objdump] Add PT_PHDR.
llvm-svn: 175709
2013-02-21 02:21:29 +00:00
Michael J. Spencer 1366a61242 [objdump] Print the PT_INTERP and PT_DYNAMIC correcctly.
llvm-svn: 175659
2013-02-20 20:18:10 +00:00
Michael J. Spencer 6a8746b7e6 [llvm-readobj] Add ELF .dynamic table dumping.
llvm-svn: 175592
2013-02-20 02:37:12 +00:00
Alexey Samsonov d5d7bb5591 clang-formatize llvm-symbolizer code
llvm-svn: 175255
2013-02-15 08:54:47 +00:00
Dmitry Vyukov ef8fb72fc4 llvm-symbolizer: speedup symbol lookup
llvm-svn: 175158
2013-02-14 13:06:18 +00:00
Bill Wendling 89ff87ec3b Use 'RC_XBS' instead of 'RC_BUILDIT' to catch all times when it's built in the Apple way.
llvm-svn: 175069
2013-02-13 19:44:08 +00:00
Guy Benyei 83c74e9fad Add static cast to unsigned char whenever a character classification function is called with a signed char argument, in order to avoid assertions in Windows Debug configuration.
llvm-svn: 175006
2013-02-12 21:21:59 +00:00
Krzysztof Parzyszek 97438dc75e Add support for the pubnames section to llvm-dwarfdump.
llvm-svn: 174976
2013-02-12 16:20:28 +00:00
Bill Wendling d7e05d628a Update with attribute group IDs.
llvm-svn: 174847
2013-02-10 23:17:10 +00:00
Michael J. Spencer 91814e3465 [readobj] Fix memory leak.
llvm-svn: 174687
2013-02-08 01:05:48 +00:00
Eli Bendersky fd08bc195b Initial support for DWARF CFI parsing and dumping in LLVM
llvm-svn: 174463
2013-02-05 23:30:58 +00:00
Michael J. Spencer d7e7003e8b [objdump,readobj] Document the purpose and goals of each tool.
llvm-svn: 174439
2013-02-05 20:27:22 +00:00
Alexey Samsonov 741c688fe1 Print error messages from MemoryBuffer::getFile() in llvm-symbolizer
llvm-svn: 174346
2013-02-05 07:01:34 +00:00
Alexey Samsonov d6cef10af8 Replace global std::string with const char[]
llvm-svn: 174332
2013-02-04 15:55:26 +00:00
Michael J. Spencer 9718f45d39 [Object][Archive] Improve performance.
Improve performance of iterating over children and accessing the member file
buffer by caching the file size and moving code out to the header.

This also makes getBuffer return a StringRef instead of a MemoryBuffer. Both
fixing a memory leak and removing a malloc.

This takes getBuffer from ~10% of the time in lld to unmeasurable.

llvm-svn: 174272
2013-02-03 10:48:50 +00:00
Chandler Carruth 30cfaa2578 Fix a copy/paste-o that got missed because 'check' doesn't build lto.
llvm-svn: 174115
2013-01-31 23:34:47 +00:00
Chandler Carruth de093ef8d6 Give the MCStreamer class hierarchy LLVM RTTI facilities for use with
isa<> and dyn_cast<>. In several places, code is already hacking around
the absence of this, and there seem to be several interfaces that might
be lifted and/or devirtualized using this.

This change was based on a discussion with Jim Grosbach about how best
to handle testing for specific MCStreamer subclasses. He said that this
was the correct end state, and everything else was too hacky so
I decided to just make it so.

No functionality should be changed here, this is just threading the kind
through all the constructors and setting up the classof overloads.

llvm-svn: 174113
2013-01-31 23:29:57 +00:00
Andrew Kaylor 6d8776a514 Add support for source and line information to IntelJITEventListener for object emitted by MCJIT.
llvm-svn: 173712
2013-01-28 19:52:37 +00:00
Michael Gottesman 79d8d81226 Extracted ObjCARC.cpp into its own library libLLVMObjCARCOpts in preparation for refactoring the ARC Optimizer.
llvm-svn: 173647
2013-01-28 01:35:51 +00:00
Andrew Kaylor 9a8ff813f3 Add DIContext::getLineInfoForAddressRange() function and test. This function allows a caller to obtain a table of line information for a function using the function's address and size.
llvm-svn: 173537
2013-01-26 00:28:05 +00:00
Andrew Kaylor d55d7019fc Add support for applying in-memory relocations to the .debug_line section and, in the case of ELF files, using symbol addresses when available for relocations to the .debug_info section. Also extending the llvm-rtdyld tool to add the ability to dump line number information for testing purposes.
llvm-svn: 173517
2013-01-25 22:50:58 +00:00
Eli Bendersky a5a4ff5a58 When encountering an unknown file format, ObjectFile::createObjectFile should
politely report it instead of running into llvm_unreachable.

Also patch llvm-dwarfdump to actually check whether the file it's attempting to
dump is a valid object file.

llvm-svn: 173489
2013-01-25 20:53:41 +00:00
Eli Bendersky 7a94daa170 Add command-line flags for DWARF dumping.
Flags for dumping specific DWARF sections added in lib/DebugInfo and
llvm-dwarfdump.

llvm-svn: 173480
2013-01-25 20:26:43 +00:00
Eli Bendersky 48eaffc9f7 Rename variable to be more comprehensible and follow naming convention
llvm-svn: 173460
2013-01-25 17:06:42 +00:00
Saleem Abdulrasool 5f8609b7b4 [bugpoint] make tool selection messages unique
Change messages to help identify which interpreter was actually selected (safe
vs testing).

Signed-off-by: Saleem Abdulrasool <compnerd@compnerd.org>
Reviewed-by: Chandler Carruth <chandlerc@gmail.com>
llvm-svn: 173360
2013-01-24 16:49:14 +00:00
Saleem Abdulrasool ab4d7bc087 [bugpoint] set Message after tool configuration
Set the message returned after the GCC runner has been constructed as otherwise
the message will be overwritten by the construction of the runner, resulting in
misleading messages.

Signed-off-by: Saleem Abdulrasool <compnerd@compnerd.org>
Reviewed-by: Chandler Carruth <chandlerc@gmail.com>
llvm-svn: 173359
2013-01-24 16:49:12 +00:00
NAKAMURA Takumi a05a339c96 lli/RecordingMemoryManager: Free allocated sections in the destructor to satisfy --vg-leak!
FIXME: It could be generalized in MemoryManager.
llvm-svn: 173349
2013-01-24 14:12:12 +00:00
Alexey Samsonov ea83bafbda llvm-symbolizer: factor out bits of the tool into separate LLVMSymbolize.{h,cpp} files. No functionality change.
llvm-svn: 173159
2013-01-22 14:21:19 +00:00
Tim Northover 98d9b7e1d4 Fix missed out llvm-stress after APFloat change.
llvm-svn: 173141
2013-01-22 10:18:26 +00:00
NAKAMURA Takumi 8f75355a12 [CMake] bugpoint-passes should not be built in "all", when LLVM_BUILD_TOOLS is OFF.
llvm-svn: 173112
2013-01-22 01:44:00 +00:00
Jakub Staszak 691860c294 Remove unneeded #include.
llvm-svn: 173088
2013-01-21 21:02:47 +00:00
Chris Lattner 0271af8dc9 switch llvm-bcanalyzer onto the new cursor APIs, allowing deletion of
the old ReadRecord methods.

llvm-svn: 172952
2013-01-20 02:50:32 +00:00
Chris Lattner 3fa323d7d3 fix method name.
llvm-svn: 172921
2013-01-19 21:37:14 +00:00
Chandler Carruth 1fe21fc0b5 Sort all of the includes. Several files got checked in with mis-sorted
includes.

llvm-svn: 172891
2013-01-19 08:03:47 +00:00
Daniel Dunbar eec0f32eea [MC/Mach-O] Add support for linker options in Mach-O files.
llvm-svn: 172779
2013-01-18 01:26:07 +00:00
Eli Bendersky da09857394 Remove unneeded include and empty line
llvm-svn: 172642
2013-01-16 19:42:16 +00:00
Kevin Enderby e82ada6983 We want the dwarf AT_producer for assembly source files to match clang's
AT_producer.  Which includes clang's version information so we can tell
which version of the compiler was used.

This is the first of two steps to allow us to do that.  This is the llvm-mc
change to provide a method to set the AT_producer string.  The second step,
coming soon to a clang near you, will have the clang driver pass the value
of getClangFullVersion() via an flag when invoking the integrated assembler
on assembly source files.

rdar://12955296

llvm-svn: 172630
2013-01-16 17:46:23 +00:00
Peter Collingbourne a51c6ed608 Introduce llvm::sys::getProcessTriple() function.
In r143502, we renamed getHostTriple() to getDefaultTargetTriple()
as part of work to allow the user to supply a different default
target triple at configure time.  This change also affected the JIT.
However, it is inappropriate to use the default target triple in the
JIT in most circumstances because this will not necessarily match
the current architecture used by the process, leading to illegal
instruction and other such errors at run time.

Introduce the getProcessTriple() function for use in the JIT and
its clients, and cause the JIT to use it.  On architectures with a
single bitness, the host and process triples are identical.  On other
architectures, the host triple represents the architecture of the
host CPU, while the process triple represents the architecture used
by the host CPU to interpret machine code within the current process.
For example, when executing 32-bit code on a 64-bit Linux machine,
the host triple may be 'x86_64-unknown-linux-gnu', while the process
triple may be 'i386-unknown-linux-gnu'.

This fixes JIT for the 32-on-64-bit (and vice versa) build on non-Apple
platforms.

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

llvm-svn: 172627
2013-01-16 17:27:22 +00:00
Michael J. Spencer 1a79161fe3 [Object][ELF] Simplify ELFObjectFile by using ELFType.
This simplifies the usage and implementation of ELFObjectFile by using ELFType
to replace:

<endianness target_endianness, std::size_t max_alignment, bool is64Bits>

This does complicate the base ELF types as they must now use template template
parameters to partially specialize for the 32 and 64bit cases. However these
are only defined once.

llvm-svn: 172515
2013-01-15 07:44:25 +00:00
Nadav Rotem d2d57b72d6 LTO: Also init TTI for codegen passes.
llvm-svn: 172499
2013-01-15 01:53:57 +00:00
Eli Bendersky cbb2514d51 Expose an InitToTextSection through MCStreamer.
The aim of this patch is to fix the following piece of code in the
platform-independent AsmParser:

void AsmParser::CheckForValidSection() {
  if (!ParsingInlineAsm && !getStreamer().getCurrentSection()) {
    TokError("expected section directive before assembly directive");
    Out.SwitchSection(Ctx.getMachOSection(
                        "__TEXT", "__text",
                        MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
                        0, SectionKind::getText()));
  }
}

This was added for the "-n" option of llvm-mc.

The proposed fix adds another virtual method to MCStreamer, called
InitToTextSection. Conceptually, it's similar to the existing
InitSections which initializes all common sections and switches to
text. The new method is implemented by each platform streamer in a way
that it sees fit. So AsmParser can now do this:

void AsmParser::CheckForValidSection() {
  if (!ParsingInlineAsm && !getStreamer().getCurrentSection()) {
    TokError("expected section directive before assembly directive");
    Out.InitToTextSection();
  }
}

Which is much more reasonable.

llvm-svn: 172450
2013-01-14 19:04:57 +00:00
Andrew Trick 962318f6b4 Added -view-callgraph module pass.
-dot-callgraph similarly follows a standard module pass pattern.

Patch by Speziale Ettore!

llvm-svn: 172220
2013-01-11 17:28:14 +00:00
Dmitry Vyukov d08bd13ac8 llvm-symbolizer: add DATA command that allows to symbolize global variables.
Example:
>DATA bin/clang 0x26e8e40
<llvm::SparcSubTypeKV
<40799808 416
The last line is address and size of the object.

llvm-svn: 172180
2013-01-11 07:16:20 +00:00
Michael J. Spencer d857c1c9bf [llvm-objdump] Emit addresses with the correct number of leading 0's.
llvm-svn: 172130
2013-01-10 22:40:50 +00:00
Jakub Staszak 63e77d5ffa Fix #includes after my last commit.
llvm-svn: 172114
2013-01-10 21:56:40 +00:00
Eli Bendersky 802b62871e Add the align_to_end option to .bundle_lock in the MC implementation of aligned
bundling. The document describing this feature and the implementation has also
been updated:

https://sites.google.com/a/chromium.org/dev/nativeclient/pnacl/aligned-bundling-support-in-llvm

llvm-svn: 171797
2013-01-07 21:51:08 +00:00
Chandler Carruth 839a98e687 Move CallGraphSCCPass.h into the Analysis tree; that's where the
implementation lives already.

llvm-svn: 171746
2013-01-07 15:26:48 +00:00
Chandler Carruth 664e354de7 Switch TargetTransformInfo from an immutable analysis pass that requires
a TargetMachine to construct (and thus isn't always available), to an
analysis group that supports layered implementations much like
AliasAnalysis does. This is a pretty massive change, with a few parts
that I was unable to easily separate (sorry), so I'll walk through it.

The first step of this conversion was to make TargetTransformInfo an
analysis group, and to sink the nonce implementations in
ScalarTargetTransformInfo and VectorTargetTranformInfo into
a NoTargetTransformInfo pass. This allows other passes to add a hard
requirement on TTI, and assume they will always get at least on
implementation.

The TargetTransformInfo analysis group leverages the delegation chaining
trick that AliasAnalysis uses, where the base class for the analysis
group delegates to the previous analysis *pass*, allowing all but tho
NoFoo analysis passes to only implement the parts of the interfaces they
support. It also introduces a new trick where each pass in the group
retains a pointer to the top-most pass that has been initialized. This
allows passes to implement one API in terms of another API and benefit
when some other pass above them in the stack has more precise results
for the second API.

The second step of this conversion is to create a pass that implements
the TargetTransformInfo analysis using the target-independent
abstractions in the code generator. This replaces the
ScalarTargetTransformImpl and VectorTargetTransformImpl classes in
lib/Target with a single pass in lib/CodeGen called
BasicTargetTransformInfo. This class actually provides most of the TTI
functionality, basing it upon the TargetLowering abstraction and other
information in the target independent code generator.

The third step of the conversion adds support to all TargetMachines to
register custom analysis passes. This allows building those passes with
access to TargetLowering or other target-specific classes, and it also
allows each target to customize the set of analysis passes desired in
the pass manager. The baseline LLVMTargetMachine implements this
interface to add the BasicTTI pass to the pass manager, and all of the
tools that want to support target-aware TTI passes call this routine on
whatever target machine they end up with to add the appropriate passes.

The fourth step of the conversion created target-specific TTI analysis
passes for the X86 and ARM backends. These passes contain the custom
logic that was previously in their extensions of the
ScalarTargetTransformInfo and VectorTargetTransformInfo interfaces.
I separated them into their own file, as now all of the interface bits
are private and they just expose a function to create the pass itself.
Then I extended these target machines to set up a custom set of analysis
passes, first adding BasicTTI as a fallback, and then adding their
customized TTI implementations.

The fourth step required logic that was shared between the target
independent layer and the specific targets to move to a different
interface, as they no longer derive from each other. As a consequence,
a helper functions were added to TargetLowering representing the common
logic needed both in the target implementation and the codegen
implementation of the TTI pass. While technically this is the only
change that could have been committed separately, it would have been
a nightmare to extract.

The final step of the conversion was just to delete all the old
boilerplate. This got rid of the ScalarTargetTransformInfo and
VectorTargetTransformInfo classes, all of the support in all of the
targets for producing instances of them, and all of the support in the
tools for manually constructing a pass based around them.

Now that TTI is a relatively normal analysis group, two things become
straightforward. First, we can sink it into lib/Analysis which is a more
natural layer for it to live. Second, clients of this interface can
depend on it *always* being available which will simplify their code and
behavior. These (and other) simplifications will follow in subsequent
commits, this one is clearly big enough.

Finally, I'm very aware that much of the comments and documentation
needs to be updated. As soon as I had this working, and plausibly well
commented, I wanted to get it committed and in front of the build bots.
I'll be doing a few passes over documentation later if it sticks.

Commits to update DragonEgg and Clang will be made presently.

llvm-svn: 171681
2013-01-07 01:37:14 +00:00
Michael J. Spencer 6acf814a61 [objdump] Use correct format specifiers and fix C++03 variadic warning.
llvm-svn: 171651
2013-01-06 05:23:59 +00:00
Michael J. Spencer 209565db2d [objdump] Add --private-headers, -p.
This currently prints the ELF program headers.

llvm-svn: 171649
2013-01-06 03:56:49 +00:00
Chandler Carruth 441c2ac98a Fix another place where we build the TTI pass to the new interface.
Sorry for the noise here, 'make check' doesn't build this code. =/

llvm-svn: 171623
2013-01-05 11:54:35 +00:00
Chandler Carruth 539edf4ee0 Convert the TargetTransformInfo from an immutable pass with dynamic
interfaces which could be extracted from it, and must be provided on
construction, to a chained analysis group.

The end goal here is that TTI works much like AA -- there is a baseline
"no-op" and target independent pass which is in the group, and each
target can expose a target-specific pass in the group. These passes will
naturally chain allowing each target-specific pass to delegate to the
generic pass as needed.

In particular, this will allow a much simpler interface for passes that
would like to use TTI -- they can have a hard dependency on TTI and it
will just be satisfied by the stub implementation when that is all that
is available.

This patch is a WIP however. In particular, the "stub" pass is actually
the one and only pass, and everything there is implemented by delegating
to the target-provided interfaces. As a consequence the tools still have
to explicitly construct the pass. Switching targets to provide custom
passes and sinking the stub behavior into the NoTTI pass is the next
step.

llvm-svn: 171621
2013-01-05 11:43:11 +00:00
Chandler Carruth 9fb823bbd4 Move all of the header files which are involved in modelling the LLVM IR
into their new header subdirectory: include/llvm/IR. This matches the
directory structure of lib, and begins to correct a long standing point
of file layout clutter in LLVM.

There are still more header files to move here, but I wanted to handle
them in separate commits to make tracking what files make sense at each
layer easier.

The only really questionable files here are the target intrinsic
tablegen files. But that's a battle I'd rather not fight today.

I've updated both CMake and Makefile build systems (I think, and my
tests think, but I may have missed something).

I've also re-sorted the includes throughout the project. I'll be
committing updates to Clang, DragonEgg, and Polly momentarily.

llvm-svn: 171366
2013-01-02 11:36:10 +00:00
Chandler Carruth b034cb7755 Sort a few more #include lines in tools/... unittests/... and utils/...
llvm-svn: 171363
2013-01-02 10:26:28 +00:00
Nadav Rotem b1615b1ac4 Make opt grab the triple from the module and use it to initialize the target machine.
llvm-svn: 171341
2013-01-01 08:00:32 +00:00
Rafael Espindola 278e891cb2 Use the generic dump template. Extracted from a patch by Sami Liedes.
llvm-svn: 171305
2012-12-31 16:53:01 +00:00
Rafael Espindola 21bd841d27 Dump sections. Extracted from a patch by Sami Liedes.
llvm-svn: 171304
2012-12-31 16:29:44 +00:00
Rafael Espindola 144af2cb4d Print a header above the symbols. Extracted from a patch by Sami Liedes.
llvm-svn: 171302
2012-12-31 16:05:21 +00:00
Rafael Espindola 63d52b1e1c Check for errors. Extracted from a patch by Sami Liedes.
llvm-svn: 171301
2012-12-31 15:45:31 +00:00
Rafael Espindola ae74095255 Fix indentation. Extracted from a patch by Sami Liedes!
llvm-svn: 171300
2012-12-31 15:30:58 +00:00
Rafael Espindola f4b73f9733 Style fixes in llvm-readobj.cpp. Extracted from a patch by Sami Liedes!
llvm-svn: 171299
2012-12-31 15:27:42 +00:00
Rafael Espindola a9f810b6b5 Add a function to get the segment name of a section.
On MachO, sections also have segment names. When a tool looking at a .o file
prints a segment name, this is what they mean. In reality, a .o has only one
anonymous, segment.

This patch adds a MachO only function to fetch that segment name. I named it
getSectionFinalSegmentName since the main use for the name seems to be inform
the linker with segment this section should go to.

The patch also changes MachOObjectFile::getSectionName to return just the
section name instead of computing SegmentName,SectionName.

The main difference from the previous patch is that it doesn't use
InMemoryStruct. It is extremely dangerous: if the endians match it returns
a pointer to the file buffer, if not, it returns a pointer to an internal buffer
that is overwritten in the next API call.

We should change all of this code to use
support::detail::packed_endian_specific_integral like ELF, but since these
functions only handle strings, they work with big and little endian machines
as is.

I have tested this by installing ubuntu 12.10 ppc on qemu, that is why it took
so long :-)

llvm-svn: 170838
2012-12-21 03:47:03 +00:00
Eli Bendersky f483ff9204 Aligned bundling support. Following the discussion here:
http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056754.html

The proposal and implementation are fully documented here:
https://sites.google.com/a/chromium.org/dev/nativeclient/pnacl/aligned-bundling-support-in-llvm

Tests will follow shortly.

llvm-svn: 170718
2012-12-20 19:05:53 +00:00
Roman Divacky ff95a1dc12 Remove MCTargetAsmLexer and its derived classes now that edis,
its only user, is gone.

llvm-svn: 170699
2012-12-20 14:43:30 +00:00
Roman Divacky e3d323052f Remove edis - the enhanced disassembler. Fixes PR14654.
llvm-svn: 170578
2012-12-19 19:55:47 +00:00
Rafael Espindola 0f00de40dd Revert 170545 while I debug the ppc failures.
llvm-svn: 170547
2012-12-19 14:48:05 +00:00
Rafael Espindola aa7b27801c Add r170095 back.
I cannot reproduce it the failures locally, so I will keep an eye at the ppc
bots. This patch does add the change to the "Disassembly of section" message,
but that is not what was failing on the bots.

Original message:

Add a funciton to get the segment name of a section.

On MachO, sections also have segment names. When a tool looking at a .o file
prints a segment name, this is what they mean. In reality, a .o has only one
anonymous, segment.

This patch adds a MachO only function to fetch that segment name. I named it
getSectionFinalSegmentName since the main use for the name seems to be infor
the linker with segment this section should go to.

The patch also changes MachOObjectFile::getSectionName to return just the
section name instead of computing SegmentName,SectionName.

llvm-svn: 170545
2012-12-19 14:15:04 +00:00
Eric Christopher 906da23229 Add support for passing -main-file-name all the way through to
the assembler.

Part of PR14624

llvm-svn: 170390
2012-12-18 00:31:01 +00:00
Chandler Carruth 10700aad85 Prepare LLVM to fix PR14625, exposing a hook in MCContext to manage the
compilation directory.

This defaults to the current working directory, just as it always has,
but now an assembler can choose to override it with a custom directory.
I've taught llvm-mc about this option and added a test case.

llvm-svn: 170371
2012-12-17 21:32:42 +00:00
Reed Kotler aee4d5d194 This patch is needed to make c++ exceptions work for mips16.
Mips16 is really a processor decoding mode (ala thumb 1) and in the same
program, mips16 and mips32 functions can exist and can call each other.

If a jal type instruction encounters an address with the lower bit set, then
the processor switches to mips16 mode (if it is not already in it). If the
lower bit is not set, then it switches to mips32 mode.

The linker knows which functions are mips16 and which are mips32.
When relocation is performed on code labels, this lower order bit is
set if the code label is a mips16 code label.

In general this works just fine, however when creating exception handling
tables and dwarf, there are cases where you don't want this lower order
bit added in.

This has been traditionally distinguished in gas assembly source by using a
different syntax for the label.

lab1:      ; this will cause the lower order bit to be added
lab2=.     ; this will not cause the lower order bit to be added

In some cases, it does not matter because in dwarf and debug tables
the difference of two labels is used and in that case the lower order
bits subtract each other out.

To fix this, I have added to mcstreamer the notion of a debuglabel.
The default is for label and debug label to be the same. So calling
EmitLabel and EmitDebugLabel produce the same result.

For various reasons, there is only one set of labels that needs to be
modified for the mips exceptions to work. These are the "$eh_func_beginXXX" 
labels.

Mips overrides the debug label suffix from ":" to "=." .

This initial patch fixes exceptions. More changes most likely
will be needed to DwarfCFException to make all of this work
for actual debugging. These changes will be to emit debug labels in some
places where a simple label is emitted now.

Some historical discussion on this from gcc can be found at:
http://gcc.gnu.org/ml/gcc-patches/2008-08/msg00623.html
http://gcc.gnu.org/ml/gcc-patches/2008-11/msg01273.html 

llvm-svn: 170279
2012-12-16 04:00:45 +00:00
Eric Christopher c859c2912f Revert "Add a funciton to get the segment name of a section."
This reverts commit r170095 since it appears to be breaking the bots.

llvm-svn: 170105
2012-12-13 06:36:18 +00:00
Rafael Espindola bc8016d062 Add a funciton to get the segment name of a section.
On MachO, sections also have segment names. When a tool looking at a .o file
prints a segment name, this is what they mean. In reality, a .o has only one,
anonymous, segment.

This patch adds a MachO only function to fetch that segment name. I named it
getSectionFinalSegmentName since the main use for the name seems to be informing
the linker with segment this section should go to.

The patch also changes MachOObjectFile::getSectionName to return just the
section name instead of computing SegmentName,SectionName.

llvm-svn: 170095
2012-12-13 04:07:18 +00:00
NAKAMURA Takumi 256e013dd7 llvm/tools: Add #include "llvm/TargetTransformInfo.h"
llvm-svn: 169817
2012-12-11 05:53:37 +00:00
Rafael Espindola 6ee19d28f4 Change some functions to take const pointers.
llvm-svn: 169812
2012-12-11 03:10:43 +00:00
Bill Wendling 4a8fc8f271 Revert r169656.
The linker will call `lto_codegen_add_must_preserve_symbol' on all globals that
should be kept around. The linker will pretend that a dylib is being created.
<rdar://problem/12528059>

llvm-svn: 169770
2012-12-10 21:33:45 +00:00
NAKAMURA Takumi 6b819c5fb1 [CMake] Update dependencies to intrinsics_gen corresponding to r169711.
llvm-svn: 169724
2012-12-10 05:27:15 +00:00
Bill Wendling 39d3809368 Revert to old behavior until linker can pass export-dynamic option.
llvm-svn: 169720
2012-12-10 02:51:16 +00:00
Bill Wendling 65a6ee11dd Add the `lto_codegen_set_export_dynamic' function.
This function sets the `_exportDynamic' ivar. When that's set, we export all
symbols (e.g. we don't run the internalize pass). This is equivalent to the
`--export-dynamic' linker flag in GNU land:

--export-dynamic
  When creating a dynamically linked executable, add all symbols to the dynamic
  symbol table. The dynamic symbol table is the set of symbols which are visible
  from dynamic objects at run time. If you do not use this option, the dynamic
  symbol table will normally contain only those symbols which are referenced by
  some dynamic object mentioned in the link. If you use dlopen to load a dynamic
  object which needs to refer back to the symbols defined by the program, rather
  than some other dynamic object, then you will probably need to use this option
  when linking the program itself.

The Darwin linker will support this via the `-export_dynamic' flag. We should
modify clang to support this via the `-rdynamic' flag.

llvm-svn: 169656
2012-12-08 00:18:16 +00:00
Jim Grosbach 0ca9d5b7a5 Add C API for specifying CPU to the disassembler.
It was a nasty oversight that we didn't include this when we added this
API in the first place. Blech.

rdar://12839439

llvm-svn: 169653
2012-12-07 23:53:27 +00:00
Michael J. Spencer 6fa518c51e Quick build fix for c++03 clang. This needs a proper solution. Note that these offsets are guaranteed to be correct by Endian.h.
llvm-svn: 169438
2012-12-05 22:38:01 +00:00
Michael J. Spencer 0c6ec48d0b Add dump of Win64 EH unwind data.
The new command line option -unwind-info dumps the Win64 EH unwind
data to the console. This is a nice feature if you need to debug
generated EH data (e.g. from LLVM). Includes a test case.

Initial patch by João Matos, extensions and rework by Kai Nacke.

llvm-svn: 169415
2012-12-05 20:12:35 +00:00
Kevin Enderby 168ffb36a5 Added a option to the disassembler to print immediates as hex.
This is for the lldb team so most of but not all of the values are
to be printed as hex with this option.  Some small values like the
scale in an X86 address were requested to printed in decimal
without the leading 0x.

There may be some tweaks need to places that may still be in
decimal that they want in hex.  Specially for arm.  I made my best
guess.  Any tweaks from here should be simple.

I also did the best I know now with help from the C++ gurus
creating the cleanest formatImm() utility function and containing
the changes.  But if someone has a better idea to make something
cleaner I'm all ears and game for changing the implementation.

rdar://8109283

llvm-svn: 169393
2012-12-05 18:13:19 +00:00
Chandler Carruth 4d88a1c233 Sort the #include lines for tools/...
Again, tools are trickier to pick the main module header for than
library source files. I've started to follow the pattern of using
LLVMContext.h when it is included as a stub for program source files.

llvm-svn: 169252
2012-12-04 10:44:52 +00:00
Jakob Stoklund Olesen 2776b4c624 Add a -time-compilations=<N> option to llc.
This causes llc to repeat the module compilation N times, making it
possible to get more accurate information from -time-passes when
compiling small modules.

llvm-svn: 169040
2012-11-30 21:42:47 +00:00
Chandler Carruth dbd6958183 Move the InstVisitor utility into VMCore where it belongs. It heavily
depends on the IR infrastructure, there is no sense in it being off in
Support land.

This is in preparation to start working to expand InstVisitor into more
special-purpose visitors that are still generic and can be re-used
across different passes. The expansion will go into the Analylis tree
though as nothing in VMCore needs it.

llvm-svn: 168972
2012-11-30 03:08:41 +00:00
Pedro Artigas d6b092bbd5 One more step towards making doInitialization and doFinalization useful for
start up and clean up module passes, now that ASAN and TSAN are fixed the
tests pass

llvm-svn: 168905
2012-11-29 17:47:05 +00:00
Bill Wendling 706d3d66e9 Add back support for reading and parsing 'deplibs'.
This is for backwards compatibility for pre-3.x bc files. The code reads the
code, but does nothing with it.

llvm-svn: 168779
2012-11-28 08:41:48 +00:00
Andrew Kaylor 58365b9cc9 Modifying lli to use the SectionMemoryManager.
The functionality of SectionMemoryManager is equivalent to the LLIMCJITMemoryManager being replaced except that it allocates memory as RW and later changes it to RX or R as needed.  The page permissions are set in the call to MCJIT::finalizeObject.

llvm-svn: 168722
2012-11-27 19:49:00 +00:00
Bill Wendling ee5984df39 Remove the dependent libraries feature.
The dependent libraries feature was never used and has bit-rotted. Remove it.

llvm-svn: 168694
2012-11-27 09:55:56 +00:00
Andrew Kaylor c5feb5109e Make building of llvm-jitlistener conditional on the USE_INTEL_JITEVENTS setting.
llvm-svn: 168665
2012-11-27 01:24:25 +00:00
Owen Anderson 1db12f5135 Revert r168635 "Step towards implementation of pass manager with doInitialization and doFinalization per module detangled from runOn?? calls, still has temporary code not to break ASAN to be removed when that pass conforms to the proposed model".
It appears to have broken at least one buildbot.

llvm-svn: 168654
2012-11-27 00:53:24 +00:00
Owen Anderson 336368c4fd Step towards implementation of pass manager with doInitialization and doFinalization per module detangled from runOn?? calls, still has temporary code not to break ASAN to be removed when that pass conforms to the proposed model
Patch by Pedro Artigas, with feedback from by Chandler Carruth.

llvm-svn: 168635
2012-11-26 23:54:47 +00:00
Benjamin Kramer 9bcb9226f6 libLTO: Add a utility method to initialize the disassemblers.
Necessary to give disassembler users (like darwin's otool) a possibility to
dlopen libLTO and still initialize the required LLVM bits. This used to go
through libMCDisassembler but that's a gross layering violation, the MC layer
can't pull in functions from the targets. Adding a function to libLTO is a bit
of a hack but not worse than exposing other disassembler bits from libLTO.

Fixes PR14362.

llvm-svn: 168545
2012-11-24 16:59:10 +00:00
Rafael Espindola b3b60570e3 Add a -disable-cfi option to llvm-mc. This is useful for debugging as
it will expand any .cfi_* directives in the input assembly.

Unfortunately this cannot replace elf-dump in tests as the asm streamer
cannot relax the line advance opcodes.

llvm-svn: 168522
2012-11-23 17:37:34 +00:00
Andrew Kaylor 93fe3dcb13 Adding tests for the Intel JIT event listener's MCJIT support.
llvm-svn: 168459
2012-11-21 20:38:26 +00:00
Eli Bendersky 3a6808cc32 Add the -no-show-raw-insn option to llvm-objdump, thus making it a bit more
conformant to binutils objdump.

llvm-svn: 168393
2012-11-20 22:57:02 +00:00
NAKAMURA Takumi 34280412bb MCJIT: [cygming] Give noop to __main also in RecordingMemoryManger. It is emitted in @main().
XFAIL(s) can be removed.

llvm-svn: 168282
2012-11-18 06:16:32 +00:00
Andrew Kaylor a342cb9613 Interface changes to allow RuntimeDyld memory managers to set memory permissions after an object has been loaded.
llvm-svn: 168114
2012-11-15 23:50:01 +00:00
Owen Anderson 1aa2751260 Add doInitialization and doFinalization methods to ModulePass's, to allow them to be re-initialized and reused on multiple Module's.
Patch by Pedro Artigas.

llvm-svn: 168008
2012-11-15 00:14:15 +00:00
Daniel Dunbar 38d2284eeb llvm-nm: Make sort more stable when symbol names are equal.
llvm-svn: 167866
2012-11-13 19:39:55 +00:00
Shankar Easwaran 15b28be9da Adding changes to support GNU style archive library reading
llvm-svn: 167853
2012-11-13 18:38:42 +00:00
Eric Christopher 7370b55262 Rewrite DIContext interface to take an object. Update all callers.
llvm-svn: 167757
2012-11-12 21:40:38 +00:00
Alexander Potapenko 5a578119ad Don't use __cxa_demangle under MSVC (which doesn't have it)
llvm-svn: 167730
2012-11-12 14:49:58 +00:00
Alexey Samsonov 9cb13d59b7 Fixup for r167558: Store raw pointer (instead of reference) to RelocMap in DIContext. This is needed to prevent crashes because of dangling reference if the clients don't provide RelocMap to DIContext constructor.
llvm-svn: 167728
2012-11-12 14:25:36 +00:00
Alexander Potapenko 8c07f55568 [ASan] Add llvm-symbolizer from to tools/
This is the second and last (2/2) part of a change that moves llvm-symbolizer to llvm/tools/, which will allow to build it
with both cmake and configure+make.

llvm-svn: 167723
2012-11-12 11:33:29 +00:00
Eric Christopher 7c678de861 Add a relocation visitor to lib object. This works via caching relocated
values in a map that can be passed to consumers. Add a testcase that
ensures this works for llvm-dwarfdump.

llvm-svn: 167558
2012-11-07 23:22:07 +00:00
Bill Wendling 3fdaa244e1 Remove accidental commit.
llvm-svn: 167544
2012-11-07 18:39:32 +00:00