Commit Graph

341 Commits

Author SHA1 Message Date
klensy
aff6c741d4 remove unused pub fn 2023-11-23 14:11:02 +03:00
Ben Kimock
e6f8edff37 Tighten up linkage settings for LLVM bindings 2023-11-21 13:43:11 -05:00
bors
1be1e84872 Auto merge of #117875 - Mark-Simulacrum:bootstrap-bump, r=clubby789
Bootstrap bump

Bumps bootstrap compiler to just-released beta.

https://forge.rust-lang.org/release/process.html#master-bootstrap-update-t-2-day-tuesday
2023-11-16 12:45:27 +00:00
bors
6faa181015 Auto merge of #117948 - aeubanks:dibuilder, r=durin42
llvm-wrapper: Pass newly added param to DIBuilder::createStaticMemberType()

This was added in https://github.com/llvm/llvm-project/pull/72234.
DW_TAG_member was the implicit default before.

The LLVM change is quite sinister since due to weakly typed ints and default params, this was still successfully compiling against LLVM but was passing the wrong parameters.
2023-11-16 03:14:51 +00:00
Mark Rousskov
db3e2bacb6 Bump cfg(bootstrap)s 2023-11-15 19:41:28 -05:00
Arthur Eubanks
7cde2cee35 llvm-wrapper: Pass newly added param to DIBuilder::createEnumerationType()
Added in LLVM in https://github.com/llvm/llvm-project/pull/72011.
2023-11-15 14:42:53 -08:00
Arthur Eubanks
e2c3e94be9 17 -> 18 2023-11-15 13:15:55 -08:00
Arthur Eubanks
984898da17 [llvm-wrapper] Pass newly added param to DIBuilder::createStaticMemberType()
This was added in https://github.com/llvm/llvm-project/pull/72234.
DW_TAG_member was the implicit default before.
2023-11-15 11:29:35 -08:00
Matthias Krüger
03d6e7ade0
Rollup merge of #114224 - inferiorhumanorgans:solaris-llvm-wrapper, r=cuviper
rustc_llvm: Link to libkstat on Solaris/SPARC

getHostCPUName calls into libkstat but as of
LLVM 16.0.6 libLLVMTargetParser is not explicitly
linked against libkstat causing builds to fail
due to undefined symbols.

See also: llvm/llvm-project#64186
2023-11-13 21:28:54 +01:00
Josh Stone
855388e9a2
Mention LLVM 64186 in a comment 2023-11-13 11:04:53 -08:00
Hans Wennborg
752a6132e5 llvm-wrapper: Remove include of non-existant Vectorize.h 2023-11-07 16:40:35 +01:00
Nicholas Nethercote
8ff624a9f2 Clean up rustc_*/Cargo.toml.
- Sort dependencies and features sections.
- Add `tidy` markers to the sorted sections so they stay sorted.
- Remove empty `[lib`] sections.
- Remove "See more keys..." comments.

Excluded files:
- rustc_codegen_{cranelift,gcc}, because they're external.
- rustc_lexer, because it has external use.
- stable_mir, because it has external use.
2023-10-30 08:46:02 +11:00
Havard Eidnes
0f04e2dd8f For i586/NetBSD: fix another formatting insistence. 2023-10-27 09:37:25 +00:00
Havard Eidnes
391b472a37 rustc_llvm/build.rs: improve comment for NetBSD/i386 targets
...explaining why we need -latomic (gcc & g++ built for i486,
and LLVM insisting on use of 64-bit atomics).
2023-10-26 17:10:16 +00:00
Havard Eidnes
6642b4b1e2 Add support for i586-unknown-netbsd as target.
This restricts instructions to those offered by Pentium,
to support e.g. AMD Geode.

There is already an entry for this target in the NetBSD
platform support page at

  src/doc/rustc/src/platform-support/netbsd.md

...so this should forestall its removal.

Additional fixes are needed for some vendored modules, this
is the changes in the rust compiler core itself.
2023-10-25 15:23:34 +00:00
Michael Howell
c6e6ecb1af rustdoc: remove rust logo from non-Rust crates 2023-10-08 20:17:53 -07:00
Emanuele Vannacci
5048f81313 fix to register analysis pass from llvm plugin 2023-10-06 12:04:28 +00:00
Nicholas Nethercote
c3127d161a Remove unused features from rustc_llvm. 2023-10-03 15:54:44 +11:00
Florian Schmiderer
91544e6a93 Pass name of object file to LLVM so it can correctly emit S_OBJNAME 2023-09-25 19:31:58 +02:00
Krasimir Georgiev
af401b0ca3 llvm-wrapper: adapt for LLVM API changes
No functional changes intended.

Adapts the wrapper for 0a1aa6cda2.

Found by our experimental rust + llvm @ head CI: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/22301#018a9926-a810-4e56-8ac2-e6f30b78f433/253-551
2023-09-15 14:31:43 +00:00
Matthias Krüger
aa78b4c368
Rollup merge of #115358 - durin42:compress-debuginfo, r=oli-obk
debuginfo: add compiler option to allow compressed debuginfo sections

LLVM already supports emitting compressed debuginfo. In debuginfo=full builds, the debug section is often a large amount of data, and it typically compresses very well (3x is not unreasonable.) We add a new knob to allow debuginfo to be compressed when the matching LLVM functionality is present. Like clang, if a known-but-disabled compression mechanism is requested, we disable compression and emit uncompressed debuginfo sections.

The API is different enough on older LLVMs we just pretend the support
is missing on LLVM older than 16.
2023-09-09 00:28:19 +02:00
bors
ffc48e3eda Auto merge of #115641 - durin42:llvm-18-fatlto-take-2, r=nikic
lto: load bitcode sections by name

Upstream change
llvm/llvm-project@6b539f5eb8 changed `isSectionBitcode` works and it now only respects `.llvm.lto` sections instead of also `.llvmbc`, which it says was never intended to be used for LTO. We instead load sections by name, and sniff for raw bitcode by hand.

This is an alternative approach to #115136, where we tried the same thing using the `object` crate, but it got too fraught to continue.

r? `@nikic`
`@rustbot` label: +llvm-main
2023-09-08 19:07:17 +00:00
Augie Fackler
af9e55068c debuginfo: add compiler option to allow compressed debuginfo sections
LLVM already supports emitting compressed debuginfo. In debuginfo=full
builds, the debug section is often a large amount of data, and it
typically compresses very well (3x is not unreasonable.) We add a new
knob to allow debuginfo to be compressed when the matching LLVM
functionality is present. Like clang, if a known-but-disabled
compression mechanism is requested, we disable compression and emit
uncompressed debuginfo sections.

The API is different enough on older LLVMs we just pretend the support
is missing on LLVM older than 16.
2023-09-08 10:45:29 -04:00
Augie Fackler
942bdf910c lto: load bitcode sections by name
Upstream change
llvm/llvm-project@6b539f5eb8 changed
`isSectionBitcode` works and it now only respects `.llvm.lto` sections
instead of also `.llvmbc`, which it says was never intended to be used
for LTO. We instead load sections by name, and sniff for raw bitcode by
hand.

r? @nikic
@rustbot label: +llvm-main
2023-09-08 10:45:22 -04:00
Guillaume Gomez
575c3633f8
Rollup merge of #115638 - ldm0:ldm/llvm-args-fix, r=nikic
`-Cllvm-args` usability improvement

fixes: #26338
fixes: #115564

Two problems were found during playing with `-Cllvm-args`

1. When `llvm.link-shared` is set to `false` in `config.toml`, output of `rustc -C llvm-args='--help-list-hidden'` doesn't contain `--emit-dwarf-unwind` and `--emulated-tls`. When it is set to `true`, `rustc -C llvm-args='--help-list-hidden'` emits `--emit-dwarf-unwind`, but `--emulated-tls` is still missing.
2. Setting `-Cllvm-args=--emit-dwarf-unwind=always` doesn't take any effect, but `-Cllvm-args=-machine-outliner-reruns=3` does work.

### 1

Adding `RegisterCodeGenFlags` to register codegen flags fixed the first problem. `rustc -C llvm-args='--help-list-hidden'` emits full codegen flags including `--emit-dwarf-unwind` and `--emulated-tls`.

### 2

Constructing `TargetOptions` from `InitTargetOptionsFromCodeGenFlags` in `LLVMRustCreateTargetMachine` fixed the second problem. The `LLVMRustSetLLVMOptions` calls `ParseCommandLineOptions` which parses given `llvm-args`. For options like `machine-outliner-reruns`, it just works, since the codegen logic directly consumes the parsing result:

[machine-outliner-reruns register](0537f6354c/llvm/lib/CodeGen/MachineOutliner.cpp (L114))
[machine-outliner-reruns consumption](0537f6354c/llvm/lib/CodeGen/MachineOutliner.cpp (L1138))

But for flags defined in `TargetOptions` and `MCTargetOptions` to take effect, constructing them with `InitTargetOptionsFromCodeGenFlags` is essential, or the parsing result is just not consumed. Similar patterns can be observed in [lli](0537f6354c/llvm/tools/llc/llc.cpp (L494)), [llc](0537f6354c/llvm/tools/lli/lli.cpp (L517)), etc.
2023-09-08 14:10:52 +02:00
bors
9be4eac264 Auto merge of #113492 - nebulark:pr_96475, r=petrochenkov
Add CL and CMD into to pdb debug info

Partial fix for https://github.com/rust-lang/rust/issues/96475

The Arg0 and CommandLineArgs of the MCTargetOptions cpp class are not set within bb548f9645/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp (L378)

This causes LLVM to not  neither output any compiler path (cl) nor the arguments that were used when invoking it (cmd) in the PDB file.

This fix adds the missing information to the target machine so LLVM can use it.
2023-09-08 10:06:40 +00:00
Florian Schmiderer
4cdc633301 Add missing Debuginfo to PDB debug file on windows.
Set Arg0 and CommandLineArgs in MCTargetoptions so LLVM outputs correct CL and CMD in LF_DEBUGINFO instead of empty/invalid values.
2023-09-08 00:28:40 +02:00
Augie Fackler
6e5566cf03 lto: load bitcode sections by name
Upstream change
llvm/llvm-project@6b539f5eb8 changed
`isSectionBitcode` works and it now only respects `.llvm.lto` sections
instead of also `.llvmbc`, which it says was never intended to be used
for LTO. We instead load sections by name, and sniff for raw bitcode by
hand.

r? @nikic
@rustbot label: +llvm-main
2023-09-07 09:48:50 -04:00
Liu Dingming
487766cef0 Using parsed codegen flags 2023-09-07 17:37:12 +08:00
Liu Dingming
bb6dcf5f74 Add RegisterCodeGenFlags to get full codegen flags list 2023-09-07 17:37:12 +08:00
bors
e3abbd4994 Auto merge of #114946 - anforowicz:generic-fix-for-asan-lto, r=tmiasko
Preserve ASAN-related symbols during LTO.

Fixes https://github.com/rust-lang/rust/issues/113404
2023-09-06 20:04:03 +00:00
Krasimir Georgiev
bdfa08a345 llvm-wrapper: adapt for LLVM API change
No functional changes intended.

Adapts the wrapper for bbe8cd1333.

Found by our experimental rust + llvm @ HEAD CI: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/22055#018a6495-8dd9-41df-9381-5e7b0009ce0a/274-575
2023-09-05 10:04:25 +00:00
Matthias Krüger
4e2231803b
Rollup merge of #114349 - inferiorhumanorgans:dragonfly-link-libz, r=cuviper
rustc_llvm: Link to `zlib` on dragonfly and solaris

On native builds `llvm-config` picks up `zlib` and this gets pased into
the rust build tools, but on cross builds `llvm-config` is explicitly
ignored as it contains information for the host system and cannot be
trusted to be accurate for the target system.

Both DragonFly and Solaris contain `zlib` in the base system, so this is
both a safe assumption and required for a successful cross build unless
`zlib` support is disabled in LLVM.

This is more or less in the same vein as rust-lang#75713 and rust-lang#75655.
2023-09-02 07:48:21 +02:00
Lukasz Anforowicz
e6dddbda35 Preserve ___asan_globals_registered symbol during LTO.
Fixes https://github.com/rust-lang/rust/issues/113404
2023-08-29 19:02:33 +00:00
bors
d1fb1755aa Auto merge of #115079 - cuviper:unused-mcinfo, r=Mark-Simulacrum
Move a local to the `#if` block where it is used

For other cases (LLVM < 17), this was complaining under `-Wall`:

```
warning: llvm-wrapper/PassWrapper.cpp: In function ‘void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef, const char*)’:
warning: llvm-wrapper/PassWrapper.cpp:311:26: warning: unused variable ‘MCInfo’ [-Wunused-variable]
warning:   311 |   const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo();
warning:       |                          ^~~~~~
```
2023-08-27 10:32:24 +00:00
Augie Fackler
3977ed1e69 ArchiveWrapper: handle LLVM API update
In llvm/llvm-project@f740bcb370 a boolean
parameter changed to an enum.

r? @nikic
@rustbot label: +llvm-main
2023-08-22 12:26:35 -04:00
Josh Stone
ef0651972f Move a local to the #if block where it is used
For other cases (LLVM < 17), this was complaining under `-Wall`:

```
warning: llvm-wrapper/PassWrapper.cpp: In function ‘void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef, const char*)’:
warning: llvm-wrapper/PassWrapper.cpp:311:26: warning: unused variable ‘MCInfo’ [-Wunused-variable]
warning:   311 |   const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo();
warning:       |                          ^~~~~~
```
2023-08-21 15:27:08 -07:00
Dirreke
d16409fe22 add a csky-unknown-linux-gnuabiv2 target 2023-08-14 23:02:36 +08:00
bors
a9b2c6a0ce Auto merge of #114005 - Zalathar:no-cstr, r=jackh726
coverage: Don't convert filename/symbol strings to `CString` for FFI

LLVM APIs are usually perfectly happy to accept pointer/length strings, as long as we supply a suitable length value when creating a `StringRef` or `std::string`.

This lets us avoid quite a few intermediate `CString` copies during coverage codegen. It also lets us use an `IndexSet<Symbol>` (instead of an `IndexSet<CString>`) when building the deduplicated filename table.
2023-08-10 23:06:10 +00:00
Matthias Krüger
54a9c2cb2a
Rollup merge of #114612 - lqd:east-17-warning, r=nikic
update llvm-wrapper include to silence deprecation warning

Includes of `include/llvm/Support/Host.h` now emit a deprecated warning: `warning: This header is deprecated, please use llvm/TargetParser/Host.h`.

I don't believe we are using this include.

I don't believe we need to bump the `download-ci-llvm` stamp since these warnings are emitted while building the `llvm-wrapper`.

r? ```@nikic```
2023-08-08 21:44:44 +02:00
Matthias Krüger
c097e48082
Rollup merge of #113593 - rcvalle:rust-cfi-fix-90546, r=wesleywiser
CFI: Fix error compiling core with LLVM CFI enabled

Fix #90546 by filtering out global value function pointer types from the type tests, and adding the LowerTypeTests pass to the rustc LTO optimization pipelines.
2023-08-08 21:44:43 +02:00
bors
f525bb4e2a Auto merge of #114439 - Kobzol:remark-pgo-hotness, r=tmiasko
Add hotness data to LLVM remarks

Slight improvement of https://github.com/rust-lang/rust/pull/113040. This makes sure that if PGO is used, remarks generated using `-Zremark-dir` will include the `Hotness` attribute.

r? `@tmiasko`
2023-08-08 15:41:44 +00:00
Jakub Beránek
9d417d7c86
Only enable hotness information when PGO is available 2023-08-08 15:36:55 +02:00
Rémy Rakic
bcf7bfc9f4 remove llvm-wrapper include to silence deprecation warning
Includes of `include/llvm/Support/Host.h` now emit a deprecated warning:
`warning: This header is deprecated, please use llvm/TargetParser/Host.h`.
2023-08-08 10:48:20 +00:00
Alex Zepeda
6ef7813cf0 rustc_llvm: Link zlib on cross Solaris builds
On native builds `llvm-config` picks up `zlib` and this gets pased into
the rust build tools, but on cross builds `llvm-config` is explicitly
ignored as it contains information for the host system and cannot be
trusted to be accurate for the target system.

Both DragonFly and Solaris contain `zlib` in the base system, so this is
both a safe assumption and required for a successful cross build unless
`zlib` support is disabled in LLVM.

This is more or less in the same vein as #75713 and #75655.
2023-08-07 17:19:30 -07:00
Ramon de C Valle
f837c48f0d CFI: Fix error compiling core with LLVM CFI enabled
Fix #90546 by filtering out global value function pointer types from the
type tests, and adding the LowerTypeTests pass to the rustc LTO
optimization pipelines.
2023-08-07 15:59:15 -07:00
Nikita Popov
7867833652 Fix LLVM version check for ThinLTO import/export lists
These types changed in LLVM 18, not LLVM 17.
2023-08-07 20:36:14 +02:00
Nikita Popov
055dd282c5 Remove no longer needed LLVM_RUSTLLVM check
The bundled version now uses the LLVM 17 code path.
2023-08-07 20:35:55 +02:00
Krasimir Georgiev
9941db4512 llvm-wrapper: adapt for LLVM API changes
No functional changes intended.

Adapts llvm-wrapper for 65e57bbed0.

Found by our experimental rust + llvm @ HEAD CI:
https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/21304#0189c526-86cd-4db9-bdbc-dd0132dfc22b/197-500
2023-08-05 10:54:30 +00:00
Jakub Beránek
93bdc01adf
Add hotness data to LLVM remarks
This makes sure that if PGO is used, remarks generated using `-Zremark-dir` will include the `Hotness` attribute.
2023-08-04 10:31:00 +02:00