1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00
Commit Graph

49 Commits

Author SHA1 Message Date
Cyndy Ishida
98255d6170 [llvm][TextAPI] add mapping from OS string to Platform
* add utility for matching target triple OS value strings  to PlatformKind

This was reviewed offline by ributzka, steven_wu
2021-05-06 16:25:56 -07:00
Cyndy Ishida
eff160f3ab [TextAPI] move source code files out of subdirectory, NFC
TextAPI/ELF has moved out into InterfaceStubs, so theres no longer a
need to seperate out TextAPI between formats.

Reviewed By: ributzka, int3, #lld-macho

Differential Revision: https://reviews.llvm.org/D99811
2021-04-05 10:24:42 -07:00
Sam Powell
3bda5a764e [llvm][TextAPI] add equality operator for InterfaceFile
This patch adds functionality to compare for the equality between `InterfaceFile`s based on attributes specific to linking.

Reviewed By: cishida, steven_wu

Differential Revision: https://reviews.llvm.org/D96629
2021-02-18 11:53:08 -08:00
Paul Robinson
42e5acf884 [RGT][TextAPI] Remove a zero-trip loop and the assertions within it
Found by the Rotten Green Tests project.

Differential Revision: https://reviews.llvm.org/D95259
2021-01-22 15:07:41 -08:00
Nathan James
5aeae74b36 [YAML] Use correct source location for unknown key errors.
Currently unknown keys when inputting mapping traits have the location set to the Value.
Example:
```
YAML:1:14: error: unknown key 'UnknownKey'
{UnknownKey: SomeValue}
             ^~~~~~~~~
```
This is unhelpful for a user as it draws them to fix the wrong item.

Reviewed By: silvas

Differential Revision: https://reviews.llvm.org/D93037
2020-12-11 16:34:06 +00:00
Cyndy Ishida
efc5b116e0 [TextAPI] clean up auto usages in tests, NFC 2020-09-21 08:39:40 -07:00
Greg McGary
f5a6a11410 [MachO] Add skeletal support for DriverKit platform
Define the platform ID = 10, and simple mappings between platform ID & name.

Reviewed By: MaskRay, cishida

Differential Revision: https://reviews.llvm.org/D85594
2020-08-14 12:36:43 -07:00
Haowei Wu
d8abdb26ca [elfabi] Move llvm-elfabi related code to InterfaceStub library
This change moves elfabi related code to llvm/InterfaceStub library
so it can be shared by multiple llvm tools without causing cyclic
dependencies.

Differential Revision: https://reviews.llvm.org/D85678
2020-08-13 11:51:44 -07:00
Cyndy Ishida
f772c98f9f [llvm][TextAPI/MachO] clean up auto usages in tests, NFC 2020-06-15 19:59:42 -07:00
Simon Pilgrim
a8cef06f62 Add missing MemoryBuffer.h include 2020-06-02 11:25:13 +01:00
Cyndy Ishida
619546feb9 [llvm][TextAPI] adding inlining reexported libraries support
Summary:
[llvm][TextAPI] adding inlining reexported libraries support

* this patch adds reader/writer support for MachO tbd files.
The usecase is to represent reexported libraries in top level library
that won't need to exist for linker indirection because all of the
needed content will be inlined in the same document.

Reviewers: ributzka, steven_wu, jhenderson

Reviewed By: ributzka

Subscribers: JDevlieghere, hiraditya, mgrang, dexonsmith, rupprecht, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D67646
2020-04-02 13:05:08 -07:00
Cyndy Ishida
dbf20123ca [llvm][TextAPI/MachO] silence clang-tidy warnings, NFC
* applies only to tests
2020-03-26 16:32:04 -07:00
Cyndy Ishida
25e7b20da0 [TextAPI] Teach TextAPI about arm64e
Reviewers: ributzka, cishida

Subscribers: kristof.beyls, dexonsmith, dcoughlin, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D75688
2020-03-05 13:22:25 -08:00
Cyndy Ishida
f6b2bf396a [llvm][TextAPI] rename test vars, NFC
* Conforms to clang tidy
2020-02-25 14:28:36 -08:00
Jonas Devlieghere
d1cd379480 [llvm][TextAPI/MachO] Extract common code into unittest helper (NFC)
This extract common code between the 4 TBD formats in a header that can
be shared.

Differential revision: https://reviews.llvm.org/D73332
2020-02-13 12:53:24 -08:00
Jonas Devlieghere
17edc6600f [llvm][TextAPI/MachO] Extend TBD_V4 unittest to verify writing
Same as D73328 but for TBD_V4. One notable tidbit is that the swift abi
version for swift 1 & 2 is emitted as a float which is considered
invalid input.

Differential revision: https://reviews.llvm.org/D73330
2020-02-13 12:53:24 -08:00
Cyndy Ishida
a000512a83 [llvm][TextAPI] add simulators to output
Summary:
* for <= tbd_v3, simulator platforms appear the same as the real
platform and we distinct the difference from the architecture.

fixes: rdar://problem/59161559

Reviewers: ributzka, steven_wu

Reviewed By: ributzka

Subscribers: hiraditya, dexonsmith, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D74416
2020-02-11 10:37:37 -08:00
Benjamin Kramer
87d13166c7 Make llvm::StringRef to std::string conversions explicit.
This is how it should've been and brings it more in line with
std::string_view. There should be no functional change here.

This is mostly mechanical from a custom clang-tidy check, with a lot of
manual fixups. It uncovers a lot of minor inefficiencies.

This doesn't actually modify StringRef yet, I'll do that in a follow-up.
2020-01-28 23:25:25 +01:00
Jonas Devlieghere
6df1071106 [llvm][TextAPI/MachO] Support writing single macCatalyst platform
TAPI currently lacks a way to emit the macCatalyst platform. For TBD_V3
is does support zippered frameworks given that both macOS and
macCatalyst are part of the PlatformSet.

Differential revision: https://reviews.llvm.org/D73325
2020-01-27 10:21:06 -08:00
Jonas Devlieghere
e42106db3e [llvm][TextAPI/MachO] Extend TBD_V3 unittest to verify writing
The existing unit tests cover a wide variety of reading TBD files but
lack coverages on the writing side. Case in point is the macCatalyst
case which we're able to read, but not write.

This patch extends the unit test dealing with valid input to write their
content again to verify the writer.

Differential revision: https://reviews.llvm.org/D73328
2020-01-23 23:18:10 -08:00
Jonas Devlieghere
1f5e2d9653 [llvm][TextAPI/MachO] Update variable names in unit tests. (NFC)
This changes the variables names to match the TBD version.

Differential revision: https://reviews.llvm.org/D73326
2020-01-23 23:14:24 -08:00
Cyndy Ishida
cd2fbbf9fc Reland "[TextAPI] Introduce TBDv4"
Original Patch broke for compilations w/ gcc and exposed asan fail.
This reland repairs those bugs.

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

llvm-svn: 374277
2019-10-10 04:24:44 +00:00
Cyndy Ishida
86ba6cb6fb Revert [TextAPI] Introduce TBDv4
This reverts r374058 (git commit 5d566c5a46aeaa1fa0e5c0b823c9d5f84036dc9a)

llvm-svn: 374062
2019-10-08 15:24:37 +00:00
Cyndy Ishida
1ffad17301 [TextAPI] Introduce TBDv4
Summary:
This format introduces new features and platforms
The motivation for this format is to support more than 1 platform since previous versions only supported additional architectures and 1 platform,
for example ios + ios-simulator and macCatalyst.

Reviewers: ributzka, steven_wu

Reviewed By: ributzka

Subscribers: mgorny, hiraditya, mgrang, dexonsmith, llvm-commits

Tags: #llvm

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

llvm-svn: 374058
2019-10-08 15:07:36 +00:00
Cyndy Ishida
eeabefa889 [TextAPI] Add New Supported Platforms
Summary: This patch introduces simulators, as well was the restriced zippered and macCatalyst to supported platforms

Reviewers: ributzka, steven_wu

Reviewed By: ributzka

Subscribers: hiraditya, dexonsmith, llvm-commits

Tags: #llvm

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

llvm-svn: 372618
2019-09-23 15:28:02 +00:00
Cyndy Ishida
5392f0f014 [TextAPI] Arch&Platform to Target
Summary:
This is a patch for updating TextAPI/Macho to read in targets as opposed to arch/platform.
This is because in previous versions tbd files only supported a single platform but that is no longer the case,
so, now its tracked by unique triples.
This precedes a seperate patch that will add  the TBD-v4 format

Reviewers: ributzka, steven_wu, plotfi, compnerd, smeenai

Reviewed By: ributzka

Subscribers: mgorny, hiraditya, dexonsmith, llvm-commits

Tags: #llvm

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

llvm-svn: 372396
2019-09-20 14:32:34 +00:00
Cyndy Ishida
a60baad757 [TextAPI] Update reader to be supported by lib/Object
Summary:
To be able to use the TextAPI/Reader for tbd file consumption (by libObject)
it gets passed a MemoryBufferRef which isn't castable to MemoryBuffer.
Updated the tests to expect that input as well.

Reviewers: ributzka, steven_wu

