1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

78 Commits

Author SHA1 Message Date
Sam Clegg
e4da2b15e2 [WebAssembly] Add support for init functions linking metadata
Summary:
This change lays the groundwork lowering of @llvm.global_ctors
and @llvm.global_dtors for the wasm object format.  Some parts
of this patch are subset of: https://reviews.llvm.org/D40759

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

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

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

llvm-svn: 320742
2017-12-14 21:10:03 +00:00
Sam Clegg
04ba9b762f [WebAssembly] Use bitfield types in wasm YAML representation
Differential Revision: https://reviews.llvm.org/D41202

llvm-svn: 320642
2017-12-13 22:02:25 +00:00
Sam Clegg
a2e12ce576 [WebAssembly] Add linking metatdata test coverage for wasm2yaml
Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish

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

llvm-svn: 320639
2017-12-13 21:53:40 +00:00
Zachary Turner
1267568ace Update obj2yaml and yaml2obj for .debug$H section.
Differential Revision: https://reviews.llvm.org/D40842

llvm-svn: 319925
2017-12-06 18:58:48 +00:00
Shoaib Meenai
22ea853e81 [ObjectYAML] Handle SHF_COMPRESSED
This was previously being silently dropped by obj2yaml and caused
parsing errors with yaml2obj.

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

llvm-svn: 314768
2017-10-03 06:35:55 +00:00
Sam Clegg
2aed7fe062 [WebAssembly] Allow each data segment to specify its own alignment
Also, add a flags field as we will almost certainly
be needing that soon too.

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

llvm-svn: 314534
2017-09-29 16:50:08 +00:00
Sam Clegg
7fdc16cbf1 [WebAssembly] Update relocation names to match spec
Summary: See https://github.com/WebAssembly/tool-conventions/blob/master/Linking.md

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

llvm-svn: 312342
2017-09-01 17:32:01 +00:00
Sam Clegg
24cf7f9acd [WebAssembly] Validate exports when parsing object files
Subscribers: jfb, dschuff, jgravelle-google, aheejin

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

llvm-svn: 312286
2017-08-31 21:43:45 +00:00
Reid Kleckner
9308fade75 [codeview] Fix YAML for LF_TYPESERVER2 by hoisting PDB_UniqueId
Summary:
We were treating the GUIDs in TypeServer2Record as strings, and the
non-ASCII bytes in the GUID would not round-trip through YAML.

We already had the PDB_UniqueId type portably represent a Windows GUID,
but we need to hoist that up to the DebugInfo/CodeView library so that
we can use it in the TypeServer2Record as well as in PDB parsing code.

Reviewers: inglorion, amccarth

Subscribers: llvm-commits, hiraditya

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

llvm-svn: 308234
2017-07-17 23:59:44 +00:00
Sam Clegg
1e7ea802fe [WebAssembly] Expose the offset of each data segment
Summary:
This allows tools like lld that process relocations
to apply data relocation correctly. This information
is required because relocation are stored as section
offset.

Subscribers: jfb, dschuff, jgravelle-google, aheejin

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

llvm-svn: 307741
2017-07-12 00:24:54 +00:00
Sam Clegg
d3b03d52bc [WebAssembly] Add data size and alignement to linking section
The overal size of the data section (including BSS)
is otherwise not included in the wasm binary.

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

llvm-svn: 306459
2017-06-27 20:27:59 +00:00
Sam Clegg
add57cc355 [WebAssembly] Add support for weak symbols in the binary format
This also introduces the updated format for the
"linking" section which can represent extra
symbol information.  See:
https://github.com/WebAssembly/tool-conventions/pull/10

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

llvm-svn: 305769
2017-06-20 04:04:59 +00:00
Sam Clegg
749ad73510 obj2yaml: Improve error reporting
Previously only the error codes were reported which
meant that useful information about malformed inputs
was not shown.

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

llvm-svn: 305609
2017-06-16 23:29:54 +00:00
Sam Clegg
19dcd69096 [WebAssembly] Improve libObject support for wasm imports and exports
Previously we had only supported the importing and
exporting of functions and globals.

Also, add usefull overload of getWasmSymbol() and
getNumberOfSymbols() in support of lld port.

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

llvm-svn: 302601
2017-05-09 23:48:41 +00:00
Sam Clegg
c698370461 [WebAssembly] Fix validation of start function
The check for valid start function was inverted.  Added a new
test in test/Object to check this case and fixed the existing
tests in for ObjectYAML.

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

llvm-svn: 302560
2017-05-09 17:51:38 +00:00
Sam Clegg
b4cdc9d559 [WebAssembly] Add ObjectYAML support for wasm name section
Differential Revision: https://reviews.llvm.org/D32841

llvm-svn: 302266
2017-05-05 18:12:34 +00:00
Sam Clegg
1e1843917e [WebAssembly] Allow for signed relocation addends
Summary:
Addends are used as offsets to addresses of globals
and can be both positive and negative.  This change
prints libObject in line with the spec and the MC
layer.

Subscribers: jfb, dschuff

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

llvm-svn: 301369
2017-04-26 00:02:31 +00:00
Sam Clegg
4af5bc2ae5 [WebAssembly] Read global index in init expression as LEB
Subscribers: jfb, dschuff

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

llvm-svn: 301330
2017-04-25 17:11:56 +00:00
Sam Clegg
c6336dc89e [Test commit] Cleanup some whitespace in a test file
llvm-svn: 300361
2017-04-14 18:43:57 +00:00
Jonas Hahnfeld
e84d473fc3 Align all scalar numbers to LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR
Otherwise, yamlize in YAMLTraits.h might be wrongly defined.
This makes some AMDGPU tests fail when LLVM_LINK_LLVM_DYLIB is set.

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

llvm-svn: 299415
2017-04-04 06:02:32 +00:00
Derek Schuff
92e836cfd2 [WebAssembly] Improve support for WebAssembly binary format
Mostly this change adds support converting to and from
YAML which will allow us to write more test cases for
the WebAssembly MC and lld ports.

Better support for objdump, readelf, and nm will be in
followup CLs.

I had to update the two wasm test binaries because they
used the old style 'name' section which is no longer
supported.

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

Patch by Sam Clegg

llvm-svn: 299101
2017-03-30 19:44:09 +00:00
Chris Bieneman
97553ff10e [ObjectYAML] Fix issue with DWARF2 AddrSize 8
In my refactoring I introduced a bug where we were using the reference size instead of the offset size for DW_FORM_strp and similar forms.

This patch resolves the error and adds a test case testing all the DWARF forms for DWARF2 AddrSize 8. There is similar coverage already in the DWARFDebugInfoTest sources that covers the parser. Once I migrate the DWARFGenerator APIs to be built on the YAML tools they will be fully covered under the same tests.

llvm-svn: 297230
2017-03-07 21:34:35 +00:00
Chris Bieneman
5a909a43a0 [ObjectYAML] Add support for DWARF5 Unit header
In DWARF5 the Unit header added a new field, UnitType, and swapped the order of the address size and abbreviation offset fields.

llvm-svn: 297183
2017-03-07 18:50:58 +00:00
Chris Bieneman
b5fda14554 [ObjectYAML] Support for DW_FORM_implicit_const DWARF5 form
This patch adds support to the DWARF YAML reader and writer for the new DWARF5 abbreviation form, DW_FORM_implicit_const.

The attribute was added in r291599.

llvm-svn: 297091
2017-03-06 23:22:49 +00:00
Chris Bieneman
9876c44779 [ObjectYAML] [DWARF] Abstract DWARF Initial Length values
In the DWARF 4 Spec section 7.2.2, data in many DWARF sections, and some DWARF structures start with "Initial Length Values", which are a 32-bit length, and an optional 64-bit length if the 32 bit value == UINT32_MAX.

This patch abstracts the Initial Length type in YAML, and extends its use to all the DWARF structures that are supported in the DWARFYAML code that have Initial Length values.

