RFCs
RFCs copied to clipboard
Use direct call to external tool
I put here because it touch internal of compiler.
I am ok if I have to fix project before we take decision.
I forced pushed to remove my commit and GitHub closed it 🤦♂️
Another con: -ccopt and -cclib will no longer work in general.
Why ?
-cclib <opt> Pass option <opt> to the C linker
-ccopt <opt> Pass option <opt> to the C compiler and linker
I see pass option in singular form. The argument are already splited and we concatenate them to reconstitute command line.
I have checked with clang:
% clang -Wl,'-Z -Z'
ld: unknown option: -Z -Z
clang: error: linker command failed with exit code 1 (use -v to see invocation)
% clang -Wl,-Z
ld: library not found for -lSystem
clang: error: linker command failed with exit code 1 (use -v to see invocation)
And for gcc:
% x86_64-w64-mingw32-gcc -Wl,'-E -E'
/usr/lib/gcc/x86_64-w64-mingw32/7.4.0/../../../../x86_64-w64-mingw32/bin/ld: unrecognized option '-E -E'
/usr/lib/gcc/x86_64-w64-mingw32/7.4.0/../../../../x86_64-w64-mingw32/bin/ld: use the --help option for usage information
collect2: error: ld returned 1 exit status
% x86_64-w64-mingw32-gcc -Wl,-E
/usr/lib/gcc/x86_64-w64-mingw32/7.4.0/../../../../x86_64-w64-mingw32/bin/ld: warning: --export-dynamic is not supported for PE+ targets, did you mean --export-all-symbols?
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o): In function `main':
/usr/src/debug/mingw64-x86_64-runtime-6.0.0-1/crt/crt0_c.c:18: undefined reference to `WinMain'
collect2: error: ld returned 1 exit status
Ok if we want the behavior of go then it might be an issue:
-extldflags flags
Set space-separated flags to pass to the external linker.
The workaround is to split on space maybe in bonus respect quotation or ask to escape space with \x32 for instance
See the discussion at https://github.com/ocaml/ocaml/issues/9482
It's not clear to me from the esy issue you cite - are you simply offended that the process tree is deep, or does it actually cause an issue? The invocation of the linker is not - or certainly shouldn't be - the slow step of builds. It's mentioned in the discussions @nojb's linked, I think a prerequisite to calling these executables directly would be having a complete story for what to do with existing uses of -ccopt and -cclib to allow those fields to be stored as string list in .cma/.cmxa files.
I am simply offended. Ok so first I need to convert this in string list https://github.com/ocaml/ocaml/issues/9482#issuecomment-617280154 it should be a simple refactoring.