Hi, I'm trying to have a possibility to dynamically choose between compatible multilibs (see thread http://gcc.gnu.org/ml/gcc/2013-08/msg00114.html) if preferred one is missing. It would allow me to configure MPX binaries to link with MPX library if such library exists and use non-MPX library version if MPX version is missing.
I introduced a new flag MULTILIB_COMPATIBLE which has format similar to MULTILIB_REUSE. For MULTILIB_REUSE dir prefixes are replaced with reused ones. For MULTILIB_COMPATIBLE compatible dir prefixes are used in addition to existing. With this patch applied on MPX enabled GCC and following additional declarations I was able to build GCC with four library variants: 32 64 32/mpx 64/mpx. Compatible non-MPX files were used to build MPX version of libraries (e.g. /usr/lib64/crti.o was used for 64/mpx). MULTILIB_EXTRA_OPTS = mmpx MULTILIB_OSDIRNAMES+= m64/fmpx=../lib64/mpx$(call if_multiarch,:x86_64-linux-gnu/mpx) MULTILIB_COMPATIBLE = m64=m64/fmpx MULTILIB_OSDIRNAMES+= m32/fmpx=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32/mpx,../lib/mpx)$(call if_multiarch,:i386-linux-gnu/mpx) MULTILIB_COMPATIBLE+= m32=m32/fmpx Any comments on the used approach? Thanks, Ilya --- 2013-08-13 Ilya Enkovich <ilya.enkov...@intel.com> * Makefile.in: Add new arg MULTILIB_COMPATIBLE to genmultilib call. * gcc.c (multilib_compatible): New. (multilib_dir): Change to array of strings. (multilib_os_dir): Likewise. (multiarch_dir): Likewise. (multilib_dir_cnt): New. (static_specs): Add multilib_compatible. (for_each_path_1): New. (for_each_path): Now use helper function for_each_path_1 and iterate through all multidirs. (do_spec_1): Fix-up multilib_* vars usage. (main): Initialize multilib_compatible. Fix-up multilib_* vars usage. (set_multilib_dir): Parse multilib_compatible. * genmultilib: Support new argument MULTILIB_COMPATIBLE.
multilib.patch
Description: Binary data