llvm-svn: 296911
2017-03-03 21:11:55 +00:00
Steven Wu
d40d99d2b4 Attempt to fix the testcase in r292824
Try fix the testcase r292824 (failing on some bots) by reduce it to the
minimal. If this fix doesn't work, I will revert this test.

llvm-svn: 292826
2017-01-23 20:42:17 +00:00
Steven Wu
9711c6c21b Add LC_BUILD_VERSION load command
Summary:
Add a new load command LC_BUILD_VERSION. It is a generic version of
LC_*_VERSION_MIN load_command used on Apple platforms. Instead of having
a seperate load command for each platform, LC_BUILD_VERSION is recording
platform info as an enum. It also records SDK version, min_os, and tools
that used to build the binary.

rdar://problem/29781291

Reviewers: enderby

Subscribers: llvm-commits

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

llvm-svn: 292824
2017-01-23 20:07:55 +00:00
Kevin Enderby
7de57d9c60 Remove this test from the r292500 commit till Chris and I figure out
why it is failing on a couple of build bots.

llvm-svn: 292501
2017-01-19 18:07:22 +00:00
Kevin Enderby
59a3f7063b Add support for the new LC_NOTE load command.
It describes a region of arbitrary data included in a Mach-O file.
Its initial use is to record extra data in MH_CORE files.

rdar://30001545
rdar://30001731

llvm-svn: 292500
2017-01-19 17:36:31 +00:00
Chris Bieneman
0aa5cdf162 [ObjectYAML] Missed one mixup in the debug_line test
llvm-svn: 291547
2017-01-10 06:24:24 +00:00
Chris Bieneman
42d02eba7a [ObjectYAML] Support for DWARF line tables
One more try... relanding r291541 with a fix to properly gate MaxOpsPerInst on DWARF version.

Description from r291541:

This patch re-lands r291470, which failed on Linux bots. The issue (I believe) was undefined behavior because the size of llvm::dwarf::LineNumberOps was not explcitly specified or consistently respected. The updated patch adds an explcit underlying type to the enum and preserves the size more correctly.

Original description:

This patch adds support for the DWARF debug_lines section. The line table state machine opcodes are preserved, so this can be used to test the state machine evaluation directly.

llvm-svn: 291546
2017-01-10 06:22:49 +00:00
Chris Bieneman
c9fd2572d1 Revert "[ObjectYAML] Support for DWARF line tables"
This reverts commit r291541.

Still failing on a bot:

http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/47224/steps/test_llvm/logs/stdio

llvm-svn: 291542
2017-01-10 05:31:23 +00:00
Chris Bieneman
71155a9019 [ObjectYAML] Support for DWARF line tables
This patch re-lands r291470, which failed on Linux bots. The issue (I believe) was undefined behavior because the size of llvm::dwarf::LineNumberOps was not explcitly specified or consistently respected. The updated patch adds an explcit underlying type to the enum and preserves the size more correctly.

Original description:

This patch adds support for the DWARF debug_lines section. The line table state machine opcodes are preserved, so this can be used to test the state machine evaluation directly.

llvm-svn: 291541
2017-01-10 05:25:24 +00:00
Chris Bieneman
1028eb06fe Revert "[ObjectYAML] Support for DWARF line tables"
This reverts commit r291470 due to failing bots:

http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/47209/steps/test_llvm/logs/stdio

llvm-svn: 291471
2017-01-09 20:04:55 +00:00
Chris Bieneman
458297f73c [ObjectYAML] Support for DWARF line tables
This patch adds support for the DWARF debug_lines section. The line table state machine opcodes are preserved, so this can be used to test the state machine evaluation directly.

llvm-svn: 291470
2017-01-09 20:01:37 +00:00
Chris Bieneman
d86733cb2e [ObjectYAML] Support for DWARF debug_info section
This patch adds support for YAML<->DWARF for debug_info sections.

This re-lands r290147, reverted in 290148, re-landed in r290204 after fixing the issue that caused bots to fail (thank you UBSan!), and reverted again in r290209 due to failures on big endian systems.

After adding support for preserving endianness, this should be good now.

