public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Question about multiarch builds
@ 2014-11-26 23:19 Steve Ellcey 
  2014-11-27  0:39 ` Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: Steve Ellcey  @ 2014-11-26 23:19 UTC (permalink / raw)
  To: gcc-help

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'.

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Question about multiarch builds
  2014-11-26 23:19 Question about multiarch builds Steve Ellcey 
@ 2014-11-27  0:39 ` Jonathan Wakely
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2014-11-27  0:39 UTC (permalink / raw)
  To: Steve Ellcey; +Cc: gcc-help

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-11-27  0:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-26 23:19 Question about multiarch builds Steve Ellcey 
2014-11-27  0:39 ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).