File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -2383,6 +2383,15 @@ void AsmPrinter::emitRemarksSection(remarks::RemarkStreamer &RS) {
2383
2383
if (!RS.needsSection ())
2384
2384
return ;
2385
2385
2386
+ MCSection *RemarksSection =
2387
+ OutContext.getObjectFileInfo ()->getRemarksSection ();
2388
+ if (!RemarksSection) {
2389
+ OutContext.reportWarning (SMLoc (), " Current object file format does not "
2390
+ " support remarks sections. Use the yaml "
2391
+ " remark format instead." );
2392
+ return ;
2393
+ }
2394
+
2386
2395
remarks::RemarkSerializer &RemarkSerializer = RS.getSerializer ();
2387
2396
2388
2397
std::optional<SmallString<128 >> Filename;
@@ -2400,10 +2409,7 @@ void AsmPrinter::emitRemarksSection(remarks::RemarkStreamer &RS) {
2400
2409
MetaSerializer->emit ();
2401
2410
2402
2411
// Switch to the remarks section.
2403
- MCSection *RemarksSection =
2404
- OutContext.getObjectFileInfo ()->getRemarksSection ();
2405
2412
OutStreamer->switchSection (RemarksSection);
2406
-
2407
2413
OutStreamer->emitBinaryData (Buf);
2408
2414
}
2409
2415
Original file line number Diff line number Diff line change 5
5
; RUN: llc < %s -mtriple=x86_64-darwin --pass-remarks-format=bitstream -remarks-section=false -pass-remarks-output=%/t.yaml | FileCheck --check-prefix=CHECK-DARWIN-OVERRIDE-BITSTREAM %s
6
6
; RUN: llc < %s -mtriple=x86_64-darwin --pass-remarks-format=yaml -remarks-section=true -pass-remarks-output=%/t.yaml | FileCheck --check-prefix=CHECK-DARWIN-OVERRIDE-YAML %s
7
7
8
+ ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu --pass-remarks-format=bitstream -pass-remarks-output=%/t.yaml 2>&1 | FileCheck --check-prefix=CHECK-LINUX-DEFAULT-BITSTREAM %s
9
+
8
10
; CHECK-DARWIN: .section __LLVM,__remarks,regular,debug
9
11
; CHECK-DARWIN-NEXT: .byte
10
12
22
24
define void @func1 () {
23
25
ret void
24
26
}
27
+
28
+ ; Currently no ELF support for bitstream remarks
29
+ ; CHECK-LINUX-DEFAULT-BITSTREAM: warning: Current object file format does not support remarks sections. Use the yaml remark format instead.
You can’t perform that action at this time.
0 commit comments