329 Commits

Author SHA1 Message Date
Nico Weber
f072f08e15 Make malformed-machos.test pass on my Mac.
For some reason, llvm-objdump defaults to -arch=i386 on this system while
the test checks x86_64 output. Explicitly pass -arch=x86_64.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341944 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-11 14:10:33 +00:00
Francis Visoiu Mistrih
fe2c6872d7 [MachO] Fix inconsistency between error messages when validating LC_DYSYMTAB
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341379 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-04 16:31:53 +00:00
Francis Visoiu Mistrih
e6cfed9796 [MachO] Fix LC_DYSYMTAB validation for external symbols
We were validating the same index (ilocalsym) twice, while iextdefsym
was never validated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341378 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-04 16:31:48 +00:00
Francis Visoiu Mistrih
73e2113025 [llvm-objdump] Keep the memory buffer from the dSYM alive when using -g -dsym
When using -g and -dsym, llvm-objdump opens the dsym file and keeps the
MachOObjectFile alive, while the memory buffer that the MachOObjectFile
was based on gets destroyed.

Differential Revision: https://reviews.llvm.org/D51365

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341209 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-31 13:10:54 +00:00
Matt Arsenault
7e212e4168 AMDGPU: Remove remnants of old address space mapping
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341165 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-31 05:49:54 +00:00
Joel Galenson
e47abe7961 [llvm-objdump] Label calls to the PLT.
Differential Revision: https://reviews.llvm.org/D50204

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340611 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-24 15:21:57 +00:00
Zachary Turner
c04ae04bb3 [llvm-objdump] Add ability to demangle COFF symbols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340221 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-20 22:18:21 +00:00
Dave Lee
58b1de483d objdump: Better handling of Mach-O universal binaries
Summary:
With Mach-O, there is a flag requirement discrepancy between working with
universal binaries and thin binaries. Many flags that don't require the `-macho`
flag (for example `-private-headers` and `-disassemble`) fail to work on
universal binaries unless `-macho` is given. When this happens, the error
message is unhelpful, stating:

    The file was not recognized as a valid object file.

Which can lead to confusion.

This change allows generic flags to be used on universal binaries with and
without the `-macho` flag. This means flags that can be used for thin files can
be used consistently with fat files too.

To do this, the universal binary support within `ParseInputMachO()` is extracted
into a new function. This new function is called directly from `DumpInput()`
when the input binary is universal. Additionally the `-arch` flag validation in
`ParseInputMachO()` was extracted to be reused.

Reviewers: compnerd

Reviewed By: compnerd

Subscribers: keith, llvm-commits

Differential Revision: https://reviews.llvm.org/D48702

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338792 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-03 00:06:38 +00:00
Paul Semel
05d358bad5 [llvm-objdump] Add dynamic section printing to private-headers option
Differential Revision: https://reviews.llvm.org/D49016

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337902 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-25 11:09:20 +00:00
Paul Semel
baea3f0500 [llvm-objdump] Add -demangle (-C) option
Differential Revision: https://reviews.llvm.org/D49043

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337401 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-18 16:39:21 +00:00
George Rimar
10c3b3d15e [llvm-objdump] - Stop reporting bogus section IDs.
Imagine we have a file with few sections, and one of them is .foo
with index N != 0.

Problem is that when llvm-objdump is given a -section=.foo parameter
it lists .foo as a section at index 0. That makes impossible to write
test cases which needs to find the index of the particular section,
while ignoring dumping of others.

The patch fixes that.

Differential revision: https://reviews.llvm.org/D49372

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337361 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-18 08:34:35 +00:00
Paul Semel
31b21da155 Revert "[llvm-objdump] Add -demangle (-C) option"
This reverts commit 3a44ccd156e0edd2e89226f8ed63928e227900bb.
This reverts commit d5cfc836bb5552e20507d3612d13ff66ff9e36a0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336829 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-11 18:09:52 +00:00
Paul Semel
d5cfc836bb Fix llvm-objdump demangle test (added triple option)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336821 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-11 16:31:33 +00:00
Paul Semel
3a44ccd156 [llvm-objdump] Add -demangle (-C) option
Differential Revision: https://reviews.llvm.org/D49043

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336816 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-11 15:25:39 +00:00
Dave Lee
145133c348 Reapply: "objdump: Support newer ObjC image info flags"
Summary:
Add support for two additional ObjC image info flags: `IS_SIMULATED` and
`HAS_CATEGORY_CLASS_PROPERTIES`.

`IS_SIMULATED` indicates a Mach-O binary built for iOS simulator.

`HAS_CATEGORY_CLASS_PROPERTIES` indicates a Mach-O binary built by a compiler
that supports class properties in categories.

Reviewers: enderby, compnerd

Reviewed By: compnerd

Subscribers: keith, llvm-commits

Differential Revision: https://reviews.llvm.org/D48568

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336411 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-06 05:11:35 +00:00
Dave Lee
d20537eca5 Revert "objdump: Support newer ObjC image info flags"
This reverts commit 8c4cc472e7a67bd3b2b20cc4cf32d31af29bc7e9.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336402 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-06 00:13:21 +00:00
Dave Lee
8c4cc472e7 objdump: Support newer ObjC image info flags
Summary:
Add support for two additional ObjC image info flags: `IS_SIMULATED` and
`HAS_CATEGORY_CLASS_PROPERTIES`.

`IS_SIMULATED` indicates a Mach-O binary built for iOS simulator.

`HAS_CATEGORY_CLASS_PROPERTIES` indicates a Mach-O binary built by a compiler
that supports class properties in categories.

Reviewers: enderby, compnerd

Reviewed By: compnerd

Subscribers: keith, llvm-commits

Differential Revision: https://reviews.llvm.org/D48568

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336399 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 23:32:15 +00:00
Paul Semel
5ccd8badb1 [llvm-objdump] Removed archive-headers-disas test
This test is failing because of the disas part.
For the moment, I will juste remove it. I will add it again tomorrow
with a proper fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336370 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 16:49:46 +00:00
Paul Semel
78a28ad3b8 [llvm-objcopy] Fix timezone dependant tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336363 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 15:24:11 +00:00
Paul Semel
fd46678873 [llvm-objdump] Add --archive-headers (-a) option
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336357 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 14:43:29 +00:00
Paul Semel
d069a21e54 [llvm-objdump] Add --file-headers (-f) option
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336284 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-04 15:25:03 +00:00
Sterling Augustine
c1d6c4ab99 Require x86 for this test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335939 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-28 23:22:14 +00:00
Sterling Augustine
7540b28963 Some targets don't have lld built, so just use a binary copy
of the input file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335908 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-28 19:47:23 +00:00
Sterling Augustine
3605e121fb Handle absolute symbols as branch targets in disassembly.
https://reviews.llvm.org/D48554



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335903 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-28 18:57:13 +00:00
Tim Northover
67ad29ab38 ARM: add binary file git swallowed.
Should fix bots.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335596 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 12:28:47 +00:00
Tim Northover
43f589a4df ARM: diagnose unpredictable IT instructions
IT instructions are allowed to have the 'AL' predicate, but it must never
result in an 'NV' predicated instruction. Essentially this means that all
branches must be 't' rather than 'e' if the predicate is 'AL'.

This patch adds a diagnostic for this during assembly (error because parsing
hits an assertion if allowed to continue) and an annotation during disassembly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335593 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 11:38:41 +00:00
Vedant Kumar
f1fc2a32d7 [SelectionDAG] Remove debug locations from ConstantSD(FP)Nodes
This removes debug locations from ConstantSDNode and ConstantSDFPNode.

When this kind of node is materialized we no longer create a line table
entry which jumps back to the constant's first point of use. This makes
single-stepping behavior smoother, and it matches the model used by IR,
where Constants have no locations. See this thread for more context:

  http://lists.llvm.org/pipermail/llvm-dev/2018-June/124164.html

I'd like to handle constant BuildVectorSDNodes and to try to eliminate
passing SDLocs to SelectionDAG::getConstant*() in follow-up commits.

Differential Revision: https://reviews.llvm.org/D48468

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335497 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-25 17:06:18 +00:00
Sam Clegg
8d1235ff26 [WebAsembly] Update default triple in test files to wasm32-unknown-unkown.
Summary: The final -wasm component has been the default for some time now.

Subscribers: jfb, dschuff, jgravelle-google, eraman, aheejin, JDevlieghere, sunfish, llvm-commits

Differential Revision: https://reviews.llvm.org/D46342

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332007 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-10 17:49:11 +00:00
Shiva Chen
a8a13bc662 [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
In order to set breakpoints on labels and list source code around
labels, we need collect debug information for labels, i.e., label
name, the function label belong, line number in the file, and the
address label located. In order to keep these information in LLVM
IR and to allow backend to generate debug information correctly.
We create a new kind of metadata for labels, DILabel. The format
of DILabel is

!DILabel(scope: !1, name: "foo", file: !2, line: 3)

We hope to keep debug information as much as possible even the
code is optimized. So, we create a new kind of intrinsic for label
metadata to avoid the metadata is eliminated with basic block.
The intrinsic will keep existing if we keep it from optimized out.
The format of the intrinsic is

llvm.dbg.label(metadata !1)

It has only one argument, that is the DILabel metadata. The
intrinsic will follow the label immediately. Backend could get the
label metadata through the intrinsic's parameter.

We also create DIBuilder API for labels to be used by Frontend.
Frontend could use createLabel() to allocate DILabel objects, and use
insertLabel() to insert llvm.dbg.label intrinsic in LLVM IR.

Differential Revision: https://reviews.llvm.org/D45024

Patch by Hsiangkai Wang.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331841 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-09 02:40:45 +00:00
Sam Clegg
4f72fc1174 typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331006 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-27 00:17:24 +00:00
Sam Clegg
bfeca0b120 [WebAssembly] Section symbols must have local binding
Summary: Also test for symbols information in test/MC/WebAssembly/debug-info.ll.

Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, JDevlieghere, llvm-commits

Differential Revision: https://reviews.llvm.org/D46160

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331005 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-27 00:17:21 +00:00
Sam Clegg
14598cb5be [WebAssembly] Add version to object file metadata
Summary: See https://github.com/WebAssembly/tool-conventions/issues/54

Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, llvm-commits

Differential Revision: https://reviews.llvm.org/D46069

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330969 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-26 18:15:32 +00:00
Sam Clegg
cc3b83d8d1 [WebAssembly] objdump: Don't assume all relocations have symbols
Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, llvm-commits

Differential Revision: https://reviews.llvm.org/D46134

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330959 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-26 17:05:04 +00:00
Sam Clegg
588fa1cad7 [WebAssembly] Implement getRelocationValueString()
And use it in llvm-objdump.

Differential Revision: https://reviews.llvm.org/D46092

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330957 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-26 16:41:51 +00:00
Sam Clegg
194a4e0c23 [WebAssembly] Use section index in relocation section header
Rather than referring to sections my their code, use the
absolute index of the target section within the module.

See https://github.com/WebAssembly/tool-conventions/issues/52

Differential Revision: https://reviews.llvm.org/D45980

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330749 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-24 18:11:36 +00:00
Francis Visoiu Mistrih
b7f081acd6 [llvm-objdump] Remove test object file
Forgot to remove it from the previous commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330343 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-19 17:05:03 +00:00
Francis Visoiu Mistrih
7effcbd254 [llvm-objdump] Print "..." instead of random data for virtual sections
When disassembling with -D, skip virtual sections by printing "..." for
each symbol.

This patch also implements `MachOObjectFile::isSectionVirtual`.

Test case comes from:

```
.zerofill __DATA,__common,_data64unsigned,472,3
```

Differential Revision: https://reviews.llvm.org/D45824

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330342 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-19 17:02:57 +00:00
Sam Clegg
b068ce98cd [WebAssembly] libObject: Don't include the name the size of custom sections
Differential Revision: https://reviews.llvm.org/D45579

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329947 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-12 20:31:12 +00:00
Rafael Auler
1560bf0343 [AArch64] Decorate AArch64 instrs with OPERAND_PCREL
Summary:
This is a canonical way to teach objdump to print the target
symbols for branches when disassembling AArch64 code.

Reviewers: evandro, t.p.northover, espindola

Reviewed By: t.p.northover

Differential Revision: https://reviews.llvm.org/D44851

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328638 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-27 16:58:01 +00:00
Kevin Enderby
a17a5fa0b6 For llvm-objdump and Mach-O files, fix the printing of module init and
term sections from .o files to look to see if the pointers have a relocation
entry and if so print the symbol name from the relocation entry.  If not fall
back to the existing code and use the pointer value to look up that value
in the symbol table.

rdar://38337506


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328037 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-20 20:29:52 +00:00
Rafael Auler
67fe7958c8 [llvm-objdump] Support disassembling by symbol name
Summary:
Add a new option -df to llvm-objdump that takes function names
as arguments and instructs the disassembler to only dump those function
contents. Based on code originally written by Bill Nell.

Reviewers: espindola, JDevlieghere

Differential Revision: https://reviews.llvm.org/D44224

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327164 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-09 19:13:44 +00:00
Nicholas Wilson
022e5fa26f [WebAssembly] Reorder reloc sections to come between symtab and name
This is required in order to enable relocs to be validated
as they are read in.

Also update tests with new section ordering.

Differential Revision: https://reviews.llvm.org/D43940

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326694 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-05 12:59:03 +00:00
Nicholas Wilson
2d7eccead1 [WebAssembly] Update pre-generated test files to match latest llc output. NFC.
The ordering of llc's output was changed in rL326334.

Differential Revision: https://reviews.llvm.org/D43941

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326445 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-01 15:55:59 +00:00
Scott Linder
29d038b31c [DebugInfo] Fix buildbot failure on non-X86 targets
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326035 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-24 16:25:43 +00:00
Scott Linder
2ed4ddeb74 [DebugInfo] Add remaining files to r325970
Add files which I missed in the original check-in


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325973 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-23 23:13:18 +00:00
Sam Clegg
d5784797c6 [WebAssembly] Add first claass symbol table to wasm objects
This is combination of two patches by Nicholas Wilson:
  1. https://reviews.llvm.org/D41954
  2. https://reviews.llvm.org/D42495

Along with a few local modifications:
- One change I made was to add the UNDEFINED bit to the binary format
  to avoid the extra byte used when writing data symbols.  Although this
  bit is redundant for other symbols types (i.e. undefined can be
  implied if a function or global is a wasm import)
- I prefer to be explicit and consistent and not have derived flags.
- Some field renaming.
- Some reverting of unrelated minor changes.
- No test output differences.

Differential Revision: https://reviews.llvm.org/D43147

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325860 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-23 05:08:34 +00:00
Konstantin Zhuravlyov
4bf0aa0c17 AMDGPU: Bring processors and features in sync with the spec
- Remove gfx800
- Make iceland gfx802
- Add xnack to gfx902

Differential Revision: https://reviews.llvm.org/D43355


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325393 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-16 21:26:25 +00:00
Sam Clegg
b39f411576 [WebAssebmly] Report undefined symbols correctly in objdump
Peviously we were reporting undefined symbol as being defined
by the IMPORT sections.

This change reports undefined symbols in the same that other
formats do, and also removes the need to store the section
with each symbol (since it can be derived from the symbol
type).

Differential Revision: https://reviews.llvm.org/D43101

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324770 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-09 20:21:50 +00:00
Sam Clegg
eb7fd730fa [WebAssembly] Remove debug names from symbol table
Get rid of DEBUG_FUNCTION_NAME symbols. When we actually debug
data, maybe we'll want somewhere to put it... but having a symbol
that just stores the name of another symbol seems odd.
It means you have multiple Symbols with the same name, one
containing the actual function and another containing the name!

Store the names in a vector on the WasmObjectFile when reading
them in. Also stash them on the WasmFunctions themselves.
The names are //not// "symbol names" or aliases or anything,
they're just the name that a debugger should show against the
function body itself. NB. The WasmObjectFile stores them so that
they can be exported in the YAML losslessly, and hence the tests
can be precise.

Enforce that the CODE section has been read in before reading
the "names" section. Requires minor adjustment to some tests.

Patch by Nicholas Wilson!

Differential Revision: https://reviews.llvm.org/D42075

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322741 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-17 19:28:43 +00:00
Benjamin Kramer
8e02a4b93a Fix tests after move to utohexstr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321527 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-28 17:00:37 +00:00