Re: [PATCH 3/9] powerpc: Add TIF_ELF2ABI flag.

2013-12-01 Thread Rusty Russell
Michael Ellerman m...@ellerman.id.au writes:
 On Wed, Nov 20, 2013 at 10:15:00PM +1100, Anton Blanchard wrote:
 From: Rusty Russell ru...@rustcorp.com.au
 
 Little endian ppc64 is getting an exciting new ABI.  This is reflected
 by the bottom two bits of e_flags in the ELF header:
 
  0 == legacy binaries (v1 ABI)
  1 == binaries using the old ABI (compiled with a new toolchain)
  2 == binaries using the new ABI.

 Just to be ridiculously clear for stupid people like me, you refer here
 to the v1 ABI and the old ABI - they are the same thing - right?

Sorry for delay, was off for a week.

Yes, same thing.

 diff --git a/arch/powerpc/include/asm/thread_info.h 
 b/arch/powerpc/include/asm/thread_info.h
 index ba7b197..05a3030 100644
 --- a/arch/powerpc/include/asm/thread_info.h
 +++ b/arch/powerpc/include/asm/thread_info.h
 @@ -107,6 +107,9 @@ static inline struct thread_info 
 *current_thread_info(void)
  #define TIF_EMULATE_STACK_STORE 16  /* Is an instruction emulation
  for stack store? */
  #define TIF_MEMDIE  17  /* is terminating due to OOM killer */
 +#if defined(CONFIG_PPC64)
 +#define TIF_ELF2ABI 18  /* function descriptors must die! */
 +#endif

 This is the first TIF flag we #ifdef for 32 vs 64, is that just because
 we don't want to waste a flag on 32 bit?

No, it's because I wanted to make damn sure that there wasn't anyone
testing this in 32-bit code, since ELF2 is currently a 64-bit only
option.

Cheers,
Rusty.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 3/9] powerpc: Add TIF_ELF2ABI flag.

2013-11-21 Thread Michael Ellerman
On Wed, Nov 20, 2013 at 10:15:00PM +1100, Anton Blanchard wrote:
 From: Rusty Russell ru...@rustcorp.com.au
 
 Little endian ppc64 is getting an exciting new ABI.  This is reflected
 by the bottom two bits of e_flags in the ELF header:
 
   0 == legacy binaries (v1 ABI)
   1 == binaries using the old ABI (compiled with a new toolchain)
   2 == binaries using the new ABI.

Just to be ridiculously clear for stupid people like me, you refer here
to the v1 ABI and the old ABI - they are the same thing - right?

 diff --git a/arch/powerpc/include/asm/thread_info.h 
 b/arch/powerpc/include/asm/thread_info.h
 index ba7b197..05a3030 100644
 --- a/arch/powerpc/include/asm/thread_info.h
 +++ b/arch/powerpc/include/asm/thread_info.h
 @@ -107,6 +107,9 @@ static inline struct thread_info 
 *current_thread_info(void)
  #define TIF_EMULATE_STACK_STORE  16  /* Is an instruction emulation
   for stack store? */
  #define TIF_MEMDIE   17  /* is terminating due to OOM killer */
 +#if defined(CONFIG_PPC64)
 +#define TIF_ELF2ABI  18  /* function descriptors must die! */
 +#endif

This is the first TIF flag we #ifdef for 32 vs 64, is that just because
we don't want to waste a flag on 32 bit?

cheers
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 3/9] powerpc: Add TIF_ELF2ABI flag.

2013-11-20 Thread Anton Blanchard
From: Rusty Russell ru...@rustcorp.com.au

Little endian ppc64 is getting an exciting new ABI.  This is reflected
by the bottom two bits of e_flags in the ELF header:

0 == legacy binaries (v1 ABI)
1 == binaries using the old ABI (compiled with a new toolchain)
2 == binaries using the new ABI.

We store this in a thread flag, because we need to set it in core
dumps and for signal delivery.  Our chief concern is that it doesn't
use function descriptors.

Signed-off-by: Rusty Russell ru...@rustcorp.com.au
Signed-off-by: Anton Blanchard an...@samba.org
---
 arch/powerpc/include/asm/elf.h | 2 ++
 arch/powerpc/include/asm/thread_info.h | 9 +
 2 files changed, 11 insertions(+)

diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
index cc0655a..6d0e236 100644
--- a/arch/powerpc/include/asm/elf.h
+++ b/arch/powerpc/include/asm/elf.h
@@ -86,6 +86,8 @@ typedef elf_vrregset_t elf_fpxregset_t;
 #ifdef __powerpc64__
 # define SET_PERSONALITY(ex)   \
 do {   \
+   if (((ex).e_flags  0x3) == 2)  \
+   set_thread_flag(TIF_ELF2ABI);   \
if ((ex).e_ident[EI_CLASS] == ELFCLASS32)   \
set_thread_flag(TIF_32BIT); \
else\
diff --git a/arch/powerpc/include/asm/thread_info.h 
b/arch/powerpc/include/asm/thread_info.h
index ba7b197..05a3030 100644
--- a/arch/powerpc/include/asm/thread_info.h
+++ b/arch/powerpc/include/asm/thread_info.h
@@ -107,6 +107,9 @@ static inline struct thread_info *current_thread_info(void)
 #define TIF_EMULATE_STACK_STORE16  /* Is an instruction emulation
for stack store? */
 #define TIF_MEMDIE 17  /* is terminating due to OOM killer */
+#if defined(CONFIG_PPC64)
+#define TIF_ELF2ABI18  /* function descriptors must die! */
+#endif
 
 /* as above, but as bit values */
 #define _TIF_SYSCALL_TRACE (1TIF_SYSCALL_TRACE)
@@ -185,6 +188,12 @@ static inline bool test_thread_local_flags(unsigned int 
flags)
 #define is_32bit_task()(1)
 #endif
 
+#if defined(CONFIG_PPC64)
+#define is_elf2_task() (test_thread_flag(TIF_ELF2ABI))
+#else
+#define is_elf2_task() (0)
+#endif
+
 #endif /* !__ASSEMBLY__ */
 
 #endif /* __KERNEL__ */
-- 
1.8.3.2

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev