On 26 November 2014 at 23:19, Steve Ellcey wrote: > I have a question about building multiarch GCC toolchains and was hoping > someone could help me understand how toolchains that are currently using > multiarch setups are being built. This may involve glibc as much or more > then gcc but I thought I would start here. > > Using gcc/config/i386/t-linux64 as an example, it has: > > MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu) > MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu) > MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32) > > So if we don't build with multiarch enabled GCC is going to search: > > ../lib64 (when compiling with -m64) > ../lib32 or ../lib (when compiling with -m32) > ../libx32 (when compiling with -mx32) > > If we do build with multiarch enabled then I am guessing that we would > search: > > ../lib64/x86_64-linux-gnu > ../lib32/i386-linux-gnu (or ../lib/i386-linux-gnu) > ../libx32/x86_64-linux-gnux32 > > So my first question is: Is that correct? My second question is: > Where did the '/' between 'lib64' and 'x86_64-linux-gnu' come from? > It looks to me like the 64 bit directory name would get created as > '../lib64x86_64-linux-gnu'. The makefile adds a colon, not a slash, which is documented in gcc/doc/fragments.texi: For configurations that support both multilib and multiarch, @code{MULTILIB_OSDIRNAMES} also encodes the multiarch name, thus subsuming @code{MULTIARCH_DIRNAME}. The multiarch name is appended to each directory name, separated by a colon (e.g. @samp{../lib32:i386-linux-gnu}). Presumably the gcc driver then interprets the colon at run-time to produce the actual search dirs, but I'm guessing now.