670 Commits

Author SHA1 Message Date
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
Sam Clegg
edd76949f4 [WebAssembly] llvm-readobj: display symbols names in relocations
Differential Revision: https://reviews.llvm.org/D46296

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331279 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-01 16:35:16 +00:00
Adrian Prantl
0b24b74655 Remove @brief commands from doxygen comments, too.
This is a follow-up to r331272.

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

https://reviews.llvm.org/D46290

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331275 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-01 16:10:38 +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
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
db15975983 [WebAssembly] Write DWARF data into wasm object file
- Writes ".debug_XXX" into corresponding custom sections.
- Writes relocation records into "reloc.debug_XXX" sections.

Patch by Yury Delendik!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330982 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-26 19:27:28 +00:00
Rui Ueyama
0b9d56a30e Define InitLLVM to do common initialization all at once.
We have a few functions that virtually all command wants to run on
process startup/shutdown. This patch adds InitLLVM class to do that
all at once, so that we don't need to copy-n-paste boilerplate code
to each llvm command's main() function.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330046 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-13 18:26:06 +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
Zachary Turner
5ea14cb969 [llvm-pdbutil] Display types from MSVC precompiled header object files.
These appear in a .debug$P section, which is exactly the same in
format as a .debug$T section.  So we shouldn't ignore these when
dumping types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329326 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-05 18:18:12 +00:00
Mandeep Singh Grang
4ead3eb171 [tools] Change std::sort to llvm::sort in response to r327219
Summary:
r327219 added wrappers to std::sort which randomly shuffle the container before sorting.
This will help in uncovering non-determinism caused due to undefined sorting
order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of std::sort.

Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort.
Refer the comments section in D44363 for a list of all the required patches.

Reviewers: JDevlieghere, zturner, echristo, dberris, friss

Reviewed By: echristo

Subscribers: gbedwell, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328943 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-01 21:24:53 +00:00
Eric Christopher
a15b3af3d3 Typo fix: epilouge->epilogue. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328833 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-29 21:59:04 +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
Benjamin Kramer
d2ac73c164 [llvm-readobj] Make header self-contained
Patch by Dean Sturtevant!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327277 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-12 15:02:59 +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
Sam Clegg
e14b24839c [WebAssembly] Remove DataSize from linking metadata section
Neither the linker nor the runtime need this information
anymore.  We were originally using this to model BSS size
but the plan is now to use the segment metadata to allow
for BSS segments.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326267 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-27 23:57:37 +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
Hiroshi Inoue
1763be4373 [NFC] fix trivial typos in comments
"a a" -> "a"


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325752 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-22 07:48:29 +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
Reid Kleckner
57d82ee080 [LLD] Implement /guard:[no]longjmp
Summary:
This protects calls to longjmp from transferring control to arbitrary
program points. Instead, longjmp calls are limited to the set of
registered setjmp return addresses.

This also implements /guard:nolongjmp to allow users to link in object
files that call setjmp that weren't compiled with /guard:cf. In this
case, the linker will approximate the set of address taken functions,
but it will leave longjmp unprotected.

I used the following program to test, compiling it with different -guard
flags:
  $ cl -c t.c -guard:cf
  $ lld-link t.obj -guard:cf

  #include <setjmp.h>
  #include <stdio.h>
  jmp_buf buf;
  void g() {
    printf("before longjmp\n");
    fflush(stdout);
    longjmp(buf, 1);
  }
  void f() {
    if (setjmp(buf)) {
      printf("setjmp returned non-zero\n");
      return;
    }
    g();
  }
  int main() {
    f();
    printf("hello world\n");
  }

In particular, the program aborts when the code is compiled *without*
-guard:cf and linked with -guard:cf. That indicates that longjmps are
protected.

Reviewers: ruiu, inglorion, amccarth

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325047 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-13 20:32:53 +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
Reid Kleckner
a86bbf6148 [llvm-readobj] Fix double 0x prefix in RVA table printing after r321527
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323280 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-23 23:17:06 +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
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
Petr Hosek
fbe3e1c4cd [llvm-readobj] Support -needed-libs option for Mach-O files
This implements the -needed-libs option in Mach-O dumper.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321980 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-08 02:23:10 +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
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
Petr Hosek
c5ea695ee9 [llvm-readobj] Support -needed-libs option for COFF files
This implements the -needed-libs option in the COFF dumper.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321498 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-27 19:59:56 +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
Sam Clegg
44b9704555 [llvm-readobj] Dump wasm init functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321042 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-19 00:04:41 +00:00
Michael Zolotukhin
d770752b5c Remove redundant includes from tools.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320631 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-13 21:31:10 +00:00
Zachary Turner
7c192eec2f Teach llvm-pdbutil to dump types from object files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319859 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-05 23:58:18 +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
Zachary Turner
47856b25a7 Split TypeTableBuilder into two classes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319456 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-30 18:39:50 +00:00
Zachary Turner
69d3274f50 [llvm-readobj] Fix mismatched line endings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319453 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-30 18:33:34 +00:00
Zachary Turner
7fe0c00835 Make TypeTableBuilder inherit from TypeCollection.
A couple of places in LLD were passing references to
TypeTableCollections around, which makes it hard to change the
implementation at runtime.  However, these cases only needed to
iterate over the types in the collection, and TypeCollection
already provides a handy abstract interface for this purpose.

By implementing this interface, we can get rid of the need to
pass TypeTableBuilder references around, which should allow us
to swap the implementation at runtime in subsequent patches.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319345 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-29 19:35:21 +00:00
David Blaikie
a98c2a27eb Attempt to fix inscrutible build break...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318463 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-16 22:40:02 +00:00
David Blaikie
7e7cdf459f llvm-readobj/ARMEHABIPrinter.h: Make this a real/modular header
Had several non-inline/strong function definitions that needed to be
marked inline, etc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318461 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-16 22:30:36 +00:00