From 49de1d9179380af850f14ae7d037812ed00a5f87 Mon Sep 17 00:00:00 2001 From: dim Date: Mon, 14 Mar 2011 22:51:51 +0000 Subject: [PATCH] Partially MFC r209867 and r215439, to provide rudimentary support for linking i386 (32 bit) executables on amd64, using gcc's -m32 option. r209867 introduces the needed multilib options to gcc's multilib.h, but was originally intended just for powerpc64. r215439 teaches the linker to search in /usr/lib32 for elf_i386_fbsd output, and amends r209867 to apply to amd64 too. NOTE: this MFC does NOT provide full support for compiling and linking all existing 32 bit programs on amd64, since /usr/include/machine still contains amd64-specific headers. Though simple "Hello World" type programs work, anything relying on machine-specific types might fail in various interesting ways. You have been warned. :) MFC r209867: Teach our toolchain how to generate 64-bit PowerPC binaries. This fixes a variety of bugs in binutils related to handling of 64-bit PPC ELF, provides a GCC configuration for 64-bit PowerPC on FreeBSD, and associated build systems tweaks. Obtained from: projects/ppc64 MFC r215439: Let gcc and ld know where to find 32 bit libraries on amd64. Reviewed by: arch@ Approved by: kib (mentor) git-svn-id: svn://svn.freebsd.org/base/stable/8@219648 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- gnu/usr.bin/binutils/ld/Makefile.amd64 | 2 +- gnu/usr.bin/cc/cc_tools/Makefile | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gnu/usr.bin/binutils/ld/Makefile.amd64 b/gnu/usr.bin/binutils/ld/Makefile.amd64 index 8a0812925..d7276a025 100644 --- a/gnu/usr.bin/binutils/ld/Makefile.amd64 +++ b/gnu/usr.bin/binutils/ld/Makefile.amd64 @@ -12,7 +12,7 @@ e${NATIVE_EMULATION}.c: emulparams/${NATIVE_EMULATION}.sh emultempl/elf32.em \ ${NATIVE_EMULATION} "" no ${NATIVE_EMULATION} ${TARGET_TUPLE} X86_EMULATION= elf_i386_fbsd -_i386_path= \"${TOOLS_PREFIX}/usr/lib/i386\" +_i386_path= \"${TOOLS_PREFIX}/usr/lib32\" EMS+= ${X86_EMULATION} .for ext in ${ELF_SCR_EXT} LDSCRIPTS+= ${X86_EMULATION}.${ext} diff --git a/gnu/usr.bin/cc/cc_tools/Makefile b/gnu/usr.bin/cc/cc_tools/Makefile index f2483137a..6bb62d857 100644 --- a/gnu/usr.bin/cc/cc_tools/Makefile +++ b/gnu/usr.bin/cc/cc_tools/Makefile @@ -303,12 +303,22 @@ GENSRCS+= gcov-iov.h # Multilib config file multilib.h: +.if ${TARGET_ARCH} == "amd64" + echo 'static const char *const multilib_raw[] = { \ + ". !m64 !m32;", \ + "64:../lib m64 !m32;", \ + "32:../lib32 !m64 m32;", NULL };' > ${.TARGET} + echo 'static const char *const multilib_matches_raw[] = { \ + "m64 m64;", "m32 m32;", NULL };' >> ${.TARGET} + echo 'static const char *multilib_options = "m64/m32";' >> ${.TARGET} +.else echo 'static const char *const multilib_raw[] = { \ ". ;", NULL };' > ${.TARGET} echo 'static const char *const multilib_matches_raw[] = { \ NULL };' >> ${.TARGET} - echo 'static const char *multilib_extra = "";' >> ${.TARGET} echo 'static const char *multilib_options = "";' >> ${.TARGET} +.endif + echo 'static const char *multilib_extra = "";' >> ${.TARGET} echo 'static const char *const multilib_exclusions_raw[] = { \ NULL };' >> ${.TARGET} -- 2.45.0