Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1236882 > unrolled thread
| Started by | Ben Hutchings <ben@decadent.org.uk> |
|---|---|
| First post | 2015-10-01 02:50 +0200 |
| Last post | 2015-10-02 09:50 +0200 |
| Articles | 6 — 4 participants |
Back to article view | Back to linux.kernel
[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
| From | Ben Hutchings <ben@decadent.org.uk> |
|---|---|
| Date | 2015-10-01 02:50 +0200 |
| Subject | [PATCH] x86: uapi: Fix __BITS_PER_LONG for x32 |
| Message-ID | <qeAel-4BU-3@gated-at.bofh.it> |
[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.
[toc] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2015-10-01 10:30 +0200 |
| Message-ID | <qeHpx-6S6-23@gated-at.bofh.it> |
| In reply to | #1236882 |
* Ben Hutchings <ben@decadent.org.uk> wrote: > 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 Can we write this as: #ifdef __ILP64__ ? Thanks, Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Brian Gerst <brgerst@gmail.com> |
|---|---|
| Date | 2015-10-01 15:10 +0200 |
| Message-ID | <qeLMv-53B-33@gated-at.bofh.it> |
| In reply to | #1237127 |
On Thu, Oct 1, 2015 at 4:23 AM, Ingo Molnar <mingo@kernel.org> wrote: > > * Ben Hutchings <ben@decadent.org.uk> wrote: > >> 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 > > Can we write this as: > > #ifdef __ILP64__ Do all versions of gcc/clang define that, even if x32 isn't supported? -- Brian Gerst -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ben Hutchings <ben@decadent.org.uk> |
|---|---|
| Date | 2015-10-01 23:00 +0200 |
| Message-ID | <qeT7k-7th-7@gated-at.bofh.it> |
| In reply to | #1237417 |
[Multipart message — attachments visible in raw view] — view raw
On Thu, 2015-10-01 at 09:02 -0400, Brian Gerst wrote: > On Thu, Oct 1, 2015 at 4:23 AM, Ingo Molnar <mingo@kernel.org> wrote: > > > > * Ben Hutchings <ben@decadent.org.uk> wrote: > > > > > 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 > > > > Can we write this as: > > > > #ifdef __ILP64__ Assuming you meant __LP64__... > Do all versions of gcc/clang define that, even if x32 isn't > supported? For gcc, it's been defined since 2003 (gcc 3.3): https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=0bdab2d89e28ca4dc84f8f0fafed85a4822bca49 For clang, it's been defined since before its first public release: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?r1=38978&r2=38987&pathrev=161685 So gcc 3.1 and 3.2 didn't define it, but everything newer does. Ben. -- Ben Hutchings Knowledge is power. France is bacon.
[toc] | [prev] | [next] | [standalone]
| From | Ben Hutchings <ben@decadent.org.uk> |
|---|---|
| Date | 2015-10-02 04:00 +0200 |
| Message-ID | <qeXNE-5NS-3@gated-at.bofh.it> |
| In reply to | #1237724 |
[Multipart message — attachments visible in raw view] — view raw
On Thu, 2015-10-01 at 21:54 +0100, Ben Hutchings wrote: > On Thu, 2015-10-01 at 09:02 -0400, Brian Gerst wrote: > > On Thu, Oct 1, 2015 at 4:23 AM, Ingo Molnar <mingo@kernel.org> wrote: > > > > > > * Ben Hutchings <ben@decadent.org.uk> wrote: > > > > > > > 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 > > > > > > Can we write this as: > > > > > > #ifdef __ILP64__ > > Assuming you meant __LP64__... > > > Do all versions of gcc/clang define that, even if x32 isn't > > supported? > > For gcc, it's been defined since 2003 (gcc 3.3): > https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=0bdab2d89e28ca4dc84f8f0fafed85a4822bca49 > > For clang, it's been defined since before its first public release: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?r1=38978&r2=38987&pathrev=161685 > > So gcc 3.1 and 3.2 didn't define it, but everything newer does. As the kernel itself is supposed to still be compilable with gcc 3.2, I think this means that my patch has the right condition. Ben. -- Ben Hutchings When in doubt, use brute force. - Ken Thompson
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Ben Hutchings <tipbot@zytor.com> |
|---|---|
| Date | 2015-10-02 09:50 +0200 |
| Subject | [tip:x86/urgent] x86/headers/uapi: Fix __BITS_PER_LONG value for x32 builds |
| Message-ID | <qf3gn-5mM-41@gated-at.bofh.it> |
| In reply to | #1236882 |
Commit-ID: f4b4aae1828855db761bf998ce37d3062b1d6446 Gitweb: http://git.kernel.org/tip/f4b4aae1828855db761bf998ce37d3062b1d6446 Author: Ben Hutchings <ben@decadent.org.uk> AuthorDate: Thu, 1 Oct 2015 01:40:43 +0100 Committer: Ingo Molnar <mingo@kernel.org> CommitDate: Fri, 2 Oct 2015 09:43:21 +0200 x86/headers/uapi: Fix __BITS_PER_LONG value for x32 builds On x32, gcc predefines __x86_64__ but long is only 32-bit. Use __ILP32__ to distinguish x32. Fixes this compiler error in perf: tools/include/asm-generic/bitops/__ffs.h: In function '__ffs': 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> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kernel@vger.kernel.org Link: http://lkml.kernel.org/r/1443660043.2730.15.camel@decadent.org.uk Signed-off-by: Ingo Molnar <mingo@kernel.org> --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web