Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lld/ELF/LTO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,16 @@ static lto::Config createConfig(Ctx &ctx) {
c.Options.DataSections = true;

// Check if basic block sections must be used.
// Allowed values for --lto-basic-block-sections are "all", "labels",
// Allowed values for --lto-basic-block-sections are "all",
// "<file name specifying basic block ids>", or none. This is the equivalent
// of -fbasic-block-sections= flag in clang.
if (!ctx.arg.ltoBasicBlockSections.empty()) {
if (ctx.arg.ltoBasicBlockSections == "all") {
c.Options.BBSections = BasicBlockSection::All;
} else if (ctx.arg.ltoBasicBlockSections == "labels") {
c.Options.BBAddrMap = true;
c.Options.BBSections = BasicBlockSection::None;
warn("'--lto-basic-block-sections=labels' is deprecated; Please use "
"'--lto-basic-block-address-map' instead");
} else if (ctx.arg.ltoBasicBlockSections == "none") {
c.Options.BBSections = BasicBlockSection::None;
} else {
Expand Down
3 changes: 3 additions & 0 deletions lld/test/ELF/lto/basic-block-sections.ll
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
; REQUIRES: x86
; RUN: llvm-as %s -o %t.o
; RUN: ld.lld %t.o -o %t --lto-basic-block-sections=labels --lto-O0 2>&1 | FileCheck -check-prefix=LABELSWARN %s
; RUN: ld.lld %t.o -o %t --lto-basic-block-sections=all --lto-O0 --save-temps
; RUN: llvm-readobj -s %t.lto.o | FileCheck --check-prefix=SECNAMES %s
; RUN: ld.lld %t.o -o %t --lto-basic-block-sections=all --lto-unique-basic-block-section-names --lto-O0 --save-temps
; RUN: llvm-readobj -s %t.lto.o | FileCheck --check-prefix=SECNAMES-FULL %s
; RUN: llvm-nm %t | FileCheck --check-prefix=SYMS %s

; LABELSWARN: --lto-basic-block-sections=labels' is deprecated; Please use '--lto-basic-block-address-map' instead

; SECNAMES: Name: .text.foo {{.*}}
; SECNAMES: Name: .text.foo {{.*}}
; SECNAMES: Name: .text.foo {{.*}}
Expand Down
Loading