Skip to content

release/22.x: [lld][COFF] Restore lto-embed-bitcode and -fembed-bitcode Bitcode Embedding Features (#188398)#189375

Merged
c-rhodes merged 1 commit intollvm:release/22.xfrom
llvmbot:issue188398
Mar 31, 2026
Merged

release/22.x: [lld][COFF] Restore lto-embed-bitcode and -fembed-bitcode Bitcode Embedding Features (#188398)#189375
c-rhodes merged 1 commit intollvm:release/22.xfrom
llvmbot:issue188398

Conversation

@llvmbot
Copy link
Copy Markdown
Member

@llvmbot llvmbot commented Mar 30, 2026

Backport 1e99c9e

Requested by: @mstorsjo

@llvmbot
Copy link
Copy Markdown
Member Author

llvmbot commented Mar 30, 2026

@HaohaiWen @MaskRay What do you think about merging this PR to the release branch?

@llvmbot
Copy link
Copy Markdown
Member Author

llvmbot commented Mar 30, 2026

@llvm/pr-subscribers-lld

@llvm/pr-subscribers-lld-coff

Author: llvmbot

Changes

Backport 1e99c9e

Requested by: @mstorsjo


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

2 Files Affected:

  • (modified) lld/COFF/InputFiles.cpp (-5)
  • (removed) lld/test/COFF/embed-bitcode.test (-30)
diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp
index d415955b6093b..0cc3aaeba41e3 100644
--- a/lld/COFF/InputFiles.cpp
+++ b/lld/COFF/InputFiles.cpp
@@ -403,11 +403,6 @@ SectionChunk *ObjFile::readSection(uint32_t sectionNumber,
     return nullptr;
   }
 
-  // Those sections are generated by -fembed-bitcode and do not need to be kept
-  // in executable files.
-  if (name == ".llvmbc" || name == ".llvmcmd")
-    return nullptr;
-
   // Object files may have DWARF debug info or MS CodeView debug info
   // (or both).
   //
diff --git a/lld/test/COFF/embed-bitcode.test b/lld/test/COFF/embed-bitcode.test
deleted file mode 100644
index 10f88c5c0117d..0000000000000
--- a/lld/test/COFF/embed-bitcode.test
+++ /dev/null
@@ -1,30 +0,0 @@
-# RUN: yaml2obj %s -o %t.obj
-# RUN: lld-link /entry:main /subsystem:console /out:%t.exe %t.obj
-# RUN: llvm-readobj -S %t.exe | FileCheck %s
-
-# CHECK-NOT: Name: .llvmbc
-# CHECK-NOT: Name: .llvmcmd
-
---- !COFF
-header:
-  Machine:         IMAGE_FILE_MACHINE_AMD64
-
-sections:
-  - Name:            .text
-    Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
-    SectionData:     "C3"
-  - Name:           .llvmbc
-    Characteristics: [ IMAGE_SCN_MEM_DISCARDABLE ]
-    SectionData:     "4243C0DE"
-  - Name:           .llvmcmd
-    Characteristics: [ IMAGE_SCN_MEM_DISCARDABLE ]
-    SectionData:     "2D63633100"
-
-symbols:
-  - Name:            main
-    Value:           0
-    SectionNumber:   1
-    SimpleType:      IMAGE_SYM_TYPE_NULL
-    ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
-    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
-...

@c-rhodes c-rhodes moved this from Needs Triage to Needs Review in LLVM Release Status Mar 30, 2026
@github-project-automation github-project-automation bot moved this from Needs Review to Needs Merge in LLVM Release Status Mar 31, 2026
… Embedding Features (llvm#188398)

Removes the patches introduced by llvm#150897 which broke LTO embed
documented features for creating whole-program-bitcode representations
of executables, used in production analysis/rewriting toolsets. This was
a documented feature available up until 21.1.8 broken by 22.x release.

This previously allowed the users to have a whole-program-bitcode
section `.llvmbc` embedded inside of the final executable.

(cherry picked from commit 1e99c9e)
@c-rhodes c-rhodes merged commit dc9d64a into llvm:release/22.x Mar 31, 2026
1 check was pending
@github-project-automation github-project-automation bot moved this from Needs Merge to Done in LLVM Release Status Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

4 participants