Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp488090imm; Wed, 25 Jul 2018 00:23:08 -0700 (PDT) X-Google-Smtp-Source: AAOMgpftv1JRor07WzVmFSFhYfnJ0+NxSdVQUzliyovANfHTTQKcWC9ewOu3qVlJqQtdt3Z10E0S X-Received: by 2002:a17:902:292b:: with SMTP id g40-v6mr20123104plb.273.1532503388534; Wed, 25 Jul 2018 00:23:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532503388; cv=none; d=google.com; s=arc-20160816; b=K0QpCTXzOBGpczWX7vIgnm2pgFmo8xFMRz/yxT93ucFFf+LcoGw4Y1AUFoLqRbahSp ZQXu4WO5iYtwGjXLC5ff+vKiS1v6BhfZrbm2V971+YUo378AGa8qCGifP0RmsFjD9YkO pJrj3pPO+z+djenGOKy6C+7Tf7qXW1kgVMoBlo39ZQn0d+5FfaKmPfXZp0rG9IoaH14Y NgzAJe+hHaGPzK17w++xT3GbNviEBNFjiv+/P444Pr9kZwc5dBvjrj7guxFAbDnKkq9H BHMEEa4rT/7t7g3bbCHe26sF9yjQAdQjt4Ebymyg2JKlksq01fF0tt9LjW+/pmNKiK75 1ZSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:date:subject:cc:to:from:arc-authentication-results; bh=sKZTC6YM0astJxKgtdJeGNjDCI2EL1WR1JvqPmB7UCM=; b=Hcka8HK/IJ/cgSACnndTskt8i6XrgiUURasZVwpZ4rgQdU/hLdhe0zbluDqrZ+f6CL /SbsKSylZc83NWkDSU+QaM3MbHNAl6nHdtZRowf9eef0VqrUhucnAoklXoulmlVMZ4vz OPy++osj8FhhFSzPazQLh/e1Be5ZqIV+uquOEVOXJEg4xS2Gv0d4CGGuQipdhR2e9T+4 WwwcUKVPwcMoNUQgCTOta56lhpgQRyjwPQxYqMo1u5fSTQmjvn/inJ5pBc7t/fNA6RgM 4sFkbwOoo+xz/1LJtoMOLkEL81KC8Na7p7yhxR0wFle4pOZYXIDzTUMGa0aVSWNCjR5L HlyQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p1-v6si7755504pfb.280.2018.07.25.00.22.53; Wed, 25 Jul 2018 00:23:08 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728497AbeGYIcK (ORCPT + 99 others); Wed, 25 Jul 2018 04:32:10 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:45806 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728316AbeGYIcK (ORCPT ); Wed, 25 Jul 2018 04:32:10 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w6P7EQ84083020 for ; Wed, 25 Jul 2018 03:21:47 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0b-001b2d01.pphosted.com with ESMTP id 2kejttcxw2-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 25 Jul 2018 03:21:47 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 25 Jul 2018 08:21:45 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 25 Jul 2018 08:21:44 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w6P7LhaH37421204 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 25 Jul 2018 07:21:43 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7B706AE055; Wed, 25 Jul 2018 10:21:51 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1EE0DAE061; Wed, 25 Jul 2018 10:21:51 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 25 Jul 2018 10:21:51 +0100 (BST) From: Thomas Richter To: daniel@iogearbox.net, ast@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: heiko.carstens@de.ibm.com, brueckner@linux.vnet.ibm.com, schwidefsky@de.ibm.com, wangnan0@huawei.com, Thomas Richter Subject: [PATCH v2] perf build: Build error in libbpf with EXTRA_CFLAGS="-Wp,-D_FORTIFY_SOURCE=2 -O2" Date: Wed, 25 Jul 2018 09:21:26 +0200 X-Mailer: git-send-email 2.16.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 18072507-0016-0000-0000-000001EB1B08 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18072507-0017-0000-0000-0000323FFC34 Message-Id: <20180725072126.2232-1-tmricht@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-07-25_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807250082 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit a5b8bd47dcc57 ("bpf tools: Collect eBPF programs from their own sections") causes a compiler error when building the perf tool in the linux-next tree. I compile it using a FEDORA 28 installation, my gcc compiler version: gcc (GCC) 8.0.1 20180324 (Red Hat 8.0.1-0.20) The file that causes the error is tools/lib/bpf/libbpf.c Here is the error message: [root@p23lp27] # make V=1 EXTRA_CFLAGS="-Wp,-D_FORTIFY_SOURCE=2 -O2" [...] make -f /home6/tmricht/linux-next/tools/build/Makefile.build dir=./util/scripting-engines obj=libperf libbpf.c: In function ‘bpf_object__elf_collect’: libbpf.c:811:15: error: ignoring return value of ‘strerror_r’, declared with attribute warn_unused_result [-Werror=unused-result] strerror_r(-err, errmsg, sizeof(errmsg)); ^ cc1: all warnings being treated as errors mv: cannot stat './.libbpf.o.tmp': No such file or directory /home6/tmricht/linux-next/tools/build/Makefile.build:96: recipe for target 'libbpf.o' failed Since this is the only occurance of strerror_r() replace it by strerror(). The additional functionality of strerror_r() to copy the error message into the supplied buffer is not needed. This is also consistant with all the other pr_warning() statements in this file which all use strerror(). Also fixes a possible initialization issue. Cc: Wang Nan Cc: Alexei Starovoitov Cc: Daniel Borkmann Signed-off-by: Thomas Richter --- tools/lib/bpf/libbpf.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 955f8eafbf41..f9eb68ff2f4f 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -806,11 +806,8 @@ static int bpf_object__elf_collect(struct bpf_object *obj) err = bpf_object__add_program(obj, data->d_buf, data->d_size, name, idx); if (err) { - char errmsg[STRERR_BUFSIZE]; - - strerror_r(-err, errmsg, sizeof(errmsg)); pr_warning("failed to alloc program %s (%s): %s", - name, obj->path, errmsg); + name, obj->path, strerror(-err)); } } else if (sh.sh_type == SHT_REL) { void *reloc = obj->efile.reloc; @@ -2334,7 +2331,7 @@ bpf_perf_event_read_simple(void *mem, unsigned long size, __u64 data_tail = header->data_tail; __u64 data_head = header->data_head; void *base, *begin, *end; - int ret; + int ret = 0; asm volatile("" ::: "memory"); /* in real code it should be smp_rmb() */ if (data_head == data_tail) -- 2.16.4