Question about multiarch builds

Steve Ellcey
Wed Nov 26 23:19:00 GMT 2014

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

	../lib32/i386-linux-gnu (or ../lib/i386-linux-gnu)

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

My other question (and this is more about glibc) is about enabling multiarch
in GCC and glibc.  GCC has --enable-multiarch that enables the multiarch
functionality, glibc has --enable-multi-arch but that seems to be about
IFUNCS and completely unrelated to this.  So is there any configure code
in glibc that causes libraries to be placed in 'lib64/x86_64-linux-gnu'
instead of just 'lib64'.  I see glibc configure fragements in
sysdeps/unix/sysv/linux that change the install directory from lib to lib64
but nothing that would add the x86_64-linux-gnu part of the path to the
install location.  Are people moving files by hand after the libc build?

Steve "Lost in a maze of twisty architectures" Ellcey

More information about the Gcc-help mailing list