Commit Graph

462 Commits

Author SHA1 Message Date
Simon Atanasyan
13c5e09c6e [llvm-readobj] Print MIPS PLT table
Now the -mips-plt-got prints both MIPS GOT and PLT tables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241836 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-09 18:23:10 +00:00
David Majnemer
b1d6ad18ba [CodeView] Add support for emitting column information
Column information is present in CodeView when the line table subsection
has bit 0 set to 1 in it's flags field.  The column information is
represented as a pair of 16-bit quantities: a starting and ending
column.  This information is present at the end of the chunk, after all
the line-PC pairs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241764 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-09 00:19:51 +00:00
Adrian Prantl
54a2768153 llvm-objdump: Replace the -macho -raw option with a generic -raw-clang-ast
option that works with all object container formats.
Now that clang modules/PCH are object containers this option is useful to
to construct pipes like

  llvm-objdump -raw-clang-ast foo.pcm | llvm-bcanalyzer -

to inspect the AST contents in a PCH container.
Will be tested via clang.

Belatedly addresses review feedback for r233390.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241659 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-08 02:04:15 +00:00
Rafael Espindola
38e853141d Pass -m to the linker in this test.
Fixes the test on a ppc host.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240431 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 18:04:54 +00:00
Rafael Espindola
bd1e605b5c objdump: Don't print a (always 0) size for MachO symbols.
Only common symbol on MachO and COFF have a size.

For COFF we already had a custom format.

For MachO, there is no native objdump and we were printing it as ELF. Now
we only print the sizes for symbols that actually have them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240422 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 15:45:38 +00:00
Rafael Espindola
da523bd707 Add a test for the previous commit.
This shows how two symbols at the same address are handled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240374 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 03:42:44 +00:00
Rafael Espindola
393bbf5c86 Fix tests when X86 is not enabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240368 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 02:45:44 +00:00
Rafael Espindola
dba070638a Compute correct symbol sizes for MachO and COFF.
Before this would dump from the symbol start to the end of the section.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240367 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 02:20:37 +00:00
Frederic Riss
11fcb49922 [Object] Search for architecures by name in MachOUniversalBinary::getObjectForArch()
The reason we need to search by name rather than by Triple::ArchType
is to handle subarchitecture correclty. There is no different ArchType
for the x86_64h architecture (it identifies itself as x86_64), or for
the various ARM subarches. The only way to get to the subarch slice
in an universal binary is to search by name.

This issue led to hard to debug and transient symbolication failures
in Asan tests (it mostly works, because the files are very similar).

This also affects the Profiling infrastucture as it is the other user
of that API.

Reviewers: samsonov, bogner

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240339 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 21:33:24 +00:00
Rafael Espindola
0ed63077a2 Add a triple to the test to fix it on some hosts.
The slp vectorizer doesn't optimize this case in 32 bits.

Fixes PR23453.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240289 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 15:44:20 +00:00
Rafael Espindola
28b186f3cc Improve the --expand-relocs handling of MachO.
In a relocation target can take 3 basic forms

* A r_value in scattered relocations.
* A symbol in external relocations.
* A section is non-external relocations.

Have the dump reflect that. With this change we go from

CHECK-NEXT:       Extern: 0
CHECK-NEXT:       Type: X86_64_RELOC_SUBTRACTOR (5)
CHECK-NEXT:       Symbol: 0x2
CHECK-NEXT:       Scattered: 0

To just

// CHECK-NEXT:       Type: X86_64_RELOC_SUBTRACTOR (5)
// CHECK-NEXT:       Section: __data (2)

Since the relocation is with a section, we print the seciton name and don't
need to say that it is not scattered or external.

Someone motivated can add further special cases for things like
ARM64_RELOC_ADDEND and ARM_RELOC_PAIR.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240073 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-18 22:38:20 +00:00
Rafael Espindola
50cef0052f Pass --expand-relocs to a few more tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240069 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-18 22:12:47 +00:00
Simon Atanasyan
3bcfd461f6 [llvm-readobj] Print MIPS .reginfo section content
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239856 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-16 21:47:43 +00:00
Frederic Riss
37c67e6bb6 Have MachOObjectFile::isValidArch() accept armv7
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239833 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-16 17:37:03 +00:00
Rafael Espindola
99e760ad9e gold-plugin: save the .o when given -save-temps.
The plugin now save the bitcode before and after optimizations and the
.o that is passed to the linker.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239726 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-15 13:36:27 +00:00
Frederic Riss
c7968ac7b5 [dsymutil] Fix misspelled CHECK line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239200 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-05 23:46:18 +00:00
Frederic Riss
9ccf07fb89 [dsymutil] Add support for linking the debug_frame section.
Linking the debug frame section is actually very easy as we just have to
patch the start address in the FDE header and then copy the rest of the
FDE without even looking at it. The only small complexity comes from the
handling of the CIEs that we should unique across object file. This is
also really easy by using a StringMap keyed on the raw contents of the
CIE.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239198 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-05 23:06:11 +00:00
Frederic Riss
dfbf8971ca [dsymutil] Have the YAML deserialization rewrite the object address of symbols.
The main use of the YAML debug map format is for testing inside LLVM. If we have IR
files in the tests used to generate object files, then we obviously don't know the
addresses of the symbols inside the object files beforehand.

This change lets the YAML import lookup the addresses in the object files and rewrite
them. This will allow to have test that really don't need any binary input.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239189 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-05 21:12:07 +00:00
Frederic Riss
8a5883aabe [dsymutil] Handle the -oso-prepend-path option when the input is a YAML debug map
All the tests using a YAML debug map will need this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239163 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-05 16:35:44 +00:00
Alexey Samsonov
23fd513829 Fix buildbot failure on Windows by relaxing test expectations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239074 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 19:22:00 +00:00
Alexey Samsonov
1b77d22c66 llvm-objdump: return non-zero exit code for certain cases of invalid input
* If the input file is missing;
* If the type of input object file can't be recognized;
* If the object file can't be parsed correctly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239065 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 18:34:11 +00:00
Frederic Riss
696c93c900 Reapply r238941 - [dsymutil] Accept a YAML debug map as input instead of a binary.
With a couple more constructors that GCC thinks are necessary.

Original commit message:

[dsymutil] Accept a YAML debug map as input instead of a binary.

To do this, the user needs to pass the new -y flag.
As it wasn't tested before, the debug map YAML deserialization was
completely buggy (mainly because the DebugMapObject has a dual
mapping that allows to search by name and by address, but only the
StringMap got populated). It's fixed and tested in this commit by
augmenting some test with a 2 stage dwarf link: a frist llvm-dsymutil
reads the debug map and pipes it in a second instance that does the
actual link without touching the initial binary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238959 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 20:29:24 +00:00
Frederic Riss
57c68eeefe Revert "[dsymutil] Accept a YAML debug map as input instead of a binary."
This reverts commit r238941 while I figure out the bot issues.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238943 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 17:08:42 +00:00
Frederic Riss
001b032fea [dsymutil] Accept a YAML debug map as input instead of a binary.
To do this, the user needs to pass the new -y flag.
As it wasn't tested before, the debug map YAML deserialization was
completely buggy (mainly because the DebugMapObject has a dual
mapping that allows to search by name and by address, but only the
StringMap got populated). It's fixed and tested in this commit by
augmenting some test with a 2 stage dwarf link: a frist llvm-dsymutil
reads the debug map and pipes it in a second instance that does the
actual link without touching the initial binary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238941 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 16:57:16 +00:00
Frederic Riss
7745dac9d0 [dsymutil] Replace -parse-only option with -dump-debug-map
As the serialized debug map is becoming a first class citizen, a way
to cleanly dump it is required. We used -parse-only combined with
-v for that purpose before, but it dumps a lot of unrelated debug
stuff. Dumping the debug map was the only use of the -parse-only flag
anyway, so replace it with a more useful option.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238940 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 16:57:12 +00:00
Rafael Espindola
201a551929 Fix the interpretation of a 0 st_name.
The ELF spec is very clear:

-----------------------------------------------------------------------------
If the value is non-zero, it represents a string table index that gives the
symbol name. Otherwise, the symbol table entry has no name.
--------------------------------------------------------------------------

In particular, a st_name of 0 most certainly doesn't mean that the symbol has
the same name as the section.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238899 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 05:14:22 +00:00
Frederic Riss
786b471cc6 [dsymutil] Use YAMLIO to dump debug map.
Doing so will allow us to also accept a YAML debug map in input as using
YAMLIO gives us the parsing for free. Being able to have textual debug
maps will in turn allow much more control over the tests, because 1/
no need to check-in a binary containing the debug map and 2/ it will allow
to use the same objects/IR files with made-up debug-maps to test
different scenari.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238781 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 21:12:45 +00:00
Davide Italiano
a651b2236f Clarify how the binary file checked in was generated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238665 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-30 22:43:36 +00:00
Davide Italiano
41a6e6a698 [llvm-readobj/ELF] Teach how to decode DF_1_XXX flags
llvm-readobj -dynamic-table output.
Before:
0x000000006FFFFFFB unknown

After:
0x000000006FFFFFFB FLAGS_1 NOW ORIGIN

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238151 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-25 19:12:18 +00:00
Rafael Espindola
7b677dd986 Stop inventing symbol sizes.
MachO and COFF quite reasonably only define the size for common symbols.

We used to try to figure out the "size" by computing the gap from one symbol to
the next.

This would not be correct in general, since a part of a section can belong to no
visible symbol (padding, private globals).

It was also really expensive, since we would walk every symbol to find the size
of one.

If a caller really wants this, it can sort all the symbols once and get all the
gaps ("size") in O(n log n) instead of O(n^2).

On MachO this also has the advantage of centralizing all the checks for an
invalid n_sect.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238028 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 15:43:00 +00:00
Simon Atanasyan
975307cc50 [llvm-readobj] Teach llvm-readobj to print PT_MIPS_ABIFLAGS program header
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237451 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-15 15:59:22 +00:00
Justin Bogner
98f0f26fdf InstrProf: Fix display of large numbers in llvm-cov
llvm-cov was truncating numbers that were larger than a particular
fixed width, which is as confusing as it is useless. Instead, we use
engineering notation with SI prefix for magnitude.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237307 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-13 22:41:48 +00:00
Simon Atanasyan
ef7c2568fa [llvm-readobj] Print .MIPS.abiflags section content
This change adds new flag -mips-abi-flags to the llvm-readobj. This flag
forces printing of .MIPS.abiflags section content.

https://dmz-portal.mips.com/wiki/MIPS_O32_ABI_-_FR0_and_FR1_Interlinking#10.2.1._.MIPS.abiflags

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236737 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-07 15:40:35 +00:00
Justin Bogner
406a47c17f InstrProf: Give coverage its own errors instead of piggy backing on instrprof
Since the coverage mapping reader and the instrprof reader were
emitting a shared set of error codes, the error messages you'd get
back from llvm-cov were ambiguous about what was actually wrong. Add
another error category to fix this.

I've also improved the wording on a couple of the instrprof errors,
for consistency.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236665 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-06 23:19:35 +00:00
Zachary Turner
43afa42908 A few fixes for llvm-symbolizer on Windows.
Specifically, this patch correctly respects the -demangle option,
and additionally adds a hidden --relative-address option allows
input addresses to be relative to the module load address instead
of absolute addresses into the image.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236653 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-06 22:26:30 +00:00
Zachary Turner
7c69a58214 [llvm-pdbdump] Support dynamic load address and external symbols.
This patch adds the --load-address command line option to
llvm-pdbdump, which dumps all addresses assuming the module has
loaded at the specified address.