Reviewed By: steven_wu

Subscribers: hiraditya, dexonsmith, llvm-commits

Tags: #llvm

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

llvm-svn: 369119
2019-08-16 15:30:48 +00:00
Juergen Ributzka
6ec27202c1 [TextAPI] Fix & Add tests for tbd files version 3.
- There was a simple typo in TextStub code that prevented version 3 files to be read.
- Included a version 3 unit test to handle the differences in the format.
- Also a typo in Error.h inside the comments.

https://reviews.llvm.org/D66041

This patch is from Cyndy Ishida <cyndy_ishida@apple.com>.

llvm-svn: 368630
2019-08-12 23:01:07 +00:00
Juergen Ributzka
6999d51166 Revert "Disable MachO TBD write tests for Windows."
The underlying issue was fixed in r357759.

llvm-svn: 368611
2019-08-12 19:51:34 +00:00
Fangrui Song
1bbd63ef60 [YAMLIO] Remove trailing spaces when outputting maps
llvm::yaml::Output::paddedKey unconditionally outputs spaces, which
are superfluous if the value to be dumped is a sequence or map.
Change `bool NeedsNewLine` to `StringRef Padding` so that it can be
overridden to `\n` if the value is a sequence or map.

An empty map/sequence is special. It is printed as `{}` or `[]` without
a newline, while a non-empty map/sequence follows a newline. To handle
this distinction, add another variable `PaddingBeforeContainer` and does
the special handling in endMapping/endSequence.

Reviewed By: grimar, jhenderson

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

llvm-svn: 365869
2019-07-12 04:51:31 +00:00
Juergen Ributzka
e1ce3bb6dc [TextAPI] Prefix all architecture enums to fix the build on i386.
Summary: This changes the Architecture enum to use a prefix (AK_) to prevent the
preprocessor from replacing i386 with 1 when building llvm/clang for i386.

Reviewers: steven_wu, lhames, mstorsjo

Reviewed By: mstorsjo

Subscribers: hiraditya, jkorous, dexonsmith, llvm-commits

Tags: #llvm

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

llvm-svn: 357733
2019-04-04 22:56:50 +00:00
Juergen Ributzka
2224b433e8 Disable MachO TBD write tests for Windows.
The tests are failing on the windows bots. I am disabling them for now.
This is a followup to r356820.

llvm-svn: 356826
2019-03-23 00:03:23 +00:00
Juergen Ributzka
4f86175c37 [TextAPI] TBD Reader/Writer
Add basic infrastructure for reading and writting TBD files (version 1 - 3).

The TextAPI library is not used by anything yet (besides the unit tests). Tool
support will be added in a separate commit.

The TBD format is currently documented in the implementation file (TextStub.cpp).

https://reviews.llvm.org/D53945

Update: This contains changes to fix issues discovered by the bots:
 - add parentheses to silence warnings.
 - rename variables
 - use PlatformType from BinaryFormat
 - Trying if switching from a vector to an array will appeas the bots.
 - Replace the tuple with a struct to work around an explicit constructor bug.
 - This fixes an issue where we were leaking the YAML document if there was a
   parsing error.

Updated the license information in all files.

llvm-svn: 356820
2019-03-22 22:46:52 +00:00
Chandler Carruth
ae65e281f3 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351636
2019-01-19 08:50:56 +00:00
Nico Weber
dcc3a2742e Rename TapiTests to TextAPITests
This makes the target name consistent with how all the other unit tests are
named.

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

llvm-svn: 350339
2019-01-03 18:24:58 +00:00
Armando Montanez
2daabdfccb [TextAPI][elfabi] Fix failing tests from D56020
llvm-svn: 349963
2018-12-21 21:44:09 +00:00
Armando Montanez
bf3176552a [TextAPI][elfabi] Fix YAML support for weak symbols
Weak symbols are supposed to be supported in the ELF TextAPI
implementation, but the YAML handler didn't read or write the `Weak`
member of ELFSymbol. This change adds the YAML mapping and updates tests
to ensure correct behavior.

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

llvm-svn: 349950
2018-12-21 20:45:58 +00:00
Armando Montanez
08f3004e2a [TextAPI][elfabi] Make SoName optional
This change makes DT_SONAME treated as an optional trait for ELF TextAPI
stubs. This change accounts for the fact that shared objects aren't
guaranteed to have a DT_SONAME entry. Tests have been updated to check
for correct behavior of an optional soname.

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

llvm-svn: 348817
2018-12-11 01:00:16 +00:00
Sam Clegg
568563cce3 Fix LLVM_LINK_LLVM_DYLIB build of TapiTests
A dependency on TestingSupport was introduced in rL348735 but
library was not incldued in the LLVM_LINK_LLVM_DYLIB build.

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

