[lld] 1f17c2d - [LLD] Deprecate --lto-basic-block-sections=labels (#110697)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 7 09:22:40 PDT 2024


Author: Rahman Lavaee
Date: 2024-10-07T09:22:36-07:00
New Revision: 1f17c2d20db7b26367df53c1d334d4338313fc0b

URL: https://github.com/llvm/llvm-project/commit/1f17c2d20db7b26367df53c1d334d4338313fc0b
DIFF: https://github.com/llvm/llvm-project/commit/1f17c2d20db7b26367df53c1d334d4338313fc0b.diff

LOG: [LLD] Deprecate --lto-basic-block-sections=labels (#110697)

This option is now replaced by `--lto-basic-block-address-map`.

Added: 
    

Modified: 
    lld/ELF/LTO.cpp
    lld/test/ELF/lto/basic-block-sections.ll

Removed: 
    


################################################################################
diff  --git a/lld/ELF/LTO.cpp b/lld/ELF/LTO.cpp
index ef9d9bb49db856..627cbbdce83f37 100644
--- a/lld/ELF/LTO.cpp
+++ b/lld/ELF/LTO.cpp
@@ -62,7 +62,7 @@ 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()) {
@@ -70,7 +70,8 @@ static lto::Config createConfig(Ctx &ctx) {
       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 {

diff  --git a/lld/test/ELF/lto/basic-block-sections.ll b/lld/test/ELF/lto/basic-block-sections.ll
index 35b638ac488a35..4b94e9f75e55c0 100644
--- a/lld/test/ELF/lto/basic-block-sections.ll
+++ b/lld/test/ELF/lto/basic-block-sections.ll
@@ -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 {{.*}}


        


More information about the llvm-commits mailing list