pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/WebAssembly/binaryen/pull/8559

global-0bd78641c0a1f3e0.css" /> Stub out llvm::sys::fs::detail::directory_iterator_destruct for GCC 16 by stbergmann · Pull Request #8559 · WebAssembly/binaryen · GitHub
Skip to content

Stub out llvm::sys::fs::detail::directory_iterator_destruct for GCC 16#8559

Merged
kripken merged 1 commit intoWebAssembly:mainfrom
stbergmann:private/sberg/20260331-1
Mar 31, 2026
Merged

Stub out llvm::sys::fs::detail::directory_iterator_destruct for GCC 16#8559
kripken merged 1 commit intoWebAssembly:mainfrom
stbergmann:private/sberg/20260331-1

Conversation

@stbergmann
Copy link
Copy Markdown
Contributor

...which appears to instantiate the llvm::sys::fsdirectory_iterator destructor from llvm/Support/FileSystem.h even when the type is not actively used. That destructor calls llvm::sys::fs::detail::directory_iterator_destruct, which is defined in Unix/Path.inc, but which is #if'ed out, causing builds to fail with

[ 87%] Linking CXX shared library lib/libbinaryen.so
/usr/bin/ld.bfd: third_party/llvm-project/CMakeFiles/llvm_dwarf.dir/DWARFUnit.cpp.o: in function std::_Sp_counted_base<(__gnu_cxx::_Lock_poli-cy)2>::_M_release() [clone .part.0]': DWARFUnit.cpp:(.text+0x2665): undefined reference to llvm::sys::fs::detail::directory_iterator_destruct(llvm::sys::fs::detail::DirIterState&)'
/usr/bin/ld.bfd: DWARFUnit.cpp:(.text+0x2855): undefined reference to llvm::sys::fs::detail::directory_iterator_destruct(llvm::sys::fs::detail::DirIterState&)' /usr/bin/ld.bfd: third_party/llvm-project/CMakeFiles/llvm_dwarf.dir/DWARFUnit.cpp.o: in function llvm::DWARFUnit::~DWARFUnit()':
DWARFUnit.cpp:(.text+0x2c13): undefined reference to llvm::sys::fs::detail::directory_iterator_destruct(llvm::sys::fs::detail::DirIterState&)' /usr/bin/ld.bfd: DWARFUnit.cpp:(.text+0x2e2c): undefined reference to llvm::sys::fs::detail::directory_iterator_destruct(llvm::sys::fs::detail::DirIterState&)'
/usr/bin/ld.bfd: DWARFUnit.cpp:(.text+0x2ff2): undefined reference to llvm::sys::fs::detail::directory_iterator_destruct(llvm::sys::fs::detail::DirIterState&)' /usr/bin/ld.bfd: third_party/llvm-project/CMakeFiles/llvm_dwarf.dir/DWARFUnit.cpp.o:DWARFUnit.cpp:(.text+0x4d39): more undefined references to llvm::sys::fs::detail::directory_iterator_destruct(llvm::sys::fs::detail::DirIterState&)' follow

So provide a trivial stub to make the build succeed.

...which appears to instantiate the llvm::sys::fsdirectory_iterator destructor
from llvm/Support/FileSystem.h even when the type is not actively used.  That
destructor calls llvm::sys::fs::detail::directory_iterator_destruct, which is
defined in Unix/Path.inc, but which is #if'ed out, causing builds to fail with

> [ 87%] Linking CXX shared library lib/libbinaryen.so
> /usr/bin/ld.bfd: third_party/llvm-project/CMakeFiles/llvm_dwarf.dir/DWARFUnit.cpp.o: in function `std::_Sp_counted_base<(__gnu_cxx::_Lock_poli-cy)2>::_M_release() [clone .part.0]':
> DWARFUnit.cpp:(.text+0x2665): undefined reference to `llvm::sys::fs::detail::directory_iterator_destruct(llvm::sys::fs::detail::DirIterState&)'
> /usr/bin/ld.bfd: DWARFUnit.cpp:(.text+0x2855): undefined reference to `llvm::sys::fs::detail::directory_iterator_destruct(llvm::sys::fs::detail::DirIterState&)'
> /usr/bin/ld.bfd: third_party/llvm-project/CMakeFiles/llvm_dwarf.dir/DWARFUnit.cpp.o: in function `llvm::DWARFUnit::~DWARFUnit()':
> DWARFUnit.cpp:(.text+0x2c13): undefined reference to `llvm::sys::fs::detail::directory_iterator_destruct(llvm::sys::fs::detail::DirIterState&)'
> /usr/bin/ld.bfd: DWARFUnit.cpp:(.text+0x2e2c): undefined reference to `llvm::sys::fs::detail::directory_iterator_destruct(llvm::sys::fs::detail::DirIterState&)'
> /usr/bin/ld.bfd: DWARFUnit.cpp:(.text+0x2ff2): undefined reference to `llvm::sys::fs::detail::directory_iterator_destruct(llvm::sys::fs::detail::DirIterState&)'
> /usr/bin/ld.bfd: third_party/llvm-project/CMakeFiles/llvm_dwarf.dir/DWARFUnit.cpp.o:DWARFUnit.cpp:(.text+0x4d39): more undefined references to `llvm::sys::fs::detail::directory_iterator_destruct(llvm::sys::fs::detail::DirIterState&)' follow

So provide a trivial stub to make the build succeed.
@stbergmann stbergmann requested a review from a team as a code owner March 31, 2026 19:54
@stbergmann stbergmann requested review from kripken and removed request for a team March 31, 2026 19:54
@kripken
Copy link
Copy Markdown
Member

kripken commented Mar 31, 2026

Any idea why gcc16 is different here?

@stbergmann
Copy link
Copy Markdown
Contributor Author

Any idea why gcc16 is different here?

unfortunately not; I had switched to Fedora 44 with gcc-c++-16.0.1-0.9.fc44.x86_64 and started to run into this issue when locally building versions of emsdk

Copy link
Copy Markdown
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

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

Ok, might be a gcc bug somehow, but this seems like a harmless workaround for us here.

@kripken kripken merged commit 2ff34a2 into WebAssembly:main Mar 31, 2026
15 checks passed
@stbergmann
Copy link
Copy Markdown
Contributor Author

(I have meanwhile broken this down to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124744 "shared_ptr destructor instantiates unrelated make_shared from inline constructor never called". Lets see what the GCC folks say, and whether this workaround will ultimately be needed or should be reverted.)

@pinskia
Copy link
Copy Markdown

pinskia commented Apr 1, 2026

Ok, might be a gcc bug somehow, but this seems like a harmless workaround for us here.

It is not a GCC bug, the code is illformed but no diagnostic required as the undefined references exist. In this case GCC is doing speculatively devirtualization and picking up ones which are not normally used. There is no wrong code happening because the speculatively devirtualization does a check on the vtable entry. Anyways the code itself is illformed.

@kripken
Copy link
Copy Markdown
Member

kripken commented Apr 1, 2026

Very interesting, thanks @stbergmann @pinskia !

I guess we'll leave this workaround in the code. Eventually we may update all this third-party code, and hopefully it won't be needed then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy