Skip to content
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

Add -Xcc and -gcc options to dmd-script. #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dbankov-vmware
Copy link
Contributor

Add -Xcc and -gcc options to better support bootstrapping of LDC.
Having -Xcc and -gcc options is also useful in general when having to
link D and C/C++ object files.

@dbankov-vmware
Copy link
Contributor Author

dbankov-vmware commented Aug 21, 2021

BTW this PR is the result of the discussion in ldc-developers/ldc#3810 PR. This change will allow bootstrapping LDC with statically linked GDRuntime and GPhobos by using:

cmake -G Ninja <ldc-src-dir> -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PWD/../install -DD_COMPILER=gdmd-11 -DD_COMPILER_ID=GDMD -DD_COMPILER_FE_VERSION=2076 -DD_COMPILER_FLAGS=-gcc=g++-11 -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 -DLDC_LINK_MANUALLY=OFF

The above will unfortunately result in the symbol conflicts mentioned in ldc-developers/ldc#3810 unless a version of GCC which has the corresponding symbols marked as weak is used (I'll post a PR with this change shortly). Passing -q,-shared-libphobos (see below) could be used as a workaround until GDRuntime and GPhobos are updated to have the corresponding symbols marked as weak in the upstream GCC repository.

cmake -G Ninja <ldc-src-dir> -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PWD/../install -DD_COMPILER=gdmd-11 -DD_COMPILER_ID=GDMD -DD_COMPILER_FE_VERSION=2076 -DD_COMPILER_FLAGS="-gcc=g++-11 -q,-shared-libphobos" -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 -DLDC_LINK_MANUALLY=OFF

Add -Xcc and -gcc options to better support bootstrapping of LDC.
Having -Xcc and -gcc options is also useful in general when having to
link D and C/C++ object files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant