From patchwork Thu Aug 1 11:10:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 13750206 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 33860189521 for ; Thu, 1 Aug 2024 11:11:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722510665; cv=none; b=SE9xTVje7ibihAG6q69FfXQYmXRmOvdFR55eJEj1ZxV5oovOCqAy+QxtgTJwf/wke7HU87YWV4FPrE15Lo8aQ5faglJ8r+UmRe49Ii0Vjz5GEJ9GJ8DQhLWJ9PZPmVyPPbRKQ/0GjAcgilNtf7lwxJ0CbVK/wHCu1U9EYY/OBKU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722510665; c=relaxed/simple; bh=RekK4lMgCZd4a2+c3wBVnBu03mBKuGFLxyUA6Jodd7o=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=EWVha7klX95/yRXwdNJn69aIY6oBnFPYrIgeUvj6uaVA0ycEl1qVOSHe4AJvtmwEKvT1KxgDZJN6YL7k3ptqy3hC6EO6C1Qro3qsl/KZnxyc+iznPpaj0sj+KwT6m08rTmvD/P7dqM5bkQ52wQR2wVVKzu0X2+VNEfkIcUr7+E4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 468CE15A1; Thu, 1 Aug 2024 04:11:29 -0700 (PDT) Received: from donnerap.arm.com (donnerap.manchester.arm.com [10.32.100.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8FD463F5A1; Thu, 1 Aug 2024 04:11:02 -0700 (PDT) From: Andre Przywara To: Will Deacon , Julien Thierry Cc: kvm@vger.kernel.org, Alexandru Elisei , =?utf-8?b?SiAuIE5ldXNjaMOkZmVy?= Subject: [PATCH kvmtool] remove wordsize.h inclusion (for musl compatibility) Date: Thu, 1 Aug 2024 12:10:54 +0100 Message-Id: <20240801111054.818765-1-andre.przywara@arm.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The wordsize.h header file and the __WORDSIZE definition do not seem to be universal, the musl libc for instance has the definition in a different header file. This breaks compilation of kvmtool against musl. The two leading underscores suggest a compiler-internal symbol anyway, so let's just remove that particular macro usage entirely, and replace it with the number we really want: the size of a "long" type. Reported-by: J. Neuschäfer Signed-off-by: Andre Przywara Reviewed-by: Alexandru Elisei --- Hi, can someone test this on a proper/pure musl installation? I tested this with Ubuntu's musl-gcc wrapper, but this didn't show the problem before, so I guess there are subtle differences. Cheers, Andre include/linux/bitops.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/linux/bitops.h b/include/linux/bitops.h index ae33922f5..ee8fd5609 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -1,15 +1,13 @@ #ifndef _KVM_LINUX_BITOPS_H_ #define _KVM_LINUX_BITOPS_H_ -#include - #include #include #include -#define BITS_PER_LONG __WORDSIZE #define BITS_PER_BYTE 8 -#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) +#define BITS_PER_LONG (BITS_PER_BYTE * sizeof(long)) +#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_LONG) #define BIT_WORD(nr) ((nr) / BITS_PER_LONG)