Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1236882

[PATCH] x86: uapi: Fix __BITS_PER_LONG for x32

From Ben Hutchings <ben@decadent.org.uk>
Newsgroups linux.kernel
Subject [PATCH] x86: uapi: Fix __BITS_PER_LONG for x32
Date 2015-10-01 02:50 +0200
Message-ID <qeAel-4BU-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On x32, gcc predefines __x86_64__ but long is only 32-bit.  Use
__ILP32__ to distinguish x32.

Fixes this compiler error in perf:

/«PKGBUILDDIR»/tools/include/asm-generic/bitops/__ffs.h: In function '__ffs':
/«PKGBUILDDIR»/tools/include/asm-generic/bitops/__ffs.h:19:8: error: right shift count >= width of type [-Werror=shift-count-overflow]
   word >>= 32;
        ^

This isn't sufficient to build perf for x32, though.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/x86/include/uapi/asm/bitsperlong.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/uapi/asm/bitsperlong.h b/arch/x86/include/uapi/asm/bitsperlong.h
index b0ae1c4..217909b 100644
--- a/arch/x86/include/uapi/asm/bitsperlong.h
+++ b/arch/x86/include/uapi/asm/bitsperlong.h
@@ -1,7 +1,7 @@
 #ifndef __ASM_X86_BITSPERLONG_H
 #define __ASM_X86_BITSPERLONG_H
 
-#ifdef __x86_64__
+#if defined(__x86_64__) && !defined(__ILP32__)
 # define __BITS_PER_LONG 64
 #else
 # define __BITS_PER_LONG 32
-- 
Ben Hutchings
Knowledge is power.  France is bacon.

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] x86: uapi: Fix __BITS_PER_LONG for x32 Ben Hutchings <ben@decadent.org.uk> - 2015-10-01 02:50 +0200
  Re: [PATCH] x86: uapi: Fix __BITS_PER_LONG for x32 Ingo Molnar <mingo@kernel.org> - 2015-10-01 10:30 +0200
    Re: [PATCH] x86: uapi: Fix __BITS_PER_LONG for x32 Brian Gerst <brgerst@gmail.com> - 2015-10-01 15:10 +0200
      Re: [PATCH] x86: uapi: Fix __BITS_PER_LONG for x32 Ben Hutchings <ben@decadent.org.uk> - 2015-10-01 23:00 +0200
        Re: [PATCH] x86: uapi: Fix __BITS_PER_LONG for x32 Ben Hutchings <ben@decadent.org.uk> - 2015-10-02 04:00 +0200
  [tip:x86/urgent] x86/headers/uapi:   Fix __BITS_PER_LONG value for x32 builds tip-bot for Ben Hutchings <tipbot@zytor.com> - 2015-10-02 09:50 +0200

csiph-web