Commit Graph

3477 Commits

Author SHA1 Message Date
Konstantin Zhuravlyov
0c79d1f4e0 Distinguish between code pointer size and DataLayout::getPointerSize() in DWARF info generation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300463 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 17:41:25 +00:00
Andrew V. Tischenko
3796561c6e This patch closes PR#32216: Better testing of schedule model instruction latencies/throughputs.
The details are here: https://reviews.llvm.org/D30941


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300311 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-14 07:44:23 +00:00
Peter Collingbourne
b06c394fe3 MC: Remove unused virtual function MCObjectWriter::isWeak. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299817 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-08 23:35:49 +00:00
Coby Tayree
b28be420c0 [AsmParser]Emit an error if a macro has two (or more) parameters sharing the same name
Introducing a new error to macro parameters' parsing:
currently, llvm-mc won't complain if a macro have two (or more) named params with the same name.
this behavior is false, as there's no merit in having some params sharing a name.
now, instead of tolerate such a phenomena - emit an appropriate error.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299815 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-08 20:29:03 +00:00
Peter Collingbourne
ce637fef4f StringTableBuilder: Don't assert when writing an empty raw string table.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299602 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-06 00:10:17 +00:00
Alex Bradbury
ff1254b6f8 Add MCContext argument to MCAsmBackend::applyFixup for error reporting
A number of backends (AArch64, MIPS, ARM) have been using
MCContext::reportError to report issues such as out-of-range fixup values in
their TgtAsmBackend. This is great, but because MCContext couldn't easily be
threaded through to the adjustFixupValue helper function from its usual
callsite (applyFixup), these backends ended up adding an MCContext* argument
and adding another call to applyFixup to processFixupValue. Adding an
MCContext parameter to applyFixup makes this unnecessary, and even better -
applyFixup can take a reference to MCContext rather than a potentially null
pointer.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299529 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-05 10:16:14 +00:00
Petr Hosek
802fcd9c3e [MC] Set defaults based on section names and support name suffixes
Set correct default flags and section type based on its name for .text,
.data, .bss, .init_array, .fini_array, .preinit_array, .tdata, and .tbss
and support section name suffixes for .data.*, .rodata.*, .text.*,
.bss.*, .tdata.* and .tbss.* which matches the behavior of GAS.

Fixes PR31888.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299484 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-04 23:32:45 +00:00
Evgeniy Stepanov
8719ab145a Change section flag character for SHF_LINK_ORDER to "o".
GAS uses "m" as a compatibility alias for "M" (SHF_MERGE).

"o" is free, except on ia64, where it already means SHF_LINK_ORDER.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299479 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-04 22:35:08 +00:00
Coby Tayree
983e1a1b99 [X86][inline-asm] Add support for MS 'EVEN' directive
MS assembly syntax provide us with the 'EVEN' directive as a synonymous to at&t '.even'.
This patch include the (small, simple) changes need to allow it.

Test is provided at the following (clang-side) review:
https://reviews.llvm.org/D27418

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299453 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-04 17:57:23 +00:00
Weiming Zhao
c4d3801c20 Reland r298901 with modifications (reverted in r298932)
Dont emit Mapping symbols for sections that contain only data.

Summary:
Dont emit mapping symbols for sections that contain only data.

Reviewers: rengolin, weimingz, kparzysz, t.p.northover, peter.smith

Reviewed By: t.p.northover

Patched by Shankar Easwaran <shankare@codeaurora.org>

Subscribers: alekseyshl, t.p.northover, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299392 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-03 21:50:04 +00:00
Simon Pilgrim
347f8943df Fix signed/unsigned warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299194 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 10:45:35 +00:00
Dan Gohman
546a4623a5 [WebAssembly] Initial linking metadata support
Add support for the new relocations and linking metadata section support in
https://github.com/WebAssembly/tool-conventions/blob/master/Linking.md. In
particular, this allows LLVM to indicate which variable is the stack pointer,
so that it can be linked with other objects.

This also adds support for emitting type relocations for call_indirect
instructions.

Right now, this is mainly tested by using wabt and hexdump to examine the
output on selected testcases. We'll add more tests as the design stablizes
and more of the pieces are in place.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299141 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-30 23:58:19 +00:00
Weiming Zhao
13bfce64bc Revert "Dont emit Mapping symbols for sections that contain only data."
It breaks some lld tests.

This reverts commit 3a50eea6d9.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298932 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-28 17:15:11 +00:00
Weiming Zhao
3a50eea6d9 Dont emit Mapping symbols for sections that contain only data.
Summary:
Dont emit mapping symbols for sections that contain only data.

Patched by Shankar Easwaran <shankare@codeaurora.org>

Reviewers: rengolin, peter.smith, weimingz, kparzysz, t.p.northover

Reviewed By: t.p.northover

