[MPlayer-cygwin] 16 byte alignment

Adam Seychell a_seychell at yahoo.com.au
Tue Jan 20 01:15:43 CET 2009


Simon Sasburg wrote:
> This is a bug in gcc and/or binutils on windows, i reported it before,
> see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37216 .
> 
> The suggested workaround, using -fno-common doesn't seem to work for
> mplayer and/or ffmpeg when i tried.
> 
> Also no-one seems to be actively working on it...
> 

I found that removing the static keyword from all declarations using the 
aligned(16) attribute would cause them to be emitted from the object 
file and become 16 byte aligned. Note the -fno-common options was also 
necessary for this to work. I discovered this by investigating the 
mplayer linker generated Map file.
I fear the problem lies somewhere deep in binutils sources, which I am 
far from having any clue how to fix.

Below is a small bash script I wrote to modify mplayer/ffmpeg source

---------------------------------
# Removes static keyword from variable declarations containing
# "__attribute__((aligned(16)))" This is a work around for a bug
# in cygwin gcc binutils causing corrupted alignment"

aligned_string="__attribute__((aligned(16)))"

for FILEC in `find . -type f -name \*c`; do
  if (grep -q "static .*${aligned_string}" $FILEC); then
    sed  "s/static \(.*${aligned_string}.*\)/\1/" $FILEC > tmp.dsds
    mv tmp.dsds $FILEC
    echo "found $FILEC"
  fi
done






More information about the MPlayer-cygwin mailing list