274 Commits

Author SHA1 Message Date
Luke Cheeseman
4c6cb9f427 Revert r343317
- asan buildbots are breaking and I need to investigate the issue



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343341 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-28 17:01:50 +00:00
Luke Cheeseman
96f82d5c18 Reapply changes reverted by r343235
- Add fix so that all code paths that create DWARFContext
  with an ObjectFile initialise the target architecture in the context
- Add an assert that the Arch is known in the Dwarf CallFrameString method



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343317 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-28 13:37:27 +00:00
Luke Cheeseman
4d42c19cd1 Revert r343192 as an ubsan build is currently failing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343235 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-27 16:47:30 +00:00
Luke Cheeseman
a26da93994 Reapply changes reverted in r343114, lldb patch to follow shortly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343192 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-27 10:39:20 +00:00
Luke Cheeseman
9f0b248da5 Revert r343112 as CallFrameString API change has broken lldb builds
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343114 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-26 14:48:03 +00:00
Luke Cheeseman
538d8c7d85 [AArch64] - Return address signing dwarf support
- Reapply r343089 with a fix for DebugInfo/Sparc/gnu-window-save.ll



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343112 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-26 14:30:29 +00:00
Hans Wennborg
21491992cf Revert r343089 "[AArch64] - Return address signing dwarf support"
This caused the DebugInfo/Sparc/gnu-window-save.ll test to fail.

> Functions that have signed return addresses need additional dwarf support:
> - After signing the LR, and before authenticating it, the LR register is in a
>   state the is unusable by a debugger or unwinder
> - To account for this a new directive, .cfi_negate_ra_state, is added
> - This directive says the signed state of the LR register has now changed,
>   i.e. unsigned -> signed or signed -> unsigned
> - This directive has the same CFA code as the SPARC directive GNU_window_save
>   (0x2d), adding a macro to account for multiply defined codes
> - This patch matches the gcc implementation of this support:
>   https://patchwork.ozlabs.org/patch/800271/
>
> Differential Revision: https://reviews.llvm.org/D50136

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343103 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-26 12:57:45 +00:00
Luke Cheeseman
e99f0eb61e [AArch64] - Return address signing dwarf support
Functions that have signed return addresses need additional dwarf support:
- After signing the LR, and before authenticating it, the LR register is in a
  state the is unusable by a debugger or unwinder
- To account for this a new directive, .cfi_negate_ra_state, is added
- This directive says the signed state of the LR register has now changed,
  i.e. unsigned -> signed or signed -> unsigned
- This directive has the same CFA code as the SPARC directive GNU_window_save
  (0x2d), adding a macro to account for multiply defined codes
- This patch matches the gcc implementation of this support:
  https://patchwork.ozlabs.org/patch/800271/

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343089 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-26 10:14:15 +00:00
Peter Collingbourne
3d6ae306d3 llvm-readobj: Simplify. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340305 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-21 17:18:18 +00:00
Paul Semel
cac968ea78 [llvm-readobj] Generic hex-dump option
Helpers are available to make this option file format independant. This
patch adds the feature for Wasm file format. It doesn't change the
behavior of the other file format handling.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337896 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-25 10:04:37 +00:00
George Rimar
efd8832ecb [llvm-readobj] - Do not report invalid amount of sections.
When output style is GNU and amount of sections is >= SHN_LORESERVE,
llvm-readobj reports zero number of sections instead of actual value.

The patch fixes that.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337462 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-19 14:52:57 +00:00
Paul Semel
9f006d32f1 [llvm-readobj] Generic -string-dump option
Differential Revision: https://reviews.llvm.org/D49470

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337408 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-18 18:00:41 +00:00
George Rimar
8b80d4ecc2 [llvm-readobj] - Teach tool to dump objects with >= SHN_LORESERVE of sections.
http://www.sco.com/developers/gabi/2003-12-17/ch4.eheader.html

says that e_shnum and/or e_shstrndx may have special values if
"the number of sections is greater than or equal to SHN_LORESERVE" or
"the section name string table section index is greater than or equal to SHN_LORESERVE (0xff00)"

