-
Notifications
You must be signed in to change notification settings - Fork 115
Update our AZLinux 3.0 .NET 9 images to build a custom standard library toolchain #1025
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
Conversation
…++abi configured such that it is available in our rootfs.
…x (and install with standard paths into the rootfs). Gets PgoInstrument=true working with this image.
…tom resources dir
…or AddressSanitizer to get us a fully-instrumented toolchain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! Some questions mostly for my own understanding.
# Don't search for tools in the sysroot as we're cross-compiling | ||
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM="NEVER" \ | ||
-DLLVM_USE_LINKER=lld \ | ||
# We build libcxxabi here to get the cxxabi.h header file installed in libc++'s standard include directory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't we use the cxxabi.h that comes with libstdc++? Is this for the libc++ build, or is it installing headers to be used when building dotnet/runtime with libc++?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't use the one from libstdc++ as the include directory it is in is also the directory where libstdc++ defines the standard headers.
We need this for the build of createdump
, which uses __cxa_demangle
to demangle symbol names.
Alternatively, we could copy the cxxabi.h
file from the libstdc++ location in the rootfs into the libc++ location.
Or we could have dotnet/runtime define a header that defines the required function prototypes (instead of using the header from the ABI library).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, we could copy the cxxabi.h file from the libstdc++ location in the rootfs into the libc++ location.
This option makes most sense to me. I think using the headers that are installed with the library we will link against is the surest way to make sure they match - but I think you have the best context to make the decision here, so I'll leave it up to you.
@@ -70,6 +70,7 @@ RUN mkdir llvm-project.src && \ | |||
-DCMAKE_BUILD_TYPE=Release \ | |||
-DCMAKE_C_COMPILER=clang \ | |||
-DCMAKE_CXX_COMPILER=clang++ \ | |||
-DCLANG_RESOURCE_DIR="../lib/clang/cross" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this put any non-cross-compilation resources into that directory? With the current images I see:
# clang -print-resource-dir
/usr/local/lib/clang/18
# ls /usr/local/lib/clang/18
include lib
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this will put all assets into the cross
folder (and Clang will only look in that folder, not one with the major version in the path).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, as a minor nit I wouldn't name it cross
since it has all of the resources (including non-cross compilations).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll rename it to resources
then (or figure out a way to get the major version of clang out of the command line).
I'm trying to reduce the number of places where we need to specify (and update later) the version of LLVM/Clang that we're building.
Does building libc++ also make it the default for clang on these images? Or does the runtime build need to set some flags to build against libc++? |
This does make libc++ the default. We'll have to make some changes to the dotnet/runtime build to utilize these new features in the images (by default they'll use the libstdc++ that they've been using). |
Waiting to merge until usage UX in dotnet/runtime#101773 is agreed upon. |
Usage UX has been defined, I'll merge this in and (once the new images are built) update the PR in dotnet/runtime with the sanitizer fixes. |
Update our docker images to build a toolchain with a static libc++ that uses the target-provided libstdc++ for the C++ Itanium ABI.
This scenario has some limitations (we're limited to API features that don't use any ABI features exposed since 2016), but it works fine for our C++11 code in dotnet/runtime.
The sanitizer instrumentation in libc++ isn't compatible with this old of a libstdc++ though, so this PR provides a separate image for that scenario. That image provides a statically linked libc++ that includes libc++abi. Additionally, it instruments libc++ and libc++abi directly with ASAN so our ASAN testing can have a fully instrumented toolchain.
This isn't required for ASAN, but is required for other sanitizers we may consider adding validation with in the future.