Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp695855img; Wed, 20 Mar 2019 08:59:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqy7ni2UqpU86Lja5czklVVnyui6FjbArCrZUuOkSmosMxcHLviNmdKosppKut3StcmoS+7M X-Received: by 2002:a63:cf4d:: with SMTP id b13mr8104106pgj.329.1553097591311; Wed, 20 Mar 2019 08:59:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553097591; cv=none; d=google.com; s=arc-20160816; b=zTyPODg0QIAwAO0VCOIvM1AzKIhJvJCh4ne670ARxQqI7nueVQyno63OubMURtnQHX 1w0vQo7oQ2s0LVK9YnpLQ+/C9IG53Zd2t24BHZR3jkt6RwA11AS/jqkzLHca5QA7Whfn eclYRb5ZM7/7y7ZEMrXrts+jU6piZI8GTYz8/rriU7z+woi3OGc4RS/QE06PpRpqcISo q/+KUio1QOMZPH+KmJuVhr6mogF3EhVbpO37YhbfrxDHuUIaMKLHi0HvB+rWbnHgwOon DzHJL8+YFLxnqZFhH7YHJUpljngVDGq4Xvktxso//PnOEcCrZH3Zn3X0wmrYmXCxKjs1 1HKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :organization:message-id:date:subject:cc:to:from; bh=1NtlAojrL3G2EZ5mIbF+9Lk7EMKjOL5gIDPmTXps1C0=; b=D3z4YNk1RdbrDUCRVK2ec0ilsTF3kQIf+XvDWwDBuye1V8LEoG1QXetBata5GpZvxM uUhv6tNXEw3P0qv/f9xsUxD/CoQG9S6+ddkLhFznVlZ2lXMlEROu/OEmX73RVokJfN28 r9ZFo5zO+1Nv84dMHJl91gjGVA1oFcKdC3D9sH3zZejsIkn+OqYZGpGQr0tWnqetvzE9 iKfH9jwfm0N7DWKXMHEZ/NGUaLNoSU+w6AKhyMmD8joqB/9HeUr3D0G+kCEfNwXZPF6V U+4MVx92o+0hMyGPqJKYw69Hh+9TbvTcdDTs8wk5Bt9nk+ZLZS2UdMP1Hvdmi32cIc11 VExg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9si2133460plz.207.2019.03.20.08.59.36; Wed, 20 Mar 2019 08:59:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727197AbfCTP6a (ORCPT + 99 others); Wed, 20 Mar 2019 11:58:30 -0400 Received: from mx1.emlix.com ([188.40.240.192]:39302 "EHLO mx1.emlix.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726295AbfCTP6a (ORCPT ); Wed, 20 Mar 2019 11:58:30 -0400 Received: from mailer.emlix.com (unknown [81.20.119.6]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.emlix.com (Postfix) with ESMTPS id 2F58560974; Wed, 20 Mar 2019 16:58:27 +0100 (CET) From: Rolf Eike Beer To: Josh Poimboeuf Cc: Peter Zijlstra , Masahiro Yamada , Michal Marek , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] objtool: query pkg-config for libelf location Date: Wed, 20 Mar 2019 16:58:26 +0100 Message-ID: <13510794.yptIvAPcpm@devpool35> Organization: emlix GmbH In-Reply-To: <13279932.E8cnC9vheV@devpool35> References: <3381642.TeJ1gWjbju@devpool35> <20190320153701.7wym7btpjshdujpz@treble> <13279932.E8cnC9vheV@devpool35> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart194142787.bmJb0Oii2C"; micalg="pgp-sha256"; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --nextPart194142787.bmJb0Oii2C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" If it is not in the default location compilation would fail at several poin= ts. Signed-off-by: Rolf Eike Beer =2D-- Changes in v2: -also hide stderr when querying cflags -use ":=3D" assignment as in other places in that file Makefile | 4 +++- tools/objtool/Makefile | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 99c0530489ef..32caf30e0d79 100644 =2D-- a/Makefile +++ b/Makefile @@ -950,9 +950,11 @@ mod_sign_cmd =3D true endif export mod_sign_cmd =20 +HOST_LIBELF_LIBS =3D $(shell pkg-config libelf --libs 2>/dev/null || echo = =2Dlelf) + ifdef CONFIG_STACK_VALIDATION has_libelf :=3D $(call try-run,\ =2D echo "int main() {}" | $(HOSTCC) -xc -o /dev/null -lelf -,1,0) + echo "int main() {}" | $(HOSTCC) -xc -o /dev/null $(HOST_LIBELF_LIBS) -,= 1,0) ifeq ($(has_libelf),1) objtool_target :=3D tools/objtool FORCE else diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile index c9d038f91af6..53f8be0f4a1f 100644 =2D-- a/tools/objtool/Makefile +++ b/tools/objtool/Makefile @@ -25,14 +25,17 @@ LIBSUBCMD =3D $(LIBSUBCMD_OUTPUT)libsubcmd.a OBJTOOL :=3D $(OUTPUT)objtool OBJTOOL_IN :=3D $(OBJTOOL)-in.o =20 +LIBELF_FLAGS :=3D $(shell pkg-config libelf --cflags 2>/dev/null) +LIBELF_LIBS :=3D $(shell pkg-config libelf --libs 2>/dev/null || echo -le= lf) + all: $(OBJTOOL) =20 INCLUDES :=3D -I$(srctree)/tools/include \ -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \ -I$(srctree)/tools/objtool/arch/$(ARCH)/include WARNINGS :=3D $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-= packed =2DCFLAGS +=3D -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) =2DLDFLAGS +=3D -lelf $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS) +CFLAGS +=3D -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) $(LI= BELF_FLAGS) +LDFLAGS +=3D $(LIBELF_LIBS) $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS) =20 # Allow old libelf to be used: elfshdr :=3D $(shell echo '$(pound)include ' | $(CC) $(CFLAGS) -= x c -E - | grep elf_getshdr) =2D-=20 2.21.0 =2D-=20 Rolf Eike Beer, emlix GmbH, http://www.emlix.com =46on +49 551 30664-0, Fax +49 551 30664-11 Gothaer Platz 3, 37083 G=C3=B6ttingen, Germany Sitz der Gesellschaft: G=C3=B6ttingen, Amtsgericht G=C3=B6ttingen HR B 3160 Gesch=C3=A4ftsf=C3=BChrung: Heike Jordan, Dr. Uwe Kracke =E2=80=93 Ust-IdNr= =2E: DE 205 198 055 emlix - smart embedded open source --nextPart194142787.bmJb0Oii2C Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iLMEAAEIAB0WIQQ/Uctzh31xzAxFCLur5FH7Xu2t/AUCXJJjIgAKCRCr5FH7Xu2t /NZ7BACpB60Da6TrDmonXevR/QLyiB2e4aXkrxudE7zI5BDguxJQGeUj+F/NEJSJ CVs/QBu7oXqzk//gY5Z/dakN1ugRscaXOkgjPigrtpGEdrNSaaSWsJfFnBwQy35m 3aobqr8gOre7au3lFu+Znli0sgUPTf81eCm4qlA52TeClh105g== =0t79 -----END PGP SIGNATURE----- --nextPart194142787.bmJb0Oii2C--