-
Notifications
You must be signed in to change notification settings - Fork 1
Build changes for ARM64 #534
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
base: main
Are you sure you want to change the base?
Conversation
The x86 switch of PartitionAlloc to libc++ breaks x86 CI. It might just need to be installed. |
Should be easy enough to just switch back to libstdc++ on x86. |
Should this be changing our submodule to point at https://github.com/immunant/IA2-glibc? Testing this locally I see the glibc configure failing at its gcc version check step: |
2ac6a35
to
f4eaf4d
Compare
Rebased one more time to incorporate the various AArch64 fixes that just landed in |
f4eaf4d
to
ee8e75a
Compare
This commit switches PartitionAlloc from GNU libstdc++ to LLVM libc++ since we need to use dependencies built with our clang fork on ARM. It does not do so on x86_64 because switching C++ stdlib requires both compile- (-stdlib=libc++) and link-time changes, and we don't expect the compile-time flags to be present when building for x86_64.
this was needed to ensure dependents of partition-alloc also link in LLVM libcxx
it's now correctly included in partition-alloc's target_link_libraries
we need to build glibc with our modified clang toolchain for ARM
rpath_link is inherited by static dependencies, so it should be used for libs and does nothing for executables. then pass only -rpath when linking the final executable.
this normalizes paths so that both rebuilt and prebuilt glibc leave binaries at /lib under the glibc sysroot. otherwise, we would need to make our LD_LIBRARY_PATH for qemu differ depending on whether glibc was prebuilt or not. that said, the glibc `make install` invocation does technically fail because it cannot not run the AArch64 ldconfig. this does not fail the build as a whole, so we leave it for now.
… glibc match also remove it from our LD_LIBRARY_PATH when invoking qemu as libc.so.6 and ld-linux-aarch64.so.1 now live in /lib (rather than /usr/lib) under the sysroot
we must link with the one built with our toolchain, whether prebuilt or from building glibc
ee8e75a
to
cb3089e
Compare
@@ -203,11 +208,13 @@ jobs: | |||
-DCMAKE_OBJCOPY=/usr/bin/llvm-objcopy-15 \ | |||
-DCMAKE_C_FLAGS="$cross_flags" \ | |||
-DCMAKE_CXX_FLAGS="$cross_flags" \ | |||
-DCMAKE_EXE_LINKER_FLAGS="$cross_link_flags -lm -Wl,-rpath-link,${rtlibs_dir}/lib" \ | |||
-DCMAKE_SHARED_LINKER_FLAGS="$cross_link_flags -Wl,-rpath,${rtlibs_dir}/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.
Was switching -Wl,-rpath and -Wl,-rpath-link in these two lines intentional?
@@ -12,7 +12,7 @@ else() | |||
endif() | |||
set(QEMU_COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} | |||
"-one-insn-per-tb" | |||
"-L" "${CMAKE_BINARY_DIR}/external/glibc/sysroot/usr/" |
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.
Does the sysroot not include the headers anymore? Why are we removing the usr suffix?
@@ -55,15 +55,18 @@ target_link_options(libia2 INTERFACE | |||
set_property(TARGET libia2 PROPERTY INTERFACE_LINK_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/padding.ld ${CMAKE_CURRENT_BINARY_DIR}/dynsym.syms) | |||
|
|||
if (LIBIA2_AARCH64) | |||
set(SYSROOT_BIN_DIR ${CMAKE_BINARY_DIR}/external/glibc/sysroot) | |||
set(LIBC_PATH ${SYSROOT_BIN_DIR}/lib/libc.so.6) | |||
set(LD_LINUX_PATH ${SYSROOT_BIN_DIR}/lib/ld-linux-aarch64.so.1) | |||
if (LIBIA2_REBUILD_GLIBC) | |||
ExternalProject_Add(glibc | |||
SOURCE_DIR ${CMAKE_SOURCE_DIR}/external/glibc | |||
BINARY_DIR ${CMAKE_BINARY_DIR}/external/glibc | |||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env | |||
# ffixed-x18 has to be set here instead of CFLAGS for it to apply to all files |
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.
nit: s/ffixed-x18/compiler flags in the comment
No description provided.