Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1746493ybl; Thu, 30 Jan 2020 05:22:07 -0800 (PST) X-Google-Smtp-Source: APXvYqyg/mhuQSsjx0eUmvtlZY/+3P+OhfIHqW9ZHzMtoLOxu0lJHHjbQYfLU5JIXak6VE8P+Dt3 X-Received: by 2002:a54:4e8d:: with SMTP id c13mr2814985oiy.27.1580390527083; Thu, 30 Jan 2020 05:22:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580390527; cv=none; d=google.com; s=arc-20160816; b=S/BPz/2EBx5P2LUmp6yOFQPPQ/3nc3rhB4/CPGd0ThKs3fB8pJNlPFctE2Um1PKa/d UxoWM+r2wv4kOROwZQ1SopeNmAH3I+S/0lazTAOW7HrRKl8rRVhX2lOmCfBVlIjl8/qy J6zC9jtdAJ0m7gCYb3buRVCo7/2cTfNqphFg7IUa8KPZB9F3xbtxa3xHmPUXonYJeGPj XjGXKU1cn/JEprVGZKttkemApCv3O7PF3YS5koIwRs5J2taYTMADOqVv1uVcQjzw4mTc MN6eFmtGVshQu6bIV1p697gpWBXe+Eemb7ecYs/I76JHt/h7fNt7SI/4X2Dzb5Hsc2UX Z4xg== 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:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=IBzUATVju8YTQ/uviNYY3Cvxp+1AyiDXnfoMaHE/e/I=; b=TLZSedZ34rRkWKJidTI5n0Wbu/1WZDSr6oWol6MjLC/+FekVWzsl+XaExIqsAZ9vYB KAdeP/PKur6M8ZRZsUSQDQTRelYd8Y1oT7RhpkNoKZqXvVdLwLfJujQUDrs3Pm2wNB7A r7OW1FpHCYzmWbqwE5yiKR4D/px1hO+Epu8QQ07b16f8ePbi1xzuCvjk6m+v9S9JAi/g 8/HdKBZXPuGRLbt+s3yhpFmCX8YoWf/pYP8zGjI5kWZU96QM0tquyosg3ve9dv3rkd9V NNEvH6On70gcH0c6fr6UsDS1oIinmXlsF7BYCl982Ja5nIz2O3cw5r99Cffb+TybSlP7 SpYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZzJq7tuX; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s129si2767492oig.177.2020.01.30.05.21.46; Thu, 30 Jan 2020 05:22:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-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=@redhat.com header.s=mimecast20190719 header.b=ZzJq7tuX; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727142AbgA3NVa (ORCPT + 99 others); Thu, 30 Jan 2020 08:21:30 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:60027 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727107AbgA3NVa (ORCPT ); Thu, 30 Jan 2020 08:21:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580390489; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=IBzUATVju8YTQ/uviNYY3Cvxp+1AyiDXnfoMaHE/e/I=; b=ZzJq7tuX+KSke4wurkY7GRnIzIatfMAaS6BCpCsHosDQJ5g4uCxE807uPrvwpZQFnxCJxy vcMAWfSXO7TQJ4Kx5/zH3O76vamE94BO3EHZwri5euIkpH/rZlOTjw/v2GfivIzTHToVi7 qt367nx4WvGf/ZiPMUlOAGcFoPKgXOk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-237-AajAqSq-Pw-7U_wsj_oDCA-1; Thu, 30 Jan 2020 08:21:27 -0500 X-MC-Unique: AajAqSq-Pw-7U_wsj_oDCA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4CE0F800D41; Thu, 30 Jan 2020 13:21:26 +0000 (UTC) Received: from localhost.localdomain (ovpn-204-170.brq.redhat.com [10.40.204.170]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7456F77950; Thu, 30 Jan 2020 13:21:25 +0000 (UTC) From: Lukas Czerner To: linux-ext4@vger.kernel.org Cc: tytso@mit.edu Subject: [PATCH] tst_libext2fs: Avoid multiple definition of global variables Date: Thu, 30 Jan 2020 14:21:22 +0100 Message-Id: <20200130132122.21150-1-lczerner@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Content-Transfer-Encoding: quoted-printable Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org gcc version 10 changed the default from -fcommon to -fno-common and as a result e2fsprogs unit tests fail because tst_libext2fs.c end up with a build error. This is because it defines two global variables debug_prog_name and extra_cmds that are already defined in debugfs/debugfs.c. With -fcommon linker was able to resolve those into the same object, however with -fno-common it's no longer able to do it and we end up with multiple definition errors. Fix the problem by creating an extern declaration of said variables in debugfs.h and just setting them in tst_libext2fs.c without additional declaration. Signed-off-by: Lukas Czerner --- debugfs/debugfs.h | 2 ++ lib/ext2fs/tst_libext2fs.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/debugfs/debugfs.h b/debugfs/debugfs.h index 477d9bbb..956517bc 100644 --- a/debugfs/debugfs.h +++ b/debugfs/debugfs.h @@ -123,6 +123,8 @@ extern void do_set_block_group_descriptor(int argc, c= har **, int sci_idx, void * extern void do_dump_unused(int argc, char **argv, int sci_idx, void *inf= op); =20 /* debugfs.c */ +extern ss_request_table *extra_cmds; +extern const char *debug_prog_name; extern void internal_dump_inode(FILE *, const char *, ext2_ino_t, struct ext2_inode *, int); =20 diff --git a/lib/ext2fs/tst_libext2fs.c b/lib/ext2fs/tst_libext2fs.c index 3e7497cd..43f0d153 100644 --- a/lib/ext2fs/tst_libext2fs.c +++ b/lib/ext2fs/tst_libext2fs.c @@ -28,9 +28,7 @@ * Hook in new commands into debugfs * Override debugfs's prompt */ -const char *debug_prog_name =3D "tst_libext2fs"; extern ss_request_table libext2fs_cmds; -ss_request_table *extra_cmds =3D &libext2fs_cmds; =20 static int print_blocks_proc(ext2_filsys fs EXT2FS_ATTR((unused)), blk64_t *blocknr, e2_blkcnt_t blockcnt, @@ -51,6 +49,9 @@ void do_block_iterate(int argc, char **argv, int sci_id= x EXT2FS_ATTR((unused)), int err =3D 0; int flags =3D 0; =20 + debug_prog_name =3D "tst_libext2fs"; + extra_cmds =3D &libext2fs_cmds; + if (common_args_process(argc, argv, 2, 3, argv[0], usage, 0)) return; =20 --=20 2.21.1