-
-
Notifications
You must be signed in to change notification settings - Fork 470
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
Do not hardcode clang/clang++ #110
Conversation
Could you read https://github.com/rui314/mold/blob/main/CONTRIBUTING.md and add a |
Done. Apologies for forgetting the signed-off line (I knew about this requirement too...). |
On a semi-related note: Would you accept a PR that removes Cmake entirely and replaces its usage with a simple Makefile (for mimalloc)? |
It looks as though the GCC in the CI is too old? Might have to force |
Once we do that, don't we need to maintain our local patches to remove dependencies to CMake? CMake is a popular tool these days, so I don't have an urge to do that, but do you? |
Mold would just have a Makefile in its repository (can be stored outside of mimalloc/ so the directory can be updated without issue). No modifications to mimalloc/ should be needed. Another option is to just use cmake for mold as well (though I'd personally prefer pure make). My intention is to use mold as my system's linker (I am actually already doing this). I created my own Linux distribution (https://kisslinux.org https://github.com/kisslinux) and would like to see mold added to its core repository. Issue is that the core repository has no cmake. If you aren't open to dropping cmake, that is totally fine. I will maintain patches downstream instead, this is no problem. Just wanted to see which of my modifications are up-streamable. :) (Thank you for creating mold, it works beautifully.) |
It looks like this patches changes the default compiler to the default CC and CXX. I want to keep clang and clang++ as defaults, as they work fine in my environment. Looks like with out making any modification to the Makefile, |
If you already have a patch to build mimalloc and tbb without cmake, can you paste it here? |
To fix CI, we need to remove
Yes. My intention is to use the values of
I have not done this work yet. I wanted to hear your thoughts before getting started. |
To (really) fix CI, Does GitHub (in workflows) set CC/CXX to GCC by default? That is what is causing issues here (as we now inherit from the environment with this PR). |
Thinking about it some more. It's probably better (and less pain overall) for mold to build itself with cmake in the future. I will experiment with Makefiles regardless (to see how feasible it really is) and let you know how it goes. |
This patch changes the default compiler in my environment from clang to gcc, even though I didn't set CC or CXX environment variables. |
What is your environment? It should only use GCC if |
Ubuntu 20.04. Without this patch, when I just run |
Signed-off-by: Dylan Araps <dylan.araps@gmail.com>
Should be OK now. |
Thanks for merging. :) If you are wondering, here's the status of each package I am maintaining (and whether or not mold can be used): kisslinux/repo#318 (anything ticked works fine) (broken: grub (linker script), gcc (segfault in genmddeps)) |
@dylanaraps Is the segfaulting program for i386? mold's i386 support is not tested very well. |
I am certain it is not for i386.
Here is the full compiler command ( c++ -O3 -march=native -pipe -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wca
st-qual -Wno-error=format-diag -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-s
trings -DHAVE_CONFIG_H -DGENERATOR_FILE -fno-PIE -static-libstdc++ -static-libgcc -no-pie -o build/genmddeps \
build/genmddeps.o build/read-md.o build/errors.o ../build-x86_64-pc-linux-musl/libiberty/libiberty.a
build/gengtype \
-S ../../gcc/gcc -I gtyp-input.list -w tmp-gtype.state Edit: Some details:
Running ==17965== Command: ./genmddeps
==17965==
--17965-- WARNING: Serious error when reading debug info
--17965-- When reading debug info from /tmp/24590/build/gcc/gcc-build/gcc/build/genmddeps:
--17965-- Can't make sense of .rodata section mapping
--17965-- WARNING: Serious error when reading debug info
--17965-- When reading debug info from /usr/lib/libc.so:
--17965-- Can't make sense of .rodata section mapping
vex amd64->IR: unhandled instruction bytes: 0x8F 0x6A 0x78 0x10 0xEF 0x2 0x1 0x0 0x0 0x83
vex amd64->IR: REX=0 REX.W=0 REX.R=0 REX.X=0 REX.B=0
vex amd64->IR: VEX=0 VEX.L=0 VEX.nVVVV=0x0 ESC=NONE
vex amd64->IR: PFX.66=0 PFX.F2=0 PFX.F3=0
==17965== valgrind: Unrecognised instruction at address 0x40be4e5.
==17965== at 0x40BE4E5: ??? (in /usr/lib/libc.so)
==17965== by 0x1FFFF: ??? gdb:
|
GCC builds successfully when I link it statically. Edit: When I just statically link
|
Can you rebuild |
Sha256sum: https://0x0.st/-yKI.tar (GitHub doesn't allow tarball uploads) |
Previously, we created dynamic relocations against read-only sections if the sections contain relocations against weak undefined symbols. Since such dynamic relocations cannot be applied at load-time, the generated executables failed with SEGV. Now, such relocations are resolved to address 0. Reported at #110
I believe your issue has been resolved by the most recent commit that I made to the main branch. Can you confirm? |
Works! Thank you for fixing it. |
When the environment has
CC
/CXX
set, the build system ignores them and hardcodesclang
/clang++
. This changes the Makefile to use the values from the environment if they exist. This allows building withgcc
/g++
for example.