Additionally, this patch adds an option to llvm-pdbdump to support
dumping of public symbols (i.e. symbols with external linkage).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236342 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-01 20:24:26 +00:00
Kevin Enderby
28b8dea315 For llvm-objdump, with the -archive-headers and -macho options, use the -non-verbose
option to print the archive headers using raw numeric values.  Also add the -archive-member-offsets
for use with these to also trigger printing of the offset of the archive member from the start
of the archive.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236252 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-30 20:30:42 +00:00
Zachary Turner
7b8e8e5dc0 Make llvm-symbolizer work on Windows.
Differential Revision: http://reviews.llvm.org/D9234
Reviewed By: Alexey Samsonov

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235900 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-27 17:19:51 +00:00
Simon Atanasyan
23d47d346d [Mips] Support DT_MIPS_OPTIONS dynamic section tag in the llvm-readobj
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235285 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-20 05:34:48 +00:00
Kevin Enderby
4906c57876 For llvm-objdump, dump the (__OBJC,__protocol) section for Objc1 32-bit Mach-O files
with the -section option as objc_protocol_t structs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235141 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-16 22:33:20 +00:00
Kevin Enderby
6c14999401 For llvm-objdump added support for printing Objc1 32-bit runtime meta data
with the existing -objc-meta-data and -macho options for Mach-O files.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235119 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-16 17:19:59 +00:00
David Blaikie
2d35a46ea5 llvm-readobj: teach it to handle MachO Universal Archive correctly
Patch by Chilledheart (rwindz0@gmail.com).

Reviewed By: rafael

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234758 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-13 16:05:49 +00:00
Kevin Enderby
000ffacf53 Fix failure on builder llvm-clang-lld-x86_64-debian-fast as the
test macho-objc-meta-data.test had a line it shouldn't have had.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234190 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-06 18:18:23 +00:00
Kevin Enderby
2e8b39e549 For llvm-objdump added support for printing Objc2 32-bit runtime meta data
with the existing -objc-meta-data and -macho options for Mach-O files.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234185 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-06 17:47:03 +00:00
Kevin Enderby
95d8155b37 Add the option -objc-meta-data to llvm-objdump used with -macho to
print the Objective-C runtime meta data for Mach-O files.

There are three types of Objective-C runtime meta data, Objc2 64-bit,
Objc2 32-bit and Objc1 32-bit.  This prints the first of these types. The
changes to print the others will follow next.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233840 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-01 20:57:01 +00:00
Akira Hatanaka
0de206d8d6 [Objdump] Pass the correct subtarget to printInst.
This fixes a bug I introduced in r233411.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233484 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-28 20:44:05 +00:00
Adrian Prantl
1fa94d6f92 Add a -raw option to the -section mode of llvm-objdump.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233390 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-27 17:31:15 +00:00
Justin Bogner
b9e97c799e llvm-cov: Require a subcommand when invoked as llvm-cov
A while ago llvm-cov gained support for clang's instrumentation based
profiling in addition to its gcov support, and subcommands were added
to choose which behaviour to use. When no subcommand was specified, we
fell back to gcov compatibility with a warning that a subcommand would
be required in the future. Now, we require the subcommand.

Note that if the basename of llvm-cov is gcov (via symlink or
hardlink, for example), we still use the gcov compatible behaviour
with no subcommand required.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233132 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-24 23:34:36 +00:00
Frederic Riss
28b71b1917 [dsymutil] Temporarily disable some tests on windows.
It seems one windows bot fails since I added ilne table linking to
llvm-dsymutil (see r232333 commit thread).
Disable the affected tests until I can figure out what's happening.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233130 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-24 23:11:07 +00:00
Rafael Espindola
54ce82e497 Add -m -m elf_x86_64 to gold invocations.
Otherwise the tests would fail if the default was not elf_x86_64.

This fixes PR22966.

Patch by H.J. Lu!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233124 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-24 22:20:19 +00:00