Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp107661imm; Thu, 7 Jun 2018 14:45:48 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLyp57mShHvE3Bx+OzfHOCzqPXNtt5wh13zReYdDzwXg2kesUwh+W8p9lQ0F+Rvu1qsdefn X-Received: by 2002:a63:6142:: with SMTP id v63-v6mr2846766pgb.390.1528407948403; Thu, 07 Jun 2018 14:45:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528407948; cv=none; d=google.com; s=arc-20160816; b=MM6a5BW1gPgPrKM221TMZoT/rxjrb/0HrbadQEih/Ng/bYh+4fUinUIlBPcfD32h7V kOgS5gvwLVEVD+eWJvTxo6o9uBro02ysf7TOaxRZhMfWj/aVKPyYST8RxEK1yl1+l1mr H42uAPWfrKPH+dAc7dWqmafWBiMkD8VbQ5IAyDnm3bbbnqtT2x+dKvvaJmzVYC83N6QY tH7Egv1jnak7Xk85UClegZNI2hhLEHVx5i7FAN7l0pXebPJ5PuThv/0UDYnhx2rUiL/a OmhJZVZ3FOR2xMHMhlN8MGJ/h5y0s+BAsRlVNHifjqgySnbn8EJWDEkQ1NdMBhA35xSC MoWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:arc-authentication-results; bh=y/uNcp7Wu4DEchIu621YW2qvpe+ujcBIyrW9eND/AjI=; b=GXRRUqofCFmyzKEKkVrXmiLeac/r87NcMLAIIIQ1zgKV75zEpX3vypKeckT5g2EBcC SHlEY0VGLBH6m0KkTH3INMGczeVNyKbaeCGTwX/po/8gXQSgRGkTurVBjYth2UdmRH6n iDDeH49eKtq6U54F6V+EjlWds//O/UBxP+TIADKiWkCaOAE4ALsEdRPkTYJl/shxIqxE x8Bs9Gla/54u6SjdhxbcZMH/6QpkyblhflTvsvzG2HxWFYhDqCjr8n2Fg5Ks2ZkwgJFM tfgLQFZtZwmCsVq1GKfohvR5V+/Frcw60IPvhzwVv+qH5DMjWIL2CQBX716UIsAUTCKy u2Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DhA6EhCI; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z3-v6si878729pgp.527.2018.06.07.14.45.34; Thu, 07 Jun 2018 14:45:48 -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; dkim=pass header.i=@linaro.org header.s=google header.b=DhA6EhCI; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752769AbeFGVns (ORCPT + 99 others); Thu, 7 Jun 2018 17:43:48 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:33091 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752615AbeFGVnq (ORCPT ); Thu, 7 Jun 2018 17:43:46 -0400 Received: by mail-pl0-f65.google.com with SMTP id n10-v6so6959447plp.0 for ; Thu, 07 Jun 2018 14:43:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=y/uNcp7Wu4DEchIu621YW2qvpe+ujcBIyrW9eND/AjI=; b=DhA6EhCIbO9OmOZKLcSfFoPfuR+ERL3V7TQCjxbcekpj11z9ftwe7HW8P4KA2qMxsz dzv6xoLTTn4jaNhJiV4K4MbWD/0EY2dVknbjymanL3VacUKLwdkG51RcHQbXYjV82+Xt A2EcYRKEEhK/4aV+FEil9rfGcl12GbydfAZLA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=y/uNcp7Wu4DEchIu621YW2qvpe+ujcBIyrW9eND/AjI=; b=QJAhFOYxnxejviN0t/TMl16s2rKME/NPqSlq2jUP7eZzZRzolSAEOS604Wuk4O9Sqc 1sFDf4IGjyvBrj+PdHqSbliNm8SrDhVzWBbjW/h73ET13FyMEUjtRWxezmcQola4rmPb l5mLLazI+prFkHxERQGy0qrtr0miVHPWuYgktKCwqo0Y0ixn1jhtW40KvB9tJ9rgawfm NiPzYQXLLjBHxHkPUkOIR1t4gWST6OkxzRw62zUvEtviNXpYunkVtVKxjstLRjc3/5n2 dywxiH2dvzyN1CukoaKOFUHTr3oVTE7tGPWhvGpot1Y0Wt1YSkmZywM63aPKCPmrsWPl NwUg== X-Gm-Message-State: APt69E1FTdcBsEIV1+FsxZdWdmc2C1DVtW5iyo5Yq6CgmWTbW5VrZ84M 2TkJx2XncQxs96vtPGHMSEdJN6006MclyouS21uOQQ== X-Received: by 2002:a17:902:9309:: with SMTP id bc9-v6mr3691706plb.189.1528407825705; Thu, 07 Jun 2018 14:43:45 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a17:90a:178d:0:0:0:0 with HTTP; Thu, 7 Jun 2018 14:43:45 -0700 (PDT) In-Reply-To: References: <20180607105712.553-1-anders.roxell@linaro.org> From: Anders Roxell Date: Thu, 7 Jun 2018 23:43:45 +0200 Message-ID: Subject: Re: [PATCH] selftests: bpf: fix urandom_read build issue To: Y Song Cc: Alexei Starovoitov , Daniel Borkmann , Shuah Khan , netdev , LKML , linux-kselftest@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7 June 2018 at 23:17, Y Song wrote: > On Thu, Jun 7, 2018 at 12:07 PM, Anders Roxell = wrote: >> On 7 June 2018 at 19:52, Y Song wrote: >>> On Thu, Jun 7, 2018 at 3:57 AM, Anders Roxell wrote: >>>> gcc complains that urandom_read gets built twice. >>>> >>>> gcc -o tools/testing/selftests/bpf/urandom_read >>>> -static urandom_read.c -Wl,--build-id >>>> gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../lib/bp= f >>>> -I../../../../include/generated -I../../../include urandom_read.c >>>> urandom_read -lcap -lelf -lrt -lpthread -o >>>> tools/testing/selftests/bpf/urandom_read >>>> gcc: fatal error: input file >>>> =E2=80=98tools/testing/selftests/bpf/urandom_read=E2=80=99 is the >>>> same as output file >>>> compilation terminated. >>>> ../lib.mk:110: recipe for target >>>> 'tools/testing/selftests/bpf/urandom_read' failed >>> >>> What is the build/make command to reproduce the above failure? >> >> make -C tools/testing/selftests > > Thanks. The patch will break > make -C tools/testing/selftests/bpf > > [yhs@localhost bpf-next]$ make -C tools/testing/selftests/bpf > make: Entering directory '/home/yhs/work/bpf-next/tools/testing/selftests= /bpf' > gcc -o /urandom_read -static urandom_read.c -Wl,--build-id > /usr/bin/ld: cannot open output file /urandom_read: Permission denied > collect2: error: ld returned 1 exit status > make: *** [Makefile:20: /urandom_read] Error 1 > make: Leaving directory '/home/yhs/work/bpf-next/tools/testing/selftests/= bpf' > [yhs@localhost bpf-next]$ urgh, I'm sorry, missed that. > > Could you still make the above command work? $(TEST_CUSTOM_PROGS): $(OUTPUT)/%: %.c $(CC) -o $(TEST_CUSTOM_PROGS) -static $< -Wl,--build-id That worked both with: make -C tools/testing/selftests and make -C tools/testing/selftests/bpf for me. what do you think? > >> >> Cheers, >> Anders >> >>> >>>> To fix this issue remove the urandom_read target and so target >>>> TEST_CUSTOM_PROGS gets used. >>>> >>>> Fixes: 81f77fd0deeb ("bpf: add selftest for stackmap with BPF_F_STACK_= BUILD_ID") >>>> Signed-off-by: Anders Roxell >>>> --- >>>> tools/testing/selftests/bpf/Makefile | 6 ++---- >>>> 1 file changed, 2 insertions(+), 4 deletions(-) >>>> >>>> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/self= tests/bpf/Makefile >>>> index 607ed8729c06..67285591ffd7 100644 >>>> --- a/tools/testing/selftests/bpf/Makefile >>>> +++ b/tools/testing/selftests/bpf/Makefile >>>> @@ -16,10 +16,8 @@ LDLIBS +=3D -lcap -lelf -lrt -lpthread >>>> TEST_CUSTOM_PROGS =3D $(OUTPUT)/urandom_read >>>> all: $(TEST_CUSTOM_PROGS) >>>> >>>> -$(TEST_CUSTOM_PROGS): urandom_read >>>> - >>>> -urandom_read: urandom_read.c >>>> - $(CC) -o $(TEST_CUSTOM_PROGS) -static $< -Wl,--build-id >>>> +$(TEST_CUSTOM_PROGS): $(OUTPUT)/%: %.c >>>> + $(CC) -o $@ -static $< -Wl,--build-id >>>> >>>> # Order correspond to 'make run_tests' order >>>> TEST_GEN_PROGS =3D test_verifier test_tag test_maps test_lru_map test= _lpm_map test_progs \ >>>> -- >>>> 2.17.1 >>>>