llvm-svn: 290386
2016-12-22 22:44:27 +00:00
Chris Bieneman
51fe95ebf7 [ObjectYAML] Fixing big endian bots from r290381
Bot URL:
http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/2505

llvm-svn: 290383
2016-12-22 22:16:04 +00:00
Chris Bieneman
bda2f27975 [ObjectYAML] MachO support for endianness
This patch adds support to the macho<->yaml tools for preserving endianness in MachO structures and DWARF data.

llvm-svn: 290381
2016-12-22 21:58:03 +00:00
Chris Bieneman
11d3bd2dae Revert "[ObjectYAML] Support for DWARF debug_info section"
This reverts commit r290204.

Still breaking bots... In a meeting now, so I can't fix it immediately.

Bot URL:
http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/2415

llvm-svn: 290209
2016-12-20 22:36:42 +00:00
Chris Bieneman
60a3cd7821 [ObjectYAML] Support for DWARF debug_info section
This patch adds support for YAML<->DWARF for debug_info sections.

This re-lands r290147, after fixing the issue that caused bots to fail (thank you UBSan!).

llvm-svn: 290204
2016-12-20 21:35:31 +00:00
Chris Bieneman
8bc2ac555d Revert "[ObjectYAML] Support for DWARF debug_info section"
This reverts commit r290147.

This commit is breaking a bot (http://lab.llvm.org:8011/builders/clang-atom-d525-fedora-rel/builds/621). I don't have time to investigate at the moment, so I'll revert for now.

llvm-svn: 290148
2016-12-20 00:42:06 +00:00
Chris Bieneman
32d347174d [ObjectYAML] Support for DWARF debug_info section
This patch adds support for YAML<->DWARF for debug_info sections.

llvm-svn: 290147
2016-12-20 00:26:24 +00:00
Chris Bieneman
6b2add271a [ObjectYAML] Support for DWARF Pub Sections
This patch adds support for YAML<->DWARF round tripping for pub* section data. The patch supports both GNU and non-GNU style entries.

llvm-svn: 290139
2016-12-19 22:22:12 +00:00
Chris Bieneman
ece7727a45 [ObjectYAML] Support for DWARF debug_aranges
This patch adds support for round tripping DWARF debug_aranges in and out of YAML.

llvm-svn: 289161
2016-12-09 00:26:44 +00:00
Chris Bieneman
3b41d5aa9c [ObjectYAML] Rename DWARF entries to match section names
This change makes the yaml tags for the members of the DWARF data match the names of the DWARF sections.

llvm-svn: 288981
2016-12-07 21:09:37 +00:00
Chris Bieneman
144e4a2f00 [ObjectYAML] Support for DWARF __debug_abbrev section
This patch adds support for round-tripping DWARF debug abbreviations through the obj<->yaml tools.

llvm-svn: 288955
2016-12-07 18:52:59 +00:00
Chris Bieneman
fd5462ba94 [ObjectYAML] First bit of support for encoding DWARF in MachO
This patch adds the starting support for encoding data from the MachO __DWARF segment. The first section supported is the __debug_str section because it is the simplest.

llvm-svn: 288774
2016-12-06 06:00:49 +00:00
Chris Bieneman
b88ea9e876 [macho2yaml] Don't write empty linkedit data
Since I stopped writing empty export tries it causes LinkEdit to potentially be completely empty which results in invalid yaml being generated.

To prevent this we skip linkedit data if it is empty.

llvm-svn: 278985
2016-08-17 21:46:04 +00:00
Chris Bieneman
34f943417d [Mach0YAML] Change n_type from uint8_t to llvm::yaml::Hex8
Since this field is generally masked, it is way easier to understand it as a Hex value than decimal.

llvm-svn: 277770
2016-08-04 21:07:39 +00:00
Chris Bieneman
9e78b50812 [macho2yaml] String table can contain null strings
Since the string table being read from the MachO is a properly bounded StringRef including null strings is safe and reasonable.

This occurs frequently with stripped binaries where the string table has been modified.

llvm-svn: 277753
2016-08-04 19:19:25 +00:00