This is an archive of the discontinued LLVM Phabricator instance.

add sysroot/include/c++/version/${TARGET} to wasm32-wasi
ClosedPublic

Authored by expnkx on Feb 4 2022, 10:17 PM.

Details

Summary

The issue is that https://reviews.llvm.org/D117888 does not correctly add include path for libstdc++ which causes compilation to fail.

Diff Detail

Event Timeline

expnkx created this revision.Feb 4 2022, 10:17 PM
expnkx requested review of this revision.Feb 4 2022, 10:17 PM
expnkx accepted this revision.Feb 5 2022, 8:20 PM
This revision is now accepted and ready to land.Feb 5 2022, 8:20 PM

Is the one using MultiarchTriple before wrong? Why is this one being used now even if the OS is unknown?

sbc100 added a comment.Feb 9 2022, 1:20 PM

Is the one using MultiarchTriple before wrong? Why is this one being used now even if the OS is unknown?

Indeed, it looks like this case should already be handled by the // First add the per-target include path if the OS is known. case above. Also, I would expect the MultiarchTriple triple to come before the "/c++/" part of the directory, as it does with the existing path above.

sbc100 requested changes to this revision.Feb 9 2022, 1:20 PM
This revision now requires changes to proceed.Feb 9 2022, 1:20 PM
expnkx added a comment.Feb 9 2022, 4:08 PM

Is the one using MultiarchTriple before wrong? Why is this one being used now even if the OS is unknown?

Indeed, it looks like this case should already be handled by the // First add the per-target include path if the OS is known. case above. Also, I would expect the MultiarchTriple triple to come before the "/c++/" part of the directory, as it does with the existing path above.

No.

libstdc++'s <bits/c++config.h> file is stored in the multiarch here.

expnkx updated this revision to Diff 407751.Feb 10 2022, 7:47 PM

Update for upstreaming update

sbc100 added inline comments.Feb 10 2022, 9:07 PM
clang/lib/Driver/ToolChains/WebAssembly.cpp
541

I see, but regardless of if the multi-arch part comes after the c++ or before, shoudln't this patch be changing the first "target specific" path above rather than the second "generic one". i.e. shouldn't we be searching the multi-arch path first and then the generic path second?

sbc100 added inline comments.Feb 10 2022, 9:14 PM
clang/lib/Driver/ToolChains/WebAssembly.cpp
541

I'm a little confused by c++/<version>/<triple> thing... looking at clang/lib/Driver/ToolChains/Fuchsia.cpp and clang/lib/Driver/ToolChains/Gnu.cpp it looks like /<version> is always the last part of the include path. Do you know what the <triple> component would be needed after the version for wasm but not for other platforms?

I do not know. I have invited Jonathan Wakely. He knows how GCC deals with that and i want to know what he says about this. Then i will fix it later.

jwakely resigned from this revision.Feb 11 2022, 1:49 AM
jwakely added inline comments.
clang/lib/Driver/ToolChains/WebAssembly.cpp
541

Do you know what the <triple> component would be needed after the version for wasm but not for other platforms?

It's always needed. Libstdc++ headers are always split across three directories:

  • $prefix/include/c++/$version: Most headers are here, and are target-independent.
  • $prefix/include/c++/$version/$triplet: target-specific headers such as bits/c++config.h, CPU-specific atomics (predating __atomic built-ins and libatomic), and headers that depend on the build-time GCC config options like the choice of thread model, locale backend, allocator backend, etc.
  • $prefix/include/c++/$version/backward: <strstream> and legacy headers like <hash_map>.

The second one will be modified by the multilib options, so on x86_64 -m32 will use $prefix/include/c++/$version/$triplet/32 instead.

In all cases, $version might be X.Y.Z or just X if GCC was configured with --with-gcc-major-version-only

sbc100 resigned from this revision.Mar 9 2022, 10:22 PM
This revision is now accepted and ready to land.Mar 9 2022, 10:22 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 9 2022, 10:22 PM
Herald added a subscriber: sbc100. · View Herald Transcript
tbaeder closed this revision.Mar 24 2022, 12:15 AM