Skip to content

[LLD] Deprecate --lto-basic-block-sections=labels #110697

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 7, 2024

Conversation

rlavaee
Copy link
Contributor

@rlavaee rlavaee commented Oct 1, 2024

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

@llvmbot
Copy link
Member

llvmbot commented Oct 1, 2024

@llvm/pr-subscribers-lld-elf

Author: Rahman Lavaee (rlavaee)

Changes

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


Full diff: https://github.com/llvm/llvm-project/pull/110697.diff

2 Files Affected:

  • (modified) lld/ELF/LTO.cpp (+3-2)
  • (modified) lld/test/ELF/lto/basic-block-sections.ll (+3)
diff --git a/lld/ELF/LTO.cpp b/lld/ELF/LTO.cpp
index 6b4b0716b9ccb9..8fbb73c49733c6 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..600a28dbe516b8 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 {{.*}}

@llvmbot
Copy link
Member

llvmbot commented Oct 1, 2024

@llvm/pr-subscribers-lld

Author: Rahman Lavaee (rlavaee)

Changes

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


Full diff: https://github.com/llvm/llvm-project/pull/110697.diff

2 Files Affected:

  • (modified) lld/ELF/LTO.cpp (+3-2)
  • (modified) lld/test/ELF/lto/basic-block-sections.ll (+3)
diff --git a/lld/ELF/LTO.cpp b/lld/ELF/LTO.cpp
index 6b4b0716b9ccb9..8fbb73c49733c6 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..600a28dbe516b8 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 {{.*}}

Copy link
Member

@MaskRay MaskRay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This option is used in very specific cases. You can delete this very soon.

(The majority of patches don't have a trailing period in the subject.)

You can also replace . Please with ;

This option is now replaced by `--lto-basic-block-address-map`.
@rlavaee rlavaee force-pushed the deprecate-labels-lld branch from ae1350f to 4003380 Compare October 7, 2024 16:21
@rlavaee rlavaee changed the title [LLD] Deprecate --lto-basic-block-sections=labels. [LLD] Deprecate --lto-basic-block-sections=labels Oct 7, 2024
@rlavaee rlavaee merged commit 1f17c2d into llvm:main Oct 7, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants