Commit Graph

4107 Commits

Author SHA1 Message Date
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