From patchwork Sun Mar 17 20:40:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Tobler X-Patchwork-Id: 1057583 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-498016-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=fgznet.ch Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="iM0+oVk6"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44MrmM1QH0z9s4Y for ; Mon, 18 Mar 2019 07:40:16 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=ZeLAoJOrjJdrpttB4xzOxjgC7l40p7jd2tlGE+dtaxULoy2CgQ PLmxdn0lE3zvYCp348dld+S3uW/AYB5lj1mBD4AJl94AG89rloUEzJZk4sYB7CD+ f6o2lDwlxN98d3R3kNLzEoiVNYBvvHcx9QJF8g9tOrvHZwGw2dz2iGQPc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=/5/qxAqi1oA8/9o4gPZnlvhef3A=; b=iM0+oVk6b/c8IcdSGe8U QQOl1sZRVuJPZpMlETt0jWYmeJZqwylk0ryk0TUdPPp3u66asoby/80XKeXMTqQV 8InIAQhwFxxAQprq+VilOXEQsU5r+B69V3Q97V+m6032ZoXU1Ja3Cn7aPnYvYcRK ez5NZgepUAzGR9phT7s9TUg= Received: (qmail 91696 invoked by alias); 17 Mar 2019 20:40:09 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 91686 invoked by uid 89); 17 Mar 2019 20:40:08 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Spam-Relays-External:sk:!192.16, H*RU:sk:!192.16, tricky, H*UA:Intel X-HELO: smtp.fgznet.ch Received: from smtp.fgznet.ch (HELO smtp.fgznet.ch) (157.161.14.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 17 Mar 2019 20:40:06 +0000 Received: from [192.168.225.14] (dhclient-91-190-10-49.flashcable.ch [91.190.10.49]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by fgznet.ch (Postfix) with ESMTPSA id D5308C05E5 for ; Sun, 17 Mar 2019 21:40:03 +0100 (CET) To: GCC Patches From: Andreas Tobler Subject: [patch] Multilib support for amd64 FreeBSD Message-ID: Date: Sun, 17 Mar 2019 21:40:00 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 X-IsSubscribed: yes Hi all, this patch adds support for multilib on x86_64-unknown-freebsd* The multilibs are 32-bit. This patch is functionality tested on gcc8 and gcc9. Test suite testing is a bit tricky since the FreeBSD dynamic linker handles both, the 32-bit and the 64-bit binaries. So, if I have a 64-bit libgcc in the LD_LIBRARY_PATH the test fails. I tweaked the build tree and removed the 64-bit libgcc to test the 32-bit binaries built. So far it looks good. Need to find a way to extend the testsuite to handle this situation. Any comments about it are welcome. Also, when would be the best time to commit this patch? Afair trunk is in stage4, right? The patch itself only affects x86_64-unknown-freebsd. TIA, Andreas 2019-03-17 Andreas Tobler * config/i386/freebsd64.h: Add bits for 32-bit multilib support. * config/i386/t-freebsd64: New file. * config.gcc: Add the t-freebsd64 for multilib support. Index: config/i386/freebsd64.h =================================================================== --- config/i386/freebsd64.h (revision 269746) +++ config/i386/freebsd64.h (working copy) @@ -31,7 +31,7 @@ #undef LINK_SPEC #define LINK_SPEC "\ - %{m32:-m elf_i386_fbsd} \ + %{m32:-m elf_i386_fbsd}%{!m32:-m elf_x86_64_fbsd} \ %{p:%nconsider using '-pg' instead of '-p' with gprof(1)} \ %{v:-V} \ %{assert*} %{R*} %{rpath*} %{defsym*} \ @@ -42,3 +42,6 @@ -dynamic-linker %(fbsd_dynamic_linker) } \ %{static:-Bstatic}} \ %{symbolic:-Bsymbolic}" + +#undef MULTILIB_DEFAULTS +#define MULTILIB_DEFAULTS { "m64" } Index: config/i386/t-freebsd64 =================================================================== --- config/i386/t-freebsd64 (nonexistent) +++ config/i386/t-freebsd64 (working copy) @@ -0,0 +1,30 @@ +# Copyright (C) 2019 Free Software Foundation, Inc. +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# The 32-bit libraries are found in /usr/lib32 + +# To support i386 and x86-64, the directory structrue +# should be: +# +# /lib has x86-64 libraries. +# /lib32 has i386 libraries. +# + +MULTILIB_OPTIONS = m32 +MULTILIB_DIRNAMES = 32 +MULTILIB_OSDIRNAMES = ../lib32 Index: config.gcc =================================================================== --- config.gcc (revision 269746) +++ config.gcc (working copy) @@ -4925,8 +4925,11 @@ ;; i[34567]86-*-dragonfly* | x86_64-*-dragonfly*) ;; - i[34567]86-*-freebsd* | x86_64-*-freebsd*) + i[34567]86-*-freebsd*) ;; + x86_64-*-freebsd*) + tmake_file="${tmake_file} i386/t-freebsd64" + ;; ia64*-*-linux*) ;;