Commit Graph

3499 Commits

Author SHA1 Message Date
Sam Clegg
f83cb57aef [WebAssembly] MC: Fix references to undefined externals in data section
Undefined externals don't need to have a size or an offset.
This was broken by r303915.  Added a test for this case.

This fixes the "Compile LLVM Torture (o)" step on the wasm
waterfall.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304505 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-02 01:05:24 +00:00
Zachary Turner
ea64a9b812 [CodeView] Move CodeView YAML code to ObjectYAML.
This is the beginning of an effort to move the codeview yaml
reader / writer into ObjectYAML so that it can be shared.
Currently the only consumer / producer of CodeView YAML is
llvm-pdbdump, but CodeView can exist outside of PDB files, and
indeed is put into object files and passed to the linker to
produce PDB files.  Furthermore, there are subtle differences
in the types of records that show up in object file CodeView
vs PDB file CodeView, but they are otherwise 99% the same.

By having this code in ObjectYAML, we can have llvm-pdbdump
reuse this code, while teaching obj2yaml and yaml2obj to use
this syntax for dealing with object files that can contain
CodeView.

This patch only adds support for CodeView type information
to ObjectYAML.  Subsequent patches will add support for
CodeView symbol information.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304248 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-30 21:53:05 +00:00
Zachary Turner
4b1845a38a [CodeView] Rename ModuleDebugFragment -> DebugSubsection.
This is more concise, and matches the terminology used in other
parts of the codebase more closely.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304218 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-30 16:36:15 +00:00
Sam Clegg
d4b1dbe69d [WebAssembly] MC: Include unnamed data when writing wasm files
Also, include global entries for all data symbols, not
just external ones, since these are referenced by the
relocation records.

Add a test case that includes unnamed data.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303915 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-25 21:08:07 +00:00
James Molloy
11824fc3b4 Re-apply r302416: [ARM] Clear the constant pool cache on explicit .ltorg directives
Re-applying now that PR32825 which was raised on the commit this fixed up is now known to have also been fixed by this commit.

Original commit message:
    Multiple ldr pseudoinstructions with the same constant value will
    reuse the same constant pool entry. However, if the constant pool
    is explicitly flushed with a .ltorg directive, we should not try
    to reference constants in the previous pool any longer, since they
    may be out of range.

    This fixes assembling hand-written assembler source which repeatedly
    loads the same constant value, across a binary size larger than the
    pc-relative fixup range for ldr instructions (4096 bytes). Such
    assembler source already uses explicit .ltorg instructions to emit
    constant pools with regular intervals. However if we try to reuse
    constants emitted in earlier pools, they end up out of range.

    This makes the output of the testcase match what binutils gas does
    (prior to this patch, it would fail to assemble).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303540 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-22 09:42:07 +00:00
James Molloy
4e5148cbb4 Re-apply r286006: Fix 24560: assembler does not share constant pool for same constants
Re-applying now that the open bug on this commit, PR32825, is known to be fixed.

Original commit message:
    Summary: This patch returns the same label if the CP entry with the same value has been created.

    Reviewers: eli.friedman, rengolin, jmolloy

    Subscribers: majnemer, jmolloy, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303539 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-22 09:42:01 +00:00
James Molloy
7ff1c268d6 Revert "[ARM] Clear the constant pool cache on explicit .ltorg directives"
This reverts commit r302416. This was a fixup for r286006, which has now been reverted so this doesn't apply (either in concept or in code).

This commit itself has no problems, but the underlying issue it was fixing has now disappeared from the codebase.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303536 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-22 08:49:28 +00:00
James Molloy
9d3d965348 Revert "Fix 24560: assembler does not share constant pool for same constants"
This reverts commit r286006. It caused PR32825 and wasn't fixed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303535 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-22 08:42:47 +00:00
Arnaud A. de Grandmaison
d49739e03c MCObjectStreamer : fail with a diagnostic when emitting an out of range value.
We were previously silently emitting bogus data in release mode,
making it very hard to diagnose the error, or crashing with an
assert in debug mode. A proper diagnostic is now always emitted
when the value to be emitted is out of range.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303041 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-15 08:43:27 +00:00
Michael Zuckerman
102d6ffbef chang type from 'int' to 'size_t'. This will fix revision number 302652
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302660 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 14:00:57 +00:00
Michael Zuckerman
6361a0b8e9 [LLVM][inline-asm] Altmacro string escape character '!'
This patch is the fourth patch in a series of reviews for the Altmacro feature. 
This patch introduces a new escape character '!' and it depends on D32701.

