From patchwork Tue Nov 27 22:28:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 1004067 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-491046-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=CeBiTec.Uni-Bielefeld.DE Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="afIkiXUF"; 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 434JN84V4fz9s3C for ; Wed, 28 Nov 2018 09:28:38 +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:from :to:cc:subject:date:message-id:mime-version:content-type; q=dns; s=default; b=ESzGBdriA6FWb+8bT+4cQ2a5l1cHd5kk0C+oMDsUA7SwlejXNh VFe6ztJxSKCfLx9bTSj9HMNqzrg8fcED7iA0IzqMaHAmbdJjNHev1Arte62LBzHs UWQ8b7XwutHDOtGIgeXpjNC+um68d4rivW1dc01MLeZn/ZsDJ84jt/3eE= 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:from :to:cc:subject:date:message-id:mime-version:content-type; s= default; bh=jsfNRYZH0Z62PJIaIGccGYp37gc=; b=afIkiXUFdBqN143W1ofV 3dt/nvChDsc0fQFK7F0QFV9Hgh9DHkTww1TWNUhDw0/CjTfdz+SECer98Nreal5r y7BCWuBgXrCO0NqeFKZW7uDDNNt8aoLJmBvhnZOXl7v939RWmaPG7XdHj8PyJTqB 1PANw7JsH9PobdVarn/ij3k= Received: (qmail 70801 invoked by alias); 27 Nov 2018 22:28:32 -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 70788 invoked by uid 89); 27 Nov 2018 22:28:31 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, KAM_NUMSUBJECT autolearn=ham version=3.3.2 spammy= X-HELO: smtp.CeBiTec.Uni-Bielefeld.DE Received: from smtp.CeBiTec.Uni-Bielefeld.DE (HELO smtp.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 27 Nov 2018 22:28:28 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id D4F488F0; Tue, 27 Nov 2018 23:28:23 +0100 (CET) Received: from smtp.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id tsaMcpSDM37t; Tue, 27 Nov 2018 23:28:21 +0100 (CET) Received: from manam.CeBiTec.Uni-Bielefeld.DE (p4FDDBC5E.dip0.t-ipconnect.de [79.221.188.94]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPSA id 0975B8EF; Tue, 27 Nov 2018 23:28:20 +0100 (CET) From: Rainer Orth To: gcc-patches@gcc.gnu.org Cc: Iain Buclaw Subject: [build] Fix libgphobos linking on Solaris 11 Date: Tue, 27 Nov 2018 23:28:19 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes As mentioned in passing in PR d/87864, libgphobos.so currently fails to link before Solaris 11.4. Until then, you needed to link with -lsocket -lnsl for the networking functions, in S11.4 they were merged into libc. To fix this, I've adapted the check from libgo/configure.ac, for the moment just moving it into an autoconf macro, reindenting it, renaming the variables for the new location, and removing the check for sendfile which isn't used in libphobos. With that patch (and the one from PR d/87864 to provide __start_minfo/__stop_minfo when ld does not), I could bootstrap with --enable-libphobos on i386-pc-solaris2.11 with gas and sparc-sun-solaris2.11 with as on both S11.3 and S11.4. On the former, libsocket and libnsl were properly detected and linked into libgdruntime.so and libgphobos.so, leaving no undefined symbols, while on the latter nothing more than libc is needed. Ok for mainline? Rainer # HG changeset patch # Parent 8068f906d5f73ddb769b1241419ed3a330243e2b Fix libphobos linking on Solaris 11 diff --git a/libphobos/configure.ac b/libphobos/configure.ac --- a/libphobos/configure.ac +++ b/libphobos/configure.ac @@ -140,6 +140,7 @@ WITH_LOCAL_DRUNTIME([ DRUNTIME_LIBRARIES_ATOMIC DRUNTIME_LIBRARIES_BACKTRACE DRUNTIME_LIBRARIES_DLOPEN +DRUNTIME_LIBRARIES_NET DRUNTIME_LIBRARIES_ZLIB DRUNTIME_INSTALL_DIRECTORIES diff --git a/libphobos/m4/druntime/libraries.m4 b/libphobos/m4/druntime/libraries.m4 --- a/libphobos/m4/druntime/libraries.m4 +++ b/libphobos/m4/druntime/libraries.m4 @@ -42,6 +42,40 @@ AC_DEFUN([DRUNTIME_LIBRARIES_DLOPEN], ]) +# DRUNTIME_LIBRARIES_NET +# ----------------------- +# Autodetect and add networking library to LIBS if necessary. +AC_DEFUN([DRUNTIME_LIBRARIES_NET], +[ + dnl Test for -lsocket and -lnsl. Copied from libjava/configure.ac. + AC_CACHE_CHECK([for socket libraries], druntime_cv_lib_sockets, + [druntime_cv_lib_sockets= + druntime_check_both=no + AC_CHECK_FUNC(connect, druntime_check_socket=no, druntime_check_socket=yes) + if test "$druntime_check_socket" = "yes"; then + unset ac_cv_func_connect + AC_CHECK_LIB(socket, main, druntime_cv_lib_sockets="-lsocket", + druntime_check_both=yes) + fi + if test "$druntime_check_both" = "yes"; then + druntime_old_libs=$LIBS + LIBS="$LIBS -lsocket -lnsl" + unset ac_cv_func_accept + AC_CHECK_FUNC(accept, + [druntime_check_nsl=no + druntime_cv_lib_sockets="-lsocket -lnsl"]) + unset ac_cv_func_accept + LIBS=$druntime_old_libs + fi + unset ac_cv_func_gethostbyname + druntime_old_libs="$LIBS" + AC_CHECK_FUNC(gethostbyname, , + [AC_CHECK_LIB(nsl, main, + [druntime_cv_lib_sockets="$druntime_cv_lib_sockets -lnsl"])]) + ]) + LIBS="$LIBS $druntime_cv_lib_sockets" +]) + # DRUNTIME_LIBRARIES_ZLIB # ----------------------- # Allow specifying whether to use the system zlib or