From patchwork Tue Oct 23 20:56:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10653659 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0EDFC13B5 for ; Tue, 23 Oct 2018 20:57:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE2E528514 for ; Tue, 23 Oct 2018 20:57:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2EAF2A446; Tue, 23 Oct 2018 20:57:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 747EF2A2C2 for ; Tue, 23 Oct 2018 20:57:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726992AbeJXFWN (ORCPT ); Wed, 24 Oct 2018 01:22:13 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:37784 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725787AbeJXFWN (ORCPT ); Wed, 24 Oct 2018 01:22:13 -0400 Received: by mail-pf1-f194.google.com with SMTP id j23-v6so1281860pfi.4 for ; Tue, 23 Oct 2018 13:57:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=p/PhedSQiFd94zuucVihNQjNbF2ctx6Y5jsWQLDry7o=; b=MZi1IUe/hVtW/N7hWtb4KHJO5vNzMITWHSW+iouMt6LA+jG1xGoE1iRcNyaUaouIJC tG1JRhJUOl2QJ3F9XiIFcdweAqWnfd73nvSHK0EBMF2vr2XehDz7DLagWdm0v4Pjezga Mj/Pigw9qTPYOexzJmY6ruvCRvRqmLHiHrhPXBOhao0nYB7TMv6jgpmBm1JmBCSYGOvW yYfYgh7wlYc+zKyPyZyB+JODedQkotW3mVCICT0S8LJMFnFTlaDmPrA6N5vyFfYUZVcm wBJuS7VqoHFjscNR29zsMssrFj9GUpM1uDO+QPzgjjJ3XJ4VjRIXqnyO7L6gO1V2qNAL Zppw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=p/PhedSQiFd94zuucVihNQjNbF2ctx6Y5jsWQLDry7o=; b=YseRrKd9AosjaPGQiWaiHtKQp33YKBQsKjJBjT7+qWqeic9VDT2VarZcKuT+8/krcM ZT8u3nx/itdsMMql8nv4Gzx5shQ2Fhgl/lJmNMBGLCrNQJxf44gqFODp2eowjnk5kdoP VYBv9ouisbQ/6lY4F2oO9yo1d2vQdrOmN9jG/ZBuFC/WRMi8fyUT2di1LcTxEwfjhzy4 8RMSEMqN4I8W8dzJIWWFZ0rAH+/466H1mdlUWa4DMxnN36Oe/VCOyv9IsNelnU9UqbTQ ew+oUbipsvGXjdMgU3/nKMPulhzK+ZGeH/J/m+/JiMlsHnrdmysael39KfYekFbnA8wb 8qfg== X-Gm-Message-State: AGRZ1gLOSVHk2WtU6tC0JgV72e3aj7wmtnBQHG5PrNE8M6xIKuhItX5U erCc4K3ViyUJoBnbaSIzaYc2OtCWnwk= X-Google-Smtp-Source: AJdET5foUB6/gvyhXW18omSIzauTL2GumpL56u8cBu6Q28UkzAz3WoaylJg6N7DRGKtU1x0it6hniQ== X-Received: by 2002:a63:f91e:: with SMTP id h30-v6mr13568990pgi.154.1540328228021; Tue, 23 Oct 2018 13:57:08 -0700 (PDT) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [174.3.196.123]) by smtp.gmail.com with ESMTPSA id a11-v6sm2621830pgw.54.2018.10.23.13.57.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Oct 2018 13:57:06 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1gF3jc-000101-M2; Tue, 23 Oct 2018 14:57:04 -0600 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH rdma-core 0/9] Build static libraries in rdma-core Date: Tue, 23 Oct 2018 14:56:52 -0600 Message-Id: <20181023205701.3729-1-jgg@ziepe.ca> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jason Gunthorpe Restore static library support. Before rdma-core we did produce some simplistic static libraries, and this was lost when things became more complicated. This version is a complete solution and provides a simple way for applications to use the static libraries, including static providers, without having to resort to strange linker options. The man page libibverbs/man/ibv_get_device_list.3.md explains how the new linking mechanism works, and the buildlib/sanitize_static_lib.py is an exploration in why this is so hard. Jason Gunthorpe (9): verbs: Move all dynamic driver opening code to dynamic_driver.c verbs: Do not include dynamic loading in static libraries Generate complete and sanitized static libraries pkg-config: If static libraries are enabled add Requires.private Add a travis test for static libraries verbs: Expose the struct verbs_device_ops for each provider to the linker verbs: Add RDMA_STATIC_PROVIDERS debian: Include static libraries in the build rpm: Include static libraries in the build CMakeLists.txt | 3 + buildlib/cbuild | 1 + buildlib/check-build | 174 +++++++++++++++ buildlib/rdma_functions.cmake | 94 +++++--- buildlib/sanitize_static_lib.py | 278 ++++++++++++++++++++++++ buildlib/travis-build | 2 +- debian/control | 2 + debian/libibumad-dev.install | 1 + debian/libibverbs-dev.install | 4 + debian/librdmacm-dev.install | 1 + debian/rules | 1 + libibverbs/CMakeLists.txt | 31 ++- libibverbs/all_providers.c | 53 +++++ libibverbs/driver.h | 14 +- libibverbs/dynamic_driver.c | 241 ++++++++++++++++++++ libibverbs/ibverbs.h | 8 + libibverbs/init.c | 206 ------------------ libibverbs/man/ibv_get_device_list.3.md | 20 ++ libibverbs/static_driver.c | 52 +++++ libibverbs/verbs.h | 50 +++++ providers/bnxt_re/main.c | 2 +- providers/cxgb3/iwch.c | 2 +- providers/cxgb4/dev.c | 2 +- providers/hfi1verbs/hfiverbs.c | 2 +- providers/hns/hns_roce_u.c | 2 +- providers/i40iw/i40iw_umain.c | 2 +- providers/ipathverbs/ipathverbs.c | 2 +- providers/mlx4/mlx4.c | 2 +- providers/mlx5/mlx5.c | 2 +- providers/mthca/mthca.c | 2 +- providers/nes/nes_umain.c | 2 +- providers/ocrdma/ocrdma_main.c | 2 +- providers/qedr/qelr_main.c | 2 +- providers/rxe/rxe.c | 2 +- providers/vmw_pvrdma/pvrdma_main.c | 2 +- redhat/rdma-core.spec | 7 + suse/rdma-core.spec | 8 + 37 files changed, 1022 insertions(+), 259 deletions(-) create mode 100644 buildlib/sanitize_static_lib.py create mode 100644 libibverbs/all_providers.c create mode 100644 libibverbs/dynamic_driver.c create mode 100644 libibverbs/static_driver.c