according to https://sourceware.org/binutils/docs/as/Altmacro.html:
"single-character string escape
To include any single character literally in a string (even if the character would otherwise have some special meaning), you can prefix the character with !' (an exclamation mark). For example, you can write <4.3 !> 5.4!!>' to get the literal text `4.3 > 5.4!'. "

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302652 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 13:08:11 +00:00
Martin Storsjo
b7c80c3cd2 [ARM] Clear the constant pool cache on explicit .ltorg directives
Multiple ldr pseudoinstructions with the same constant value will
reuse the same constant pool entry. However, if the constant pool
is explicitly flushed with a .ltorg directive, we should not try
to reference constants in the previous pool any longer, since they
may be out of range.

This fixes assembling hand-written assembler source which repeatedly
loads the same constant value, across a binary size larger than the
pc-relative fixup range for ldr instructions (4096 bytes). Such
assembler source already uses explicit .ltorg instructions to emit
constant pools with regular intervals. However if we try to reuse
constants emitted in earlier pools, they end up out of range.

This makes the output of the testcase match what binutils gas does
(prior to this patch, it would fail to assemble).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302416 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-08 10:26:24 +00:00
Michael Zuckerman
e11b0c62e8 [LLVM][inline-asm][Altmacor] Altmacro string delimiter '<..>'
In this patch, I introduce a new altmacro string delimiter. 
This review is the second review in a series of four reviews.
(one for each altmacro feature: LOCAL, string delimiter, string '!' escape sign and absolute expression as a string '%' ).

In the alternate macro mode, you can delimit strings with matching angle brackets <..> 
when using it as a part of calling macro arguments.

As described in the https://sourceware.org/binutils/docs-2.27/as/Altmacro.html
"<string>
You can delimit strings with matching angle brackets."

assumptions:

1. If an argument begins with '<' and ends with '>'. The argument is considered as a string.
2. Except adding new string mark '<..>', a regular macro behavior is expected.
3. The altmacro cannot affect the regular less/greater behavior.
4. If a comma is present inside an angle brackets it considered as a character and not as a separator.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302135 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-04 10:37:00 +00:00
Alexei Starovoitov
bd87726db4 [bpf] add relocation support
. there should be no runtime relocation inside the bpf function.
  . relocation supported here mostly for debugging.
  . a test case is added.

Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302055 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 17:30:56 +00:00
Michael Zuckerman
079b067df7 [LLVM][inline-asm] Altmacro absolute expression '%' feature
In this patch, I introduce a new alt macro feature.
This feature adds meaning for the % when using it as a prefix to the calling macro arguments.

In the altmacro mode, the percent sign '%' before an absolute expression convert the expression first to a string. 
As described in the https://sourceware.org/binutils/docs-2.27/as/Altmacro.html
"Expression results as strings
You can write `%expr' to evaluate the expression expr and use the result as a string."

expression assumptions:

1. '%' can only evaluate an absolute expression.
2. Altmacro '%' must be the first character of the evaluated expression.
3. If no '%' is located before the expression, a regular module operation is expected.
4. The result of Absolute Expressions can be only integer.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301797 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-01 13:20:12 +00:00
Zachary Turner
40d2ca9f43 [llvm-pdbdump] Abstract some of the YAML/Raw printing code.
There is a lot of duplicate code for printing line info between
YAML and the raw output printer.  This introduces a base class
that can be shared between the two, and makes some minor
cleanups in the process.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301728 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-29 01:13:21 +00:00
Sam Clegg
e4f76f4742 [WebAssembly] Add size of section header to data relocation offsets.
Also, add test for data relocations and fix addend to
be signed.

Subscribers: jfb, dschuff

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301690 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-28 21:22:38 +00:00
Sam Clegg
649003c411 [WebAssembly] Write initial memory in pages not bytes
Subscribers: jfb, dschuff

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301687 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-28 21:12:09 +00:00
Zachary Turner
3220dd07ab Rename some PDB classes.
We have a lot of very similarly named classes related to
dealing with module debug info.  This patch has NFC, it just
renames some classes to be more descriptive (albeit slightly
more to type).  The mapping from old to new class names is as
follows:

   Old          |        New
ModInfo         | DbiModuleDescriptor
ModuleSubstream | ModuleDebugFragment
ModStream       | ModuleDebugStream

With the corresponding Builder classes renamed accordingly.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301555 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-27 16:11:19 +00:00
Eugene Zelenko
f49f90e97b [MC] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301485 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 22:31:39 +00:00
Andrew V. Tischenko
03ca81ebd4 PR31007 and PR27884 will be closed: a possibility to compile constants like 0bH is now supported in MS asm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301390 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 09:56:59 +00:00
Sam Clegg
178cf77a73 [WebAssembly] Fix relocation count in wasm binaries with call_indirect
Subscribers: jfb, dschuff

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301331 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 17:13:23 +00:00
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