[FFmpeg-devel] Hacks on FATE

Michael Kostylev michael.kostylev
Thu Jun 18 11:14:35 CEST 2009


M?ns Rullg?rd wrote:

> x86_32 DOS: --extra-cflags='-U__STRICT_ANSI__ -fno-builtin' --disable-network
>   What breaks without -fno-builtin?

The c99 math function detection doesn't work correctly - false positives
happen.

>   Why is --disable-network needed? 

Network is enabled by default but DOS lacks its own network stack.
There is an alternative: add --extra-cflags=-I/some/non-standard/path
(e.g. /usr/i386-pc-msdosdjgpp/include/watt32) to make the network headers
visible.

> x86_32 FreeBSD: --extra-cflags=-D__BSD_VISIBLE
> x86_32 NetBSD:  --extra-cflags=-D_NETBSD_SOURCE
>   These are presumably required to work around the broken system
>   headers (bktr.h) on these systems.

bktr.h is ok. /usr/include/sys/cdefs.h:

/*-
 * Deal with _ANSI_SOURCE:
 * If it is defined, and no other compilation environment is explicitly
 * requested, then define our internal feature-test macros to zero.  This
 * makes no difference to the preprocessor (undefined symbols in preprocessing
 * expressions are defined to have value zero), but makes it more convenient for
 * a test program to print out the values.
 *
 * If a program mistakenly defines _ANSI_SOURCE and some other macro such as
 * _POSIX_C_SOURCE, we will assume that it wants the broader compilation
 * environment (and in fact we will never get here).
 */
#if defined(_ANSI_SOURCE)       /* Hide almost everything. */
#define __POSIX_VISIBLE         0
#define __XSI_VISIBLE           0
#define __BSD_VISIBLE           0
#define __ISO_C_VISIBLE         1990
#elif defined(_C99_SOURCE)      /* Localism to specify strict C99 env. */
#define __POSIX_VISIBLE         0
#define __XSI_VISIBLE           0
#define __BSD_VISIBLE           0
#define __ISO_C_VISIBLE         1999
#else                           /* Default environment: show everything. */
#define __POSIX_VISIBLE         200112
#define __XSI_VISIBLE           600
#define __BSD_VISIBLE           1
#define __ISO_C_VISIBLE         1999
#endif
#endif

% cpp -std=c99 -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -dM /usr/include/sys/cdefs.h | grep VISIBLE
#define __ISO_C_VISIBLE 1999
#define __POSIX_VISIBLE 200112

and /usr/include/sys/featuretest.h:

#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
    !defined(_XOPEN_SOURCE) && !defined(_NETBSD_SOURCE)
#define _NETBSD_SOURCE 1
#endif

probably aren't.

> x86_32 OpenBSD: cavsdsp_mmx-fPIC-friendly.diff; CFLAGS='-fPIC -DPIC'
>   Does OpenBSD require PIC even for static builds?

Excluding completely -static.

>  If so, this should be handled in configure.  And what's in the patch?

"r"((x86_reg)dstStride) -> "rm"((x86_reg)dstStride)

> x86_32 OpenSolaris: sed -i -e 's/^\(SHFLAGS\)=\(.*\)/\1=-mimpure-text \2/' config.mak
>   The -mimpure-text option allows non-PIC in shared libs.  This should
>   be set in configure.

Btw, the Sun linker still complains about relocations even when objects are built with 
-fPIC:
gcc -shared -Wl,-h,libavcodec.so.52 ...
Text relocation remains                         referenced
    against symbol                  offset      in file
.rodata (section)                   0x2fd0      libavcodec/x86/dsputil_mmx.o
.rodata (section)                   0x9         libavcodec/x86/idct_sse2_xvid.o
[skip ~4300 lines]
ff_pw_9                             0x3b0       libavcodec/x86/vc1dsp_mmx.o
ld: fatal: relocations remain against allocatable but non-writable sections
collect2: ld returned 1 exit status
gmake: *** [libavcodec/libavcodec.so.52] Error 1

Michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cavsdsp_mmx-fPIC-friendly.diff
Type: text/x-diff
Size: 861 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090618/a502cf11/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: h264dsp_mmx-fPIC-friendly.diff
Type: text/x-diff
Size: 1201 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090618/a502cf11/attachment-0001.diff>



More information about the ffmpeg-devel mailing list