llvm-svn: 348803
2018-12-10 22:01:33 +00:00
Armando Montanez
ace43195c3 [TextAPI][elfabi] Make TBE handlers functions that return Errors
Since TBEHandler doesn't maintain state or otherwise have any need to be
a class right now, the read and write functions have been moved out and
turned into standalone functions. Additionally, the TBE read function
has been updated to return an Expected value for better error handling.
Tests have been updated to reflect these changes.

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

llvm-svn: 348735
2018-12-10 02:36:33 +00:00
Sam Clegg
b6e4e22ceb [llvm-tapi] Don't try to override SequenceTraits for std::string
For some reason this doesn't seem to work with LLVM_LINK_LLVM_DYLIB
build.

See https://logs.chromium.org/logs/chromium/bb/client.wasm.llvm/linux/37764/+/recipes/steps/LLVM_regression_tests/0/stdout

What is more it seems that overriding these traits for core types
(including std::string) is not supported/recommend by YAMLTraits.h.
See line 1918 which has the assertion:
 "only use LLVM_YAML_IS_SEQUENCE_VECTOR for types you control"

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

llvm-svn: 348630
2018-12-07 19:29:00 +00:00
Armando Montanez
29999e01da [llvm-tapi] initial commit, supports ELF text stubs
http://lists.llvm.org/pipermail/llvm-dev/2018-September/126472.html

TextAPI is a library and accompanying tool that allows conversion between binary shared object stubs and textual counterparts. The motivations and uses cases for this are explained thoroughly in the llvm-dev proposal [1]. This initial commit proposes a potential structure for the TAPI library, also including support for reading/writing text-based ELF stubs (.tbe) in addition to preliminary support for reading binary ELF files. The goal for this patch is to ensure the project architecture appropriately welcomes integration of Mach-O stubbing from Apple's TAPI [2].

Added:

 - TextAPI library
 - .tbe read support
 - .tbe write (to raw_ostream) support

[1] http://lists.llvm.org/pipermail/llvm-dev/2018-September/126472.html
[2] https://github.com/ributzka/tapi

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

llvm-svn: 348170
2018-12-03 19:30:52 +00:00
Hans Wennborg
31b5fc8481 Revert r347823 "[TextAPI] Switch back to a custom Platform enum."
It broke the Windows buildbots, e.g.
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/21829/steps/test/logs/stdio

This also reverts the follow-ups: r347824, r347827, and r347836.

llvm-svn: 347874
2018-11-29 15:47:24 +00:00
Juergen Ributzka
ab5d0f9da8 [TextAPI] Switch back to a custom Platform enum.
Moving to PlatformType from BinaryFormat had some UB fallout when handing
unknown platforms or malformed input files.

This should fix the sanitizer bots.

llvm-svn: 347836
2018-11-29 05:56:03 +00:00
Juergen Ributzka
02a93e9f48 [TextAPI] TBD Reader/Writer (bot fixes: take 2)
Replace the tuple with a struct to work around an explicit constructor bug.

llvm-svn: 347827
2018-11-29 02:28:58 +00:00
Juergen Ributzka
b9dbc3bb62 [TextAPI] TBD Reader/Writer (bot fixes)
Trying if switching from a vector to an array will appeas the bots.

llvm-svn: 347824
2018-11-29 01:55:57 +00:00
Juergen Ributzka
ab3e0147c2 [TextAPI] TBD Reader/Writer
Add basic infrastructure for reading and writting TBD files (version 1 - 3).

The TextAPI library is not used by anything yet (besides the unit tests). Tool
support will be added in a separate commit.

The TBD format is currently documented in the implementation file (TextStub.cpp).

https://reviews.llvm.org/D53945

Update: This contains changes to fix issues discovered by the bots:
 - add parentheses to silence warnings.
 - rename variables
 - use PlatformType from BinaryFormat
llvm-svn: 347823
2018-11-29 01:20:46 +00:00
Juergen Ributzka
00497177ea Revert "[TextAPI] TBD Reader/Writer"
Reverting to unbreak bots.

llvm-svn: 347809
2018-11-28 21:38:28 +00:00
Juergen Ributzka
0261cead1a [TextAPI] TBD Reader/Writer
Add basic infrastructure for reading and writting TBD files (version 1 - 3).

The TextAPI library is not used by anything yet (besides the unit tests). Tool
support will be added in a separate commit.

The TBD format is currently documented in the implementation file (TextStub.cpp).

https://reviews.llvm.org/D53945

llvm-svn: 347808
2018-11-28 21:27:00 +00:00