Subscribers: t.p.northover, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298901 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-28 05:40:36 +00:00
Derek Schuff
cdcf70c249 [WebAssembly] Fix import type to be signed LEBs
This fix is a follow up a previous change with stored
value types as signed integers in memory.

In future, once the yaml<->wasm binary patche lands we
can add test coverage for this kind of thing.

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

Patch by Sam Clegg

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298612 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-23 15:46:47 +00:00
Rafael Espindola
30582488b0 Add default typo to .tbss.*
This matches gas behavior and is part of pr31888.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298508 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 14:04:19 +00:00
Rafael Espindola
e67048abe7 Set the default type for .bss.foo.
This matches gas and is part of pr31888.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298506 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 13:57:16 +00:00
Rafael Espindola
354d23526f Produce INIT_ARRAY for sections named .init_array.*
These sections are merged together by the linker, so they should have
the same time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298505 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 13:35:41 +00:00
Oliver Stannard
78f26e7210 [Asm] Don't list '@<type>' in diag when '@' is a comment
This fixes https://bugs.llvm.org//show_bug.cgi?id=31280

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298067 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17 11:10:17 +00:00
Derek Schuff
d289ddded8 [WebAssembly] Fix some broken type encodings in wasm binary
A recent change switch the in-memory wasm value types
to be signed integers, but I missing a few cases where
these were being writing to the binary.

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

Patch by Sam Clegg

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297991 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-16 20:49:48 +00:00
David Blaikie
bd97f5e153 Check that line table entries don't spill over between sections even if they're empty at the end of a section
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297922 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-16 00:52:18 +00:00
David Blaikie
1e54c56c2f Simplify/make more explicit (by making less explicit in some ways) some function calls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297921 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-16 00:43:19 +00:00
Derek Schuff
f04cbf365e [WebAssembly] Update format of 'names' section.
This change updates to the format of the 'names' sectionin the
generated wasm binary to match the latest changesto the design
and 'wabt'.

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

Patch by Sam Clegg

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297877 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 19:36:02 +00:00
Derek Schuff
25754c1409 [WebAssembly] Use LEB encoding for value types
Previously we were using the encoded LEB hex values
for the value types.  This change uses the decoded
negative value and the LEB encoder to write them out.

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

Patch by Sam Clegg

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297777 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 20:23:22 +00:00
Evgeniy Stepanov
c67a9ef0ea Fix asm printing of associated sections.
Make MCSectionELF::AssociatedSection be a link to a symbol, because
that's how it works in the assembly, and use it in the asm printer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297769 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 19:28:51 +00:00
Sanne Wouda
9f316a5fb6 [Assembler] Add location info to unary expressions.
Summary:
This is a continuation of D28861.  Add an SMLoc to MCUnaryExpr such that
a better diagnostic can be given in case of an error in later stages of
assembling.

Reviewers: rengolin, grosbach, javed.absar, olista01

Reviewed By: olista01

Subscribers: llvm-commits

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297454 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-10 13:08:20 +00:00
Simon Atanasyan
b479d37bbc [MC] Set SHT_MIPS_DWARF section type for all .debug_* sections on MIPS
All MIPS .debug_* sections should be marked with ELF type SHT_MIPS_DWARF
accordingly the specification [1]. Also the same section type is assigned
to these sections by GNU tools.

[1] ftp.software.ibm.com/software/os390/czos/dwarf/mips_extensions.pdf

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297447 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-10 08:22:20 +00:00
Simon Atanasyan
d1a4b1d64a [MC] Accept a numeric value as an ELF section header's type
GAS supports specification of section header's type using a numeric
value [1]. This patch brings the same functionality to LLVM. That allows
to setup some target-specific section types belong to the SHT_LOPROC -
SHT_HIPROC range. If we attempt to print unknown section type, MCSectionELF
class shows an error message. It's better than print sole '@' sign
without any section type name.

In case of MIPS, example of such section's type is SHT_MIPS_DWARF.
Without the patch we will have to implement some workarounds
in probably not-MIPS-specific part of code base to convert SHT_MIPS_DWARF
to the @progbits while printing assembly and to assign SHT_MIPS_DWARF for
@progbits sections named .debug_* if we encounter such section in
an input assembly.

[1] https://sourceware.org/binutils/docs/as/Section.html

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297446 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-10 08:22:13 +00:00
Teresa Johnson
611bafa4c4 Perform symbol binding for .symver versioned symbols
Summary:
In a .symver assembler directive like:
.symver name, name2@@nodename
"name2@@nodename" should get the same symbol binding as "name".

While the ELF object writer is updating the symbol binding for .symver
aliases before emitting the object file, not doing so when the module
inline assembly is handled by the RecordStreamer is causing the wrong
behavior in *LTO mode.

E.g. when "name" is global, "name2@@nodename" must also be marked as
global. Otherwise, the symbol is skipped when iterating over the LTO
InputFile symbols (InputFile::Symbol::shouldSkip). So, for example,
when performing any *LTO via the gold-plugin, the versioned symbol
definition is not recorded by the plugin and passed back to the
linker. If the object was in an archive, and there were no other symbols
needed from that object, the object would not be included in the final
link and references to the versioned symbol are undefined.

The llvm-lto2 tests added will give an error about an unused symbol
resolution without the fix.

Reviewers: rafael, pcc

Reviewed By: pcc

Subscribers: mehdi_amini, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297332 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-09 00:19:49 +00:00
Vassil Vassilev
e9a37beafd Silence a warning "hiding virtual function".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297018 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-06 15:50:59 +00:00
Peter Collingbourne
6387bdabf7 MC: De-duplicate the object streamer implementations of EmitFileDirective into MCObjectStreamer. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296912 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-03 21:22:06 +00:00
Paul Robinson
28ca8c3c86 [DWARFv5] llvm-mc support for new unit header.
This is for running the assembler with -g (to emit DWARF describing
the assembler source).

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296541 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 23:40:46 +00:00
Dan Gohman
4b87fbfe6e [MC] Implement the COFF directives in MCNullStreamer.
This fixes -filetype=null errors introduced in r296403.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296410 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 23:10:18 +00:00
Dan Gohman
d5cb2d625b [MC] Factor out non-COFF handling of COFF-specific directives.
Instead of requiring every non-COFF MCObjectStreamer to implement the
COFF hooks just to do an llvm_unreachable to say that they're not
supported, do the llvm_unreachable in the default implementation, as
suggested by rnk in https://reviews.llvm.org/D26722.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296403 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 22:44:37 +00:00
Dan Gohman
6d8f20c219 [WebAssembly] Add some comments and tidy up whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296402 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 22:41:39 +00:00
Dan Gohman
8f5a7d69cc [WebAssembly] Add support for using a wasm global for the stack pointer.
This replaces the __stack_pointer variable which was allocated in linear
memory.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296201 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-24 23:46:05 +00:00
Dan Gohman
53ff96ab08 [WebAssembly] Basic support for Wasm object file encoding.
With the "wasm32-unknown-unknown-wasm" triple, this allows writing out
simple wasm object files, and is another step in a larger series toward
migrating from ELF to general wasm object support. Note that this code
and the binary format itself is still experimental.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296190 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-24 23:18:00 +00:00
Evgeniy Stepanov
89efd71a88 Disallow redefinition of section symbols.
Differential Revision: https://reviews.llvm.org/D30235

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296180 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-24 21:44:58 +00:00
Evgeniy Stepanov
5982b2c089 Initialize MCContext::InlineSrcMgr in the constructor.
Found with ASan (and a local source change) on test/CodeGen/XCore/section-name.ll.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296179 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-24 21:44:52 +00:00
Dan Gohman
6d5b578789 [WebAssembly] Implement the wasm binary container header.
Also, update the version number to 0x1, which is what engines are now
expecting.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295860 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-22 18:50:20 +00:00
Dan Gohman
d660a5d68c [WebAssembly] Add skeleton MC support for the Wasm container format
This just adds the basic skeleton for supporting a new object file format.
All of the actual encoding will be implemented in followup patches.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295803 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-22 01:23:18 +00:00
Matthias Braun
60202aba32 SubtargetFeature: Cleanup; NFC
- Fix doxygen comments
- Remove duplicated comments
- Remove section comments (which became wrong over time)
- Use more `const` and references but less `auto`

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295687 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-21 01:27:29 +00:00
Rui Ueyama
a24db2314e MC/COFF: Do not emit forward associative section referenceds.
MSVC link.exe cannot handle associative sections that refer later
sections in the section header. Technically, such COFF object doesn't
violate the Microsoft COFF spec, as the spec doesn't say anything
about that, but still we should avoid doing that to make it compatible
with MS tools.

This patch assigns smaller section numbers to non-associative sections
and larger numbers to associative sections. This should resolve the
compatibility issue.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295464 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-17 17:32:54 +00:00
Rui Ueyama
458e24287e Split WinCOFFObjectWriter::writeSection.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295276 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-16 02:56:06 +00:00
Rui Ueyama
1e5304f32f Split WinCOFFObjectWriter::writeObject function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295273 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-16 02:35:48 +00:00
Rui Ueyama
0ddf101757 Remove useless local variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295268 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-16 01:41:04 +00:00
Rui Ueyama
5ececce5a8 Rename variables to match the LLVM style.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295265 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-16 01:06:45 +00:00
Rui Ueyama
da87ca0f4c Revert r295138: Instead of a series of string operations, use snprintf().
This broke buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295142 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-15 01:48:33 +00:00
Rui Ueyama
7855b94bca Instead of a series of string operations, use snprintf().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295138 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-15 01:09:40 +00:00
Rui Ueyama
070aca8b5a Return early. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295137 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-15 01:09:20 +00:00