-B support in clang

hi

I am trying this command:

CC='clang -m32 -march=native -mfancy-math-387 -DCOMPAT_32BIT -iprefix
/home/rdivacky/tmp//data/home/rdivacky/clangbsd/lib32/usr/
-L/home/rdivacky/tmp//data/home/rdivacky/clangbsd/lib32/usr/lib32
-B/home/rdivacky/tmp//data/home/rdivacky/clangbsd/lib32/usr/lib32' mkdep -f .depend -a -DHAVE_CONFIG_H
-I/data/home/rdivacky/clangbsd/gnu/lib/libssp/libssp_nonshared/..
-I/data/home/rdivacky/clangbsd/gnu/lib/libssp/libssp_nonshared/../../../../contrib/gcclibs/libssp
-I/data/home/rdivacky/clangbsd/gnu/lib/libssp/libssp_nonshared/../../../../contrib/gcclibs/include -DPIC
/data/home/rdivacky/clangbsd/gnu/lib/libssp/libssp_nonshared/../../../../contrib/gcclibs/libssp/ssp-local.c

but it fails with:

clang: error: unsupported option '-B/home/rdivacky/tmp//data/home/rdivacky/clangbsd/lib32/usr/lib32'

so.. is -B supported? I tried to search for the option definitions but
I failed badly :frowning:

thank you, roman

Hi Roman,

I don’t believe it is currently supported. I found a FIXME below which relates to -B:

Compilation *Driver::BuildCompilation(int argc, const char **argv) {
llvm::PrettyStackTraceString CrashInfo(“Compilation construction”);

// FIXME: Handle environment options which effect driver behavior, somewhere
// (client?). GCC_EXEC_PREFIX, COMPILER_PATH, LIBRARY_PATH, LPATH,
// CC_PRINT_OPTIONS.

snaroff

I have to ask: what are you really trying to do?

GCC’s build system (which I assume where the libssp is being taken from) uses -B internally to override default search paths for the uninstalled xgcc. If you’re trying to build libssp with a preinstalled compiler (either gcc or clang), -B is not appropriate, because the compiler will find whatever it needs in /usr/lib. In fact, overriding the paths with something pointing to a partial gcc build might do more harm than good.

Shantonu

we're building freebsd, this includes building gcc... I am currently
investigating how to do this in a different way

fwiwi:

  vlakno.cz/~rdivacky/clang-B.patch

this patch implements clang -B. someone might find it useful.

This is Daniel’s domain, but I have two comments and a question:

+  // HACK
+  if (C->getArgs().hasArg(options::OPT_B)) {
+     Arg *B_dir = C->getArgs().getLastArg(options::OPT_B);
+     Prefix = B_dir->getValue(C->getArgs());
+  } else {
+     Prefix = "";
+  }

this patch is not going to get integrated at all. Daniel already
refused to have this functionality. I just posted it to the list
to archive it. ie. when someone in the future googles for clang -B
they can have this patch...

I have no intention to integrate it upstream

Hi Roman,

this patch is not going to get integrated at all. Daniel already
refused to have this functionality. I just posted it to the list
to archive it. ie. when someone in the future googles for clang -B
they can have this patch...

Just to be clear, I'm not "refusing" to have this functionality, but I
do think its a bad idea. It isn't a very good feature, wasn't ever
really designed for users, and I don't think that it is one that real
world projects have any business relying on. I can always be convinced
otherwise, but I'd need some evidence that it is actually serving a
useful purpose for a (number of) real project(s).

- Daniel