[MPlayer-dev-eng] [PATCH] dvdread/bswap.h
Daniel Jacob Werner
dwerner at experimentalscene.com
Sat Aug 18 23:40:45 CEST 2007
Compilation of dvdread/ifo_read.c fails on Solaris 10 Nevada / AMD64
with gcc version 3.4.3 targeting Nocona.
# /usr/sfw/bin/gmake
/usr/sfw/bin/gcc -m64 -D__USE_UNIX98 -D_GNU_SOURCE -I../libavcodec
-I../libavformat -Wdisabled-optimization -Wdeclaration-after-statement
-I. -I.. -I../libavutil -W -Wall -O2 -march=nocona -mtune=nocona -pipe
-g -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
-DHAVE_CONFIG_H -I/usr/include/amd64 -I/usr/include -I/usr/sfw/include
-I/usr/openwin/include -c -o ifo_read.o ifo_read.c
ifo_read.c: In function `ifoRead_PTL_MAIT':
ifo_read.c:1276: warning: comparison between signed and unsigned
ifo_read.c: In function `ifoRead_C_ADT_internal':
ifo_read.c:1561: warning: comparison between signed and unsigned
{standard input}: Assembler messages:
{standard input}:1045: Error: suffix or operands invalid for `xchg'
gmake: *** [ifo_read.o] Error 1
# /usr/sfw/bin/gas -64 ifo_read.s > /dev/null
ifo_read.s: Assembler messages:
ifo_read.s:1045: Error: suffix or operands invalid for `xchg'
ifo_read.s(1045): xchgb %dil,%di
This occurs in the function ifoRead_PTL_MAIT on line 1198:
B2N_16(ptl_mait->nr_of_countries);
B2N_16 is used in other parts of ifo_read.c without causing the same
problem, it is intermittent.
The problem lies with this code in dvdread/bswap.h
#elif defined(ARCH_X86)
inline static unsigned short bswap_16(unsigned short x)
{
__asm("xchgb %b0,%h0" :
"=q" (x) :
"0" (x));
return x;
}
#define B2N_16(x) x = bswap_16(x)
The "=q" must be "=Q" (uppercase) to work properly on x64,
see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21398
Attached is a patch that fixes this and should also work when targeted
for i386 architecture.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bswap.h
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20070819/19eb352b/attachment.txt>
More information about the MPlayer-dev-eng
mailing list