Previously llvm-readobj was unable to dump such files, patch changes that.

I had to add a precompiled test case because it does not seem possible to
prepare a test using yaml2obj or llvm-mc (not clear how to make .shstrtab
to have index >= SHN_LORESERVE).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337360 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-18 08:19:58 +00:00
Peter Collingbourne
a29ff2e0f9 MC: Implement support for new .addrsig and .addrsig_sym directives.
Part of the address-significance tables proposal:
http://lists.llvm.org/pipermail/llvm-dev/2018-May/123514.html

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337328 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-17 22:17:18 +00:00
Sam Clegg
2a147a1507 [WebAssembly] Remove ELF file support.
This support was partial and temporary.  Now that we have
wasm object file support its no longer needed.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337222 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-16 23:09:29 +00:00
Paul Semel
94b0940142 [llvm-readobj] Add -hex-dump (-x) option
Differential Revision: https://reviews.llvm.org/D48281

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336782 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-11 10:00:29 +00:00
Paul Semel
2d07720488 Revert "[llvm-readobj] Fix printing format"
There is a problem with the formatting on windows build.
I need to investigate on this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336061 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-01 11:54:09 +00:00
Paul Semel
0de2000b2d [llvm-readobj] Fix printing format
We were printing every character, even those that weren't printable. It
doesn't really make sense for this option.

The string content was sticked to its address, added two spaces in
between.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336058 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-01 09:51:59 +00:00
Jake Ehrlich
eefdbb43aa [llvm-readobj] Add experimental support for SHT_RELR sections
This change adds experimental support for SHT_RELR sections, proposed
here: https://groups.google.com/forum/#!topic/generic-abi/bX460iggiKg

Definitions for the new ELF section type and dynamic array tags, as well
as the encoding used in the new section are all under discussion and are
subject to change. Use with caution!

Author: rahulchaudhry

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335922 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-28 21:07:34 +00:00
Paul Semel
064db4306c [llvm-readobj] Add -string-dump (-p) option
This option prints the section content as a string.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334834 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-15 14:15:02 +00:00
Peter Collingbourne
032b3051e3 llvm-readobj: fix printing number of relocations in Android packed format.
With '-elf-output-style=GNU -relocations', a header containing the number
of entries is printed before all the relocation entries in the section.
For Android packed format, we need to perform the unpacking first before
we can get the actual number of relocations in the section.

Patch by Rahul Chaudhry!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334147 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-07 00:02:07 +00:00
Alexander Ivchenko
2db6f82ea7 [llvm-readobj] Support GNU_PROPERTY_X86_FEATURE_1_AND notes in .note.gnu.property
Resubmit of r333424. This version contains the fix for fails found by buildbots
on some targets.

This patch allows parsing GNU_PROPERTY_X86_FEATURE_1_AND
notes in .note.gnu.property sections. These notes
indicate that the object file is built to support Intel CET.

patch by mike.dvoretsky

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333908 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-04 15:14:18 +00:00
Michael J. Spencer
56500c79d3 [MC] Add assembler support for .cg_profile.
Object FIle Representation
At codegen time this is emitted into the ELF file a pair of symbol indices and a weight. In assembly it looks like:

.cg_profile a, b, 32
.cg_profile freq, a, 11
.cg_profile freq, b, 20

When writing an ELF file these are put into a SHT_LLVM_CALL_GRAPH_PROFILE (0x6fff4c02) section as (uint32_t, uint32_t, uint64_t) tuples as (from symbol index, to symbol index, weight).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333823 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-02 16:33:01 +00:00
Galina Kistanova
80f62ff390 Reverted r333424 as it broke multiple build bots and left unfixed for a long time
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333578 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-30 18:51:08 +00:00
Alexander Ivchenko
980b901b1e [llvm-readobj] Support GNU_PROPERTY_X86_FEATURE_1_AND notes in .note.gnu.property
This patch allows parsing GNU_PROPERTY_X86_FEATURE_1_AND
notes in .note.gnu.property sections. These notes
indicate that the object file is built to support Intel CET.

