Skip to content

[lld] Add missing includes. #143453

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
Jun 9, 2025
Merged

Conversation

slackito
Copy link
Collaborator

@slackito slackito commented Jun 9, 2025

Some inline methods in these headers require a complete type but the corresponding include was missing.

Some inline methods in these headers require a complete type but the
corresponding include was missing.
@llvmbot
Copy link
Member

llvmbot commented Jun 9, 2025

@llvm/pr-subscribers-lld-coff
@llvm/pr-subscribers-platform-windows

@llvm/pr-subscribers-lld-elf

Author: Jorge Gorbe Moya (slackito)

Changes

Some inline methods in these headers require a complete type but the corresponding include was missing.


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

2 Files Affected:

  • (modified) lld/COFF/TypeMerger.h (+1)
  • (modified) lld/ELF/DWARF.h (+1)
diff --git a/lld/COFF/TypeMerger.h b/lld/COFF/TypeMerger.h
index b4e3d6e7d9fdb..effb6d603a592 100644
--- a/lld/COFF/TypeMerger.h
+++ b/lld/COFF/TypeMerger.h
@@ -9,6 +9,7 @@
 #ifndef LLD_COFF_TYPEMERGER_H
 #define LLD_COFF_TYPEMERGER_H
 
+#include "COFFLinkerContext.h"
 #include "Config.h"
 #include "DebugTypes.h"
 #include "lld/Common/Timer.h"
diff --git a/lld/ELF/DWARF.h b/lld/ELF/DWARF.h
index 64c25c706c343..19b17647378bd 100644
--- a/lld/ELF/DWARF.h
+++ b/lld/ELF/DWARF.h
@@ -10,6 +10,7 @@
 #define LLD_ELF_DWARF_H
 
 #include "InputFiles.h"
+#include "InputSection.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/DebugInfo/DWARF/DWARFContext.h"

@llvmbot
Copy link
Member

llvmbot commented Jun 9, 2025

@llvm/pr-subscribers-lld

Author: Jorge Gorbe Moya (slackito)

Changes

Some inline methods in these headers require a complete type but the corresponding include was missing.


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

2 Files Affected:

  • (modified) lld/COFF/TypeMerger.h (+1)
  • (modified) lld/ELF/DWARF.h (+1)
diff --git a/lld/COFF/TypeMerger.h b/lld/COFF/TypeMerger.h
index b4e3d6e7d9fdb..effb6d603a592 100644
--- a/lld/COFF/TypeMerger.h
+++ b/lld/COFF/TypeMerger.h
@@ -9,6 +9,7 @@
 #ifndef LLD_COFF_TYPEMERGER_H
 #define LLD_COFF_TYPEMERGER_H
 
+#include "COFFLinkerContext.h"
 #include "Config.h"
 #include "DebugTypes.h"
 #include "lld/Common/Timer.h"
diff --git a/lld/ELF/DWARF.h b/lld/ELF/DWARF.h
index 64c25c706c343..19b17647378bd 100644
--- a/lld/ELF/DWARF.h
+++ b/lld/ELF/DWARF.h
@@ -10,6 +10,7 @@
 #define LLD_ELF_DWARF_H
 
 #include "InputFiles.h"
+#include "InputSection.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/DebugInfo/DWARF/DWARFContext.h"

@slackito slackito merged commit d099d95 into llvm:main Jun 9, 2025
12 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 9, 2025

LLVM Buildbot has detected a new failure on builder clang-hip-vega20 running on hip-vega20-0 while building lld at step 2 "update-annotated-scripts".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/123/builds/21002

Here is the relevant piece of the build log for the reference
Step 2 (update-annotated-scripts) failure: update (failure)
git version 2.34.1
fatal: unable to access 'https://github.com/llvm/llvm-zorg.git/': Could not resolve host: github.com
fatal: unable to access 'https://github.com/llvm/llvm-zorg.git/': Could not resolve host: github.com

@mstorsjo
Copy link
Member

Can you elaborate on what the concrete issue was that was fixed here? Did compilation fail in some configuration? Or would compilation fail if you'd try to call some of the inline methods?

@slackito
Copy link
Collaborator Author

I think it's triggered by building with modules enabled. The explanation of why it wasn't a problem until now needs a bit of context, please bear with me.

For historical reasons, we (Google) have an internal bazel BUILD file for lld that slightly differs from the one in the LLVM repo. I'm trying to fix that. Our internal builds use modules, but in the current state, we build lld with bazel's layering check (that is, a check that every #include has a matching BUILD dependency that exports that file) disabled, so it's more permissive and it didn't trigger any errors so far. The upstream BUILD file has layering check enabled, which is a good thing, so I'm trying to enable it internally to reduce the internal/external diff. But when I tried doing so I started getting these incomplete type errors.

My guess is that less strict build configurations get the type definition via some transitive include (otherwise all builds would fail in this way), but this doesn't happen in a modular build so we need the explicit includes to get the type definitions.

rorth pushed a commit to rorth/llvm-project that referenced this pull request Jun 11, 2025
Some inline methods in these headers require a complete type but the
corresponding include was missing.
DhruvSrivastavaX pushed a commit to DhruvSrivastavaX/lldb-for-aix that referenced this pull request Jun 12, 2025
Some inline methods in these headers require a complete type but the
corresponding include was missing.
tomtor pushed a commit to tomtor/llvm-project that referenced this pull request Jun 14, 2025
Some inline methods in these headers require a complete type but the
corresponding include was missing.
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.

5 participants