-
Notifications
You must be signed in to change notification settings - Fork 13.3k
add support for non-standard name of stdc++ library #28495
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
fbaacfd
to
2fb999c
Compare
@@ -1095,6 +1095,11 @@ envopt CPP | |||
envopt CFLAGS | |||
envopt CXXFLAGS | |||
|
|||
# stdc++ name in use | |||
# used to manage non-standard name (on OpenBSD for example) | |||
CFG_STDCPP_NAME=$(echo "stdc++" | sed "$($CFG_CC -v 2>&1 | sed -n "s/.*--program-transform-name='\([^']*\)'.*/\1/p")") |
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.
program-transform-name
is a sed regex (under OpenBSD for gcc-4.9 it is s,^,e,
).
basically, it search for the configure flag program-transform-name
in gcc -v
, and use that with sed
on the "stdc++"
name. If the flag isn't found, the transformation applied is sed ""
which means "no transformation".
it makes rustc compatible with gcc installation that are using `--program-transform-name' configure flag (on OpenBSD for example). - detects at configure the name of stdc++ library on the system - use the detected name in llvm makefile (with enable-static-stdcpp), and pass it to mklldeps.py - generate mklldeps.rs using this detected name note that CFG_STDCPP_NAME is about stdc++ name, not about libc++. If using libc++, the default name will be `stdc++', but it won't be used when linking.
2fb999c
to
913fe6d
Compare
it makes rustc compatible with gcc installation that are using `--program-transform-name' configure flag (on OpenBSD for example). - detects at configure the name of stdc++ library on the system - use the detected name in llvm makefile (with enable-static-stdcpp), and pass it to mklldeps.py - generate mklldeps.rs using this detected name note that CFG_STDCPP_NAME is about stdc++ name, not about libc++. If using libc++, the default name will be `stdc++', but it won't be used when linking. r? @alexcrichton I added this support globally instead of just for OpenBSD as it isn't specially related to OpenBSD (except OpenBSD use it for gcc-4.9). And as I would had to change `llvm.mk', having just a default value in `configure' for others platforms won't be very useful.
By default, the linker in use under OpenBSD is the linker of base, which don't include /usr/local/lib where libstdc++ of gcc-4.9 lives. We need to add this directory to linker-path-search (using -L). Search the path of libstdc++.a, which is a known name (libstdc++.so has SO_VERSION) in the same directory. r? @alexcrichton this commit needs #28495 to be commited first. It should be the last piece for building rustc under OpenBSD from scratch.
it makes rustc compatible with gcc installation that are using
`--program-transform-name' configure flag (on OpenBSD for example).
and pass it to mklldeps.py
note that CFG_STDCPP_NAME is about stdc++ name, not about libc++. If
using libc++, the default name will be `stdc++', but it won't be used
when linking.
r? @alexcrichton
I added this support globally instead of just for OpenBSD as it isn't specially related to OpenBSD (except OpenBSD use it for gcc-4.9). And as I would had to change
llvm.mk', having just a default value in
configure' for others platforms won't be very useful.