patch by mike.dvoretsky

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333424 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-29 14:49:51 +00:00
Petar Jovanovic
6209d969a2 [mips] Add support for Global INValidate ASE
This includes

  Instructions: ginvi, ginvt,

  Assembler directives: .set ginv, .set noginv, .module ginv, .module noginv

  Attribute: ginv

  .MIPS.abiflags: GINV (0x20000)

Patch by Vladimir Stefanovic.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332624 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 16:30:32 +00:00
Adrian Prantl
26b584c691 Remove \brief commands from doxygen comments.
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.

Patch produced by

  for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331272 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-01 15:54:18 +00:00
Matt Arsenault
ac9b3ef76a AMDGPU: Add Vega12 and Vega20
Changes by
  Matt Arsenault
  Konstantin Zhuravlyov

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331215 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-30 19:08:16 +00:00
Sean Fertile
24b0700a49 Add PPC64_GLINK dynamic tag.
Add support for the PPC64_GLINK dynamic tag which is used in the ElfV2 abi.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330038 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-13 16:42:48 +00:00
Alexander Richardson
e132439ab2 Change DT_* value definitions to macros in a separate file
Summary:
I recently added a new dynamic tag to our fork of LLVM and when adding it
to llvm-readobj I noticed that not all DT_ values were being handled there.

Using macros in a .def file that can be included by both ELFDumper.cpp and
the ELF.h header ensures that the two don't get out of sync when new values
are added.

Reviewers: grimar, pcc, davide, espindola

Reviewed By: grimar, espindola

Subscribers: srhines, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328099 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-21 14:17:50 +00:00
George Rimar
a48ab92bca [llvm-readobj] - Teach llvm-readobj to dump .note.gnu.property sections.
NT_GNU_PROPERTY_TYPE_0 is a recently added type of .note.gnu.property
section specified in Linux Extensions to gABI.
(https://github.com/hjl-tools/linux-abi/wiki/Linux-Extensions-to-gABI)

Patch teach tool to print such notes properly.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328078 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-21 08:34:55 +00:00
Petar Jovanovic
cad9f50df3 [mips] Add support for CRC ASE
This includes

  Instructions: crc32b, crc32h, crc32w, crc32d,
                crc32cb, crc32ch, crc32cw, crc32cd

  Assembler directives: .set crc, .set nocrc, .module crc, .module nocrc

  Attribute: crc

  .MIPS.abiflags: CRC (0x8000)

Patch by Vladimir Stefanovic.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327511 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-14 14:13:31 +00:00
Alexander Shaposhnikov
304352277f [llvm-readobj] Extend the output of -elf-section-groups
This diff extends the output of -elf-section-groups 
(llvm style, gnu style is unchanged since it's meant to be 
compatible with binutils readelf) with sh_link and sh_info.
This change will enable us to use llvm-readobj -elf-section-groups 
for testing llvm-objcopy's support for .group sections.

Test plan: make check-all

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327341 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-12 22:40:09 +00:00
Scott Linder
29680d6d4f [llvm-readobj][ELF] Move ELF note parsing into libObject
Clean up the parsing of notes in llvm-readobj, improve bounds checking, and
allow the parsing code to be reused.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327320 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-12 19:28:50 +00:00
Rafael Auler
ed6b821cce Reland "[DebugInfo] Support DWARF expressions in eh_frame"
Summary:
Original change was D43313 (r326932) and reverted by r326953 because it
broke an LLD test and a windows build. The LLD test was already fixed in
lld commit r326944 (thanks maskray). This is the original change with
the windows build fixed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326970 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-08 00:46:53 +00:00
Rui Ueyama
4d09eef8ec Revert r326932: [DebugInfo] Support DWARF expressions in eh_frame
This reverts commit rr326932 because it broke lld/test/ELF/eh-frame-hdr-augmentation.s.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326953 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-07 22:29:48 +00:00
Rafael Auler
44f97b98b6 [DebugInfo] Support DWARF expressions in eh_frame
This patch enhances DWARFDebugFrame with the capability of parsing and
printing DWARF expressions in CFI instructions. It also makes FDEs and
CIEs accessible to lib users, so they can process them in client tools
that rely on LLVM. To make it self-contained with a test case, it
teaches llvm-readobj to be able to dump EH frames and checks they are
correct in a unit test. The llvm-readobj code is Maksim Panchenko's work
(maksfb).

Reviewers: JDevlieghere, espindola

Reviewed By: JDevlieghere

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326932 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-07 19:19:51 +00:00
Konstantin Zhuravlyov
16290892d3 AMDGPU: Bring elf flags in sync with the spec
- Add MACH flags
- Add XNACK flag
- Add reserved flags
- Minor cleanups in docs

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325399 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-16 22:33:59 +00:00
Saleem Abdulrasool
e7676fec11 CodeGen: support an extension to pass linker options on ELF
Introduce an extension to support passing linker options to the linker.
These would be ignored by older linkers, but newer linkers which support
this feature would be able to process the linker.

Emit a special discarded section `.linker-option`.  The content of this
section is a pair of strings (key, value).  The key is a type identifier for
the parameter.  This allows for an argument free parameter that will be
processed by the linker with the value being the parameter.  As an example,
`lib` identifies a library to be linked against, traditionally the `-l`
argument for Unix-based linkers with the parameter being the library name.

Thanks to James Henderson, Cary Coutant, Rafael Espinolda, Sean Silva
for the valuable discussion on the design of this feature.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323783 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-30 16:29:29 +00:00
Rui Ueyama
5a286a0041 Instead of ELFFile<ELFT>::Type, use ELFT::Type. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322346 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-12 02:28:31 +00:00
Rui Ueyama
0a75940cb9 Use ELF{32,64}{LE,BE} instead of ELFType<{little,big}, {true,false}>. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322342 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-12 01:40:32 +00:00
Sam Clegg
52483265a5 [llvm-readobj] Consistent use of ScopedPrinter
There were a few places where outs() was being used
directly rather than the ScopedPrinter object.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322141 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-10 00:14:19 +00:00
Benjamin Kramer
ca5092a11a Avoid int to string conversion in Twine or raw_ostream contexts.
Some output changes from uppercase hex to lowercase hex, no other functionality change intended.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321526 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-28 16:58:54 +00:00
Simon Atanasyan
f725c23e23 [llvm-readobj] Fix ambiguous call to the printNumber
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321254 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-21 10:46:20 +00:00
Simon Atanasyan
6572bcdb88 [llvm-readobj] Support 'GNU' style for MIPS GOT/PLT dumping
This change adds `printMipsGOT` and `printMipsPLT` methods to the
`DumpStyle` class and overrides them in the `GNUStyle` and `LLVMStyle`
descendants. To pass information about GOT/PLT layout into these
methods, the `MipsGOTParser` class has been extended to hold all
necessary data.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321253 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-21 10:26:02 +00:00
Simon Atanasyan
649eb90a70 [llvm-readobj] Remove redundant local variables to reduce the code. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319617 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-02 13:06:40 +00:00
Simon Atanasyan
0eba9bcf82 [llvm-readobj] Print static MIPS GOT
If a linked binary file contains a dynamic section, the GOT layout
defined by the dynamic section entries. In a statically linked file
the GOT is just a series of entries. This change teaches `llvm-readobj`
to print the GOT in that case. That provides a feature parity with GNU
`readelf`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319616 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-02 13:06:35 +00:00
Simon Atanasyan
2a502f2ce1 [llvm-readobj] Delete unused method argument. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319615 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-02 13:06:27 +00:00
Dave Lee
9c5b799781 Add ELF dynamic symbol support to yaml2obj/obj2yaml
Summary:
This change introduces a `DynamicSymbols` field to the ELF specific YAML
supported by `yaml2obj` and `obj2yaml`. This grouping of symbols provides a way
to represent ELF dynamic symbols. The `DynamicSymbols` structure is identical to
the existing `Symbols`.

Reviewers: compnerd, jakehehrlich, silvas

Reviewed By: silvas

Subscribers: silvas, jakehehrlich, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318433 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-16 18:10:15 +00:00
Peter Collingbourne
15227dba51 Inline compareAddr function into its only caller. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317045 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-31 22:49:09 +00:00