Skip to content

[LLD][COFF] Add support for -includeglob on ARM64X #129515

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
Mar 3, 2025

Conversation

cjacek
Copy link
Contributor

@cjacek cjacek commented Mar 3, 2025

Include symbols from both symbol tables.

Include symbols from both symbol tables.
@cjacek
Copy link
Contributor Author

cjacek commented Mar 3, 2025

Similar to -includeoptional from #126300.

@llvmbot
Copy link
Member

llvmbot commented Mar 3, 2025

@llvm/pr-subscribers-lld

@llvm/pr-subscribers-platform-windows

Author: Jacek Caban (cjacek)

Changes

Include symbols from both symbol tables.


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

2 Files Affected:

  • (modified) lld/COFF/Driver.cpp (+2-1)
  • (modified) lld/test/COFF/arm64x-includeoptional.s (+3)
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index b9bde9bb428e6..b60d93d45086e 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -2568,7 +2568,8 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
 
   // Handle /includeglob
   for (StringRef pat : args::getStrings(args, OPT_incl_glob))
-    ctx.symtab.addUndefinedGlob(pat);
+    ctx.forEachSymtab(
+        [&](SymbolTable &symtab) { symtab.addUndefinedGlob(pat); });
 
   // Create wrapped symbols for -wrap option.
   ctx.forEachSymtab([&](SymbolTable &symtab) {
diff --git a/lld/test/COFF/arm64x-includeoptional.s b/lld/test/COFF/arm64x-includeoptional.s
index bf02075d96779..63b1e89082797 100644
--- a/lld/test/COFF/arm64x-includeoptional.s
+++ b/lld/test/COFF/arm64x-includeoptional.s
@@ -11,6 +11,9 @@
 // RUN: llvm-readobj --hex-dump=.test %t.dll | FileCheck %s
 // CHECK: 0x180004000 01000000 01000000
 
+// RUN: lld-link -machine:arm64x -dll -noentry -out:%t-glob.dll %t-test.lib -includeglob:sym
+// RUN: llvm-readobj --hex-dump=.test %t-glob.dll | FileCheck %s
+
         .globl sym
         .section .test,"dr"
 sym:

@llvmbot
Copy link
Member

llvmbot commented Mar 3, 2025

@llvm/pr-subscribers-lld-coff

Author: Jacek Caban (cjacek)

Changes

Include symbols from both symbol tables.


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

2 Files Affected:

  • (modified) lld/COFF/Driver.cpp (+2-1)
  • (modified) lld/test/COFF/arm64x-includeoptional.s (+3)
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index b9bde9bb428e6..b60d93d45086e 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -2568,7 +2568,8 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
 
   // Handle /includeglob
   for (StringRef pat : args::getStrings(args, OPT_incl_glob))
-    ctx.symtab.addUndefinedGlob(pat);
+    ctx.forEachSymtab(
+        [&](SymbolTable &symtab) { symtab.addUndefinedGlob(pat); });
 
   // Create wrapped symbols for -wrap option.
   ctx.forEachSymtab([&](SymbolTable &symtab) {
diff --git a/lld/test/COFF/arm64x-includeoptional.s b/lld/test/COFF/arm64x-includeoptional.s
index bf02075d96779..63b1e89082797 100644
--- a/lld/test/COFF/arm64x-includeoptional.s
+++ b/lld/test/COFF/arm64x-includeoptional.s
@@ -11,6 +11,9 @@
 // RUN: llvm-readobj --hex-dump=.test %t.dll | FileCheck %s
 // CHECK: 0x180004000 01000000 01000000
 
+// RUN: lld-link -machine:arm64x -dll -noentry -out:%t-glob.dll %t-test.lib -includeglob:sym
+// RUN: llvm-readobj --hex-dump=.test %t-glob.dll | FileCheck %s
+
         .globl sym
         .section .test,"dr"
 sym:

Copy link
Member

@mstorsjo mstorsjo left a comment

Choose a reason for hiding this comment

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

LGTM

@cjacek cjacek merged commit 2d0eb5d into llvm:main Mar 3, 2025
15 checks passed
@cjacek cjacek deleted the arm64x-includeglob branch March 3, 2025 21:39
SquallATF pushed a commit to SquallATF/llvm-project that referenced this pull request Mar 10, 2025
SquallATF pushed a commit to SquallATF/llvm-project that referenced this pull request Mar 20, 2025
jph-13 pushed a commit to jph-13/llvm-project that referenced this pull request Mar 21, 2025
SquallATF pushed a commit to SquallATF/llvm-project that referenced this pull request Apr 2, 2025
SquallATF pushed a commit to SquallATF/llvm-project that referenced this pull request Apr 17, 2025
SquallATF pushed a commit to SquallATF/llvm-project that referenced this pull request Apr 30, 2025
SquallATF pushed a commit to SquallATF/llvm-project that referenced this pull request May 15, 2025
SquallATF pushed a commit to SquallATF/llvm-project that referenced this pull request May 29, 2025
SquallATF pushed a commit to SquallATF/llvm-project that referenced this pull request Jun 13, 2025
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