Re: [FFmpeg-devel] [PATCH] mips/asmdefs: use asm/sgidefs.h header on linux

2015-03-07 Thread James Cowgill
On Sat, 2015-03-07 at 18:06 +0100, wm4 wrote:
 On Sat,  7 Mar 2015 10:13:23 +
 James Cowgill james...@cowgill.org.uk wrote:
 
  Unfortunately android  api 21 (lollipop) doesn't have the sgidefs.h header,
  but the linux kernel does in asm/sgidefs.h. So use that header if we can.
  
  Change _ABI64 to _MIPS_SIM_ABI64 which is defined in both headers.
 
 What does this header contain? Requiring kernel headers for anything
 but Linux specific syscalls or for building kernel modules is incredibly
 broken.

Yes the correct header on mips is just 'sgidefs.h' and while glibc has
provided it for years, android bionic only added it for lollipop.

This is the kernel header:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/mips/include/uapi/asm/sgidefs.h

The one provided by glibc has a little more stuff but we don't need it.
_MIPS_SIM is defined by GCC (and some older mips compilers) to be equal
to one of the _MIPS_SIM_* constants depending on which ABI is selected.

GCC and Clang also define _ABI* themselves (as well as being defined in
the glibc version of the header) for the current ABI, so I suppose using
this without including anything might work if we don't care about other
compilers:

#if defined(_ABI64)  _MIPS_SIM == _ABI64

 And __linux__ is of course completely out of the question. Just because
 it's Linux, the libc doesn't necessarily provide kernel headers.

Ok

James

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] mips/asmdefs: use asm/sgidefs.h header on linux

2015-03-07 Thread wm4
On Sat,  7 Mar 2015 10:13:23 +
James Cowgill james...@cowgill.org.uk wrote:

 Unfortunately android  api 21 (lollipop) doesn't have the sgidefs.h header,
 but the linux kernel does in asm/sgidefs.h. So use that header if we can.
 
 Change _ABI64 to _MIPS_SIM_ABI64 which is defined in both headers.

What does this header contain? Requiring kernel headers for anything
but Linux specific syscalls or for building kernel modules is incredibly
broken.

And __linux__ is of course completely out of the question. Just because
it's Linux, the libc doesn't necessarily provide kernel headers.

 Signed-off-by: James Cowgill james...@cowgill.org.uk
 ---
  libavutil/mips/asmdefs.h | 6 +-
  1 file changed, 5 insertions(+), 1 deletion(-)
 
 diff --git a/libavutil/mips/asmdefs.h b/libavutil/mips/asmdefs.h
 index 4d2922c..3660e98 100644
 --- a/libavutil/mips/asmdefs.h
 +++ b/libavutil/mips/asmdefs.h
 @@ -27,9 +27,13 @@
  #ifndef AVCODEC_MIPS_ASMDEFS_H
  #define AVCODEC_MIPS_ASMDEFS_H
  
 +#ifdef __linux__
 +#include asm/sgidefs.h
 +#else
  #include sgidefs.h
 +#endif
  
 -#if _MIPS_SIM == _ABI64
 +#if _MIPS_SIM == _MIPS_SIM_ABI64
  # define PTRSIZE 8 
  # define PTRLOG  3 
  # define PTR_ADDU   daddu 

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] mips/asmdefs: use asm/sgidefs.h header on linux

2015-03-07 Thread Michael Niedermayer
On Sat, Mar 07, 2015 at 10:13:23AM +, James Cowgill wrote:
 Unfortunately android  api 21 (lollipop) doesn't have the sgidefs.h header,
 but the linux kernel does in asm/sgidefs.h. So use that header if we can.
 
 Change _ABI64 to _MIPS_SIM_ABI64 which is defined in both headers.
 
 Signed-off-by: James Cowgill james...@cowgill.org.uk
 ---
  libavutil/mips/asmdefs.h | 6 +-
  1 file changed, 5 insertions(+), 1 deletion(-)
 
 diff --git a/libavutil/mips/asmdefs.h b/libavutil/mips/asmdefs.h
 index 4d2922c..3660e98 100644
 --- a/libavutil/mips/asmdefs.h
 +++ b/libavutil/mips/asmdefs.h
 @@ -27,9 +27,13 @@
  #ifndef AVCODEC_MIPS_ASMDEFS_H
  #define AVCODEC_MIPS_ASMDEFS_H
  
 +#ifdef __linux__
 +#include asm/sgidefs.h
 +#else
  #include sgidefs.h
 +#endif

is it possible to to test for the header in configure instead of
testing for __linux__
we test for most other headers in configure

see, for example check_header asm/types.h / #if HAVE_ASM_TYPES_H

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] mips/asmdefs: use asm/sgidefs.h header on linux

2015-03-07 Thread James Cowgill
Unfortunately android  api 21 (lollipop) doesn't have the sgidefs.h header,
but the linux kernel does in asm/sgidefs.h. So use that header if we can.

Change _ABI64 to _MIPS_SIM_ABI64 which is defined in both headers.

Signed-off-by: James Cowgill james...@cowgill.org.uk
---
 libavutil/mips/asmdefs.h | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavutil/mips/asmdefs.h b/libavutil/mips/asmdefs.h
index 4d2922c..3660e98 100644
--- a/libavutil/mips/asmdefs.h
+++ b/libavutil/mips/asmdefs.h
@@ -27,9 +27,13 @@
 #ifndef AVCODEC_MIPS_ASMDEFS_H
 #define AVCODEC_MIPS_ASMDEFS_H
 
+#ifdef __linux__
+#include asm/sgidefs.h
+#else
 #include sgidefs.h
+#endif
 
-#if _MIPS_SIM == _ABI64
+#if _MIPS_SIM == _MIPS_SIM_ABI64
 # define PTRSIZE 8 
 # define PTRLOG  3 
 # define PTR_ADDU   daddu 
-- 
2.1.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel