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) {
23832383 if (!RS.needsSection ())
23842384 return ;
23852385
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+
23862395 remarks::RemarkSerializer &RemarkSerializer = RS.getSerializer ();
23872396
23882397 std::optional<SmallString<128 >> Filename;
@@ -2400,10 +2409,7 @@ void AsmPrinter::emitRemarksSection(remarks::RemarkStreamer &RS) {
24002409 MetaSerializer->emit ();
24012410
24022411 // Switch to the remarks section.
2403- MCSection *RemarksSection =
2404- OutContext.getObjectFileInfo ()->getRemarksSection ();
24052412 OutStreamer->switchSection (RemarksSection);
2406-
24072413 OutStreamer->emitBinaryData (Buf);
24082414}
24092415
Original file line number Diff line number Diff line change 55; 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
66; 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
77
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+
810; CHECK-DARWIN: .section __LLVM,__remarks,regular,debug
911; CHECK-DARWIN-NEXT: .byte
1012
2224define void @func1 () {
2325 ret void
2426}
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