Commit Graph

36 Commits

Author SHA1 Message Date
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
James Farrell c59b82353d Better diagnostics for dlltool errors.
When dlltool fails, show the full command that was executed. In
particular, llvm-dlltool is not very helpful, printing a generic usage
message rather than what actually went wrong, so stdout and stderr
aren't of much use when troubleshooting.
2023-07-17 20:20:01 +00:00
Deadbeef 4f83717cf7 Use translatable diagnostics in rustc_const_eval 2023-06-01 14:45:18 +00:00
Matthias Krüger e4eaf319c1 Rollup merge of #111203 - Kobzol:remark-print-kind, r=tmiasko
Output LLVM optimization remark kind in `-Cremark` output

Since https://github.com/rust-lang/rust/pull/90833, the optimization remark kind has not been printed. Therefore it wasn't possible to easily determine from the log (in a programmatic way) which remark kind was produced. I think that the most interesting remarks are the missed ones, which can lead users to some code optimization.

Maybe we could also change the format closer to the "old" one:
```
note: optimization remark for tailcallelim at /checkout/src/libcore/num/mod.rs:1:0: marked this call a tail call candidate
```

I wanted to programatically parse the remarks so that they could work e.g. with https://github.com/OfekShilon/optview2. However, now that I think about it, probably the proper solution is to tell rustc to output them to YAML and then use the YAML as input for the opt remark visualization tools. The flag for enabling this does not seem to work though (https://github.com/rust-lang/rust/issues/96705#issuecomment-1117632322).

Still I think that it's good to output the remark kind anyway, it's an important piece of information.

r? ```@tmiasko```
2023-05-06 23:32:02 +02:00
Jakub Beránek 00ac29d7b2 Output LLVM optimization remark kind in -Cremark output 2023-05-04 15:39:21 +02:00
Daniel Paoliello 1ece1ea48c Stablize raw-dylib, link_ordinal and -Cdlltool 2023-04-18 11:01:07 -07:00
David Wood d1fcf61117 errors: generate typed identifiers in each crate
Instead of loading the Fluent resources for every crate in
`rustc_error_messages`, each crate generates typed identifiers for its
own diagnostics and creates a static which are pulled together in the
`rustc_driver` crate and provided to the diagnostic emitter.

Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-22 09:15:53 +00:00
David Wood 2575b1abc9 session: diagnostic migration lint on more fns
Apply the diagnostic migration lint to more functions on `Session`.

Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-30 17:11:35 +00:00
Arpad Borsos 9f5a933f00 Remove backwards compat for LLVM 12 coverage format 2023-01-09 16:31:24 +01:00
bors aef17b7ae6 Auto merge of #105421 - jacobbramley:jb/branch-prot-check, r=nagisa
Check AArch64 branch-protection earlier in the pipeline.

As suggested in #93516.

r? `@nagisa`
2022-12-17 12:10:27 +00:00
Jacob Bramley 49f3c0b736 Check AArch64 branch-protection earlier in the pipeline.
As suggested in #93516.
2022-12-06 15:51:57 +00:00
Peter Collingbourne 5873ebeef3 Move linkage type check to HIR analysis and fix semantics issues.
This ensures that the error is printed even for unused variables,
as well as unifying the handling between the LLVM and GCC backends.

This also fixes unusual behavior around exported Rust-defined variables
with linkage attributes. With the previous behavior, it appears to be
impossible to define such a variable such that it can actually be imported
and used by another crate. This is because on the importing side, the
variable is required to be a pointer, but on the exporting side, the
type checker rejects static variables of pointer type because they do
not implement `Sync`. Even if it were possible to import such a type, it
appears that code generation on the importing side would add an unexpected
additional level of pointer indirection, which would break type safety.

This highlighted that the semantics of linkage on Rust-defined variables
is different to linkage on foreign items. As such, we now model the
difference with two different codegen attributes: linkage for Rust-defined
variables, and import_linkage for foreign items.

This change gives semantics to the test
src/test/ui/linkage-attr/auxiliary/def_illtyped_external.rs which was
previously expected to fail to compile. Therefore, convert it into a
test that is expected to successfully compile.

The update to the GCC backend is speculative and untested.
2022-12-05 15:05:43 -08:00
bjorn3 be6708428f Rewrite LLVM's archive writer in Rust
This allows it to be used by other codegen backends
2022-11-26 19:35:32 +00:00
SLASHLogin a8a8055cc7 Use LayoutError's implementation of IntoDiagnostic 2022-11-09 14:56:21 +01:00
SLASHLogin 9a1545861e Simplify existing Diagnostic implementations 2022-11-09 14:56:21 +01:00
SLASHLogin 3728e95596 Port diagnostics created by Handler 2022-11-09 14:56:21 +01:00
SLASHLogin 67394e7945 Flatten diagnostic structs 2022-11-09 14:56:21 +01:00
SLASHLogin 185ef7b6de Port MissingFeatures and TargetFeatureDisableOrEnable 2022-11-09 14:56:21 +01:00
SLASHLogin 33ef16f291 Port UnknownArchiveKind 2022-11-09 14:56:21 +01:00
SLASHLogin c01546fcd6 Port DlltoolFailImportLibrary and implement IntoDiagnosticArg for Cow<'a, str> 2022-11-09 14:56:21 +01:00
SLASHLogin 81f7a8d7f1 Port ErrorCallingDllTool 2022-11-09 14:56:21 +01:00
SLASHLogin ddbb650289 Import ErrorWritingDEFFile 2022-11-09 14:56:21 +01:00
SLASHLogin d32caf9ced Port ArchiveBuildFailure 2022-11-09 14:56:21 +01:00
SLASHLogin 978b5f73e4 Port SanitizerMemtagRequiresMte 2022-11-09 14:56:21 +01:00
SLASHLogin 60ee496c74 Port LinkageConstOrMutType error 2022-11-09 14:56:20 +01:00
SLASHLogin 5d79d3c4bb Port InvalidMinimumAlignment 2022-11-09 14:56:20 +01:00
SLASHLogin 39d363fd58 Port layout size overflow 2022-11-09 14:56:20 +01:00
SLASHLogin 59b8aedf0e Port branch protection on aarch64 2022-11-09 14:56:20 +01:00
SLASHLogin ec1e101e1b Fix diag() and formatting 2022-11-09 14:56:20 +01:00
SLASHLogin 9f0c16576b Port symbol_already_defined error 2022-11-09 14:56:20 +01:00
SLASHLogin 4c625dc682 Port Instrument coverage requires llvm 12 to the new struct 2022-11-09 14:56:20 +01:00
SLASHLogin 05ae7ecb74 Import error creating import library 2022-11-09 14:56:20 +01:00
SLASHLogin 69d412a073 Missing lifetime parameter and formatting 2022-11-09 14:56:20 +01:00
SLASHLogin b1647903f8 Change String in structs to &'a str 2022-11-09 14:56:20 +01:00
SLASHLogin a54c8003ab Formatting 2022-11-09 14:56:20 +01:00
SLASHLogin 575f6098da Port unknown feature diagnostic to the new framework 2022-11-09 14:56:20 +01:00