From patchwork Fri Sep 11 16:37:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elliott Mitchell X-Patchwork-Id: 11771595 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2AD2B6CA for ; Sat, 12 Sep 2020 03:07:32 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E778C221EB for ; Sat, 12 Sep 2020 03:07:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E778C221EB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=m5p.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kGvqY-0005K7-RK; Sat, 12 Sep 2020 03:05:02 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kGvqX-0005K2-44 for xen-devel@lists.xenproject.org; Sat, 12 Sep 2020 03:05:01 +0000 X-Inumbo-ID: a35426ad-957f-4ee4-b358-ea7f69ce5175 Received: from mailhost.m5p.com (unknown [74.104.188.4]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id a35426ad-957f-4ee4-b358-ea7f69ce5175; Sat, 12 Sep 2020 03:04:58 +0000 (UTC) Received: from m5p.com (mailhost.m5p.com [IPv6:2001:470:1f07:15ff:0:0:0:f7]) by mailhost.m5p.com (8.15.2/8.15.2) with ESMTPS id 08C34lwq057828 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 11 Sep 2020 23:04:53 -0400 (EDT) (envelope-from ehem@m5p.com) Received: (from ehem@localhost) by m5p.com (8.15.2/8.15.2/Submit) id 08C34lXv057827; Fri, 11 Sep 2020 20:04:47 -0700 (PDT) (envelope-from ehem) Message-Id: <202009120304.08C34lXv057827@m5p.com> From: Elliott Mitchell To: xen-devel@lists.xenproject.org Cc: Ian Jackson Cc: Wei Liu Cc: =?unknown-8bit?q?=22Marek_Marczykowski-G=C3=B3recki=22_=3Cmarmarek=40inv?= =?unknown-8bit?q?isiblethingslab=2Ecom=3E?= Date: Fri, 11 Sep 2020 09:37:35 -0700 Subject: [PATCH] tools/python: Pass linker to Python build process X-Spam-Status: No, score=1.1 required=10.0 tests=DATE_IN_PAST_06_12, KHOP_HELO_FCRDNS autolearn=no autolearn_force=no version=3.4.4 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mattapan.m5p.com X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Unexpectedly the environment variable which needs to be passed is $LDSHARED and not $LD. Otherwise Python may find the build `ld` instead of the host `ld`. Replace $(LDFLAGS) with $(SHLIB_LDFLAGS) as Python needs shared objects it can load at runtime, not executables. This uses $(CC) instead of $(LD) since Python distutils appends $CFLAGS to $LDFLAGS which breaks many linkers. Signed-off-by: Elliott Mitchell --- tools/pygrub/Makefile | 9 +++++---- tools/python/Makefile | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/tools/pygrub/Makefile b/tools/pygrub/Makefile index 3063c4998f..37b2146214 100644 --- a/tools/pygrub/Makefile +++ b/tools/pygrub/Makefile @@ -3,20 +3,21 @@ XEN_ROOT = $(CURDIR)/../.. include $(XEN_ROOT)/tools/Rules.mk PY_CFLAGS = $(CFLAGS) $(PY_NOOPT_CFLAGS) -PY_LDFLAGS = $(LDFLAGS) $(APPEND_LDFLAGS) +PY_LDFLAGS = $(SHLIB_LDFLAGS) $(APPEND_LDFLAGS) INSTALL_LOG = build/installed_files.txt .PHONY: all all: build .PHONY: build build: - CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) setup.py build + CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDSHARED="$(CC)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) setup.py build .PHONY: install install: all $(INSTALL_DIR) $(DESTDIR)/$(bindir) - CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) \ - setup.py install --record $(INSTALL_LOG) $(PYTHON_PREFIX_ARG) \ + CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDSHARED="$(CC)" \ + LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) setup.py install \ + --record $(INSTALL_LOG) $(PYTHON_PREFIX_ARG) \ --root="$(DESTDIR)" --install-scripts=$(LIBEXEC_BIN) --force set -e; if [ $(bindir) != $(LIBEXEC_BIN) -a \ "`readlink -f $(DESTDIR)/$(bindir)`" != \ diff --git a/tools/python/Makefile b/tools/python/Makefile index 8d22c03676..b675f5b4de 100644 --- a/tools/python/Makefile +++ b/tools/python/Makefile @@ -5,19 +5,20 @@ include $(XEN_ROOT)/tools/Rules.mk all: build PY_CFLAGS = $(CFLAGS) $(PY_NOOPT_CFLAGS) -PY_LDFLAGS = $(LDFLAGS) $(APPEND_LDFLAGS) +PY_LDFLAGS = $(SHLIB_LDFLAGS) $(APPEND_LDFLAGS) INSTALL_LOG = build/installed_files.txt .PHONY: build build: - CC="$(CC)" CFLAGS="$(PY_CFLAGS)" $(PYTHON) setup.py build + CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDSHARED="$(CC)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) setup.py build .PHONY: install install: $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN) - CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) \ - setup.py install --record $(INSTALL_LOG) $(PYTHON_PREFIX_ARG) \ + CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDSHARED="$(CC)" \ + LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) setup.py install \ + --record $(INSTALL_LOG) $(PYTHON_PREFIX_ARG) \ --root="$(DESTDIR)" --force $(INSTALL_PYTHON_PROG) scripts/convert-legacy-stream $(DESTDIR)$(LIBEXEC_BIN)