[FFmpeg-devel] [PATCH] add cflags filtering rules for suncc
Måns Rullgård
mans
Sat Oct 31 21:11:16 CET 2009
Michael Kostylev <michael.kostylev at gmail.com> writes:
> On Sat Oct 31 15:14:31 2009
> M?ns Rullg?rd wrote:
>
>>>>> The -Os mapping may be ajusted/safely removed, -O2 is set just because
>>>>> the -O[3-5] options are currently unusable on x86.
>>>>
>>>> Are you sure you attached the patch you're talking about there? I see
>>>> nothing about 3-5.
>>>
>>> Theoretically, `-O[3-5] -xspace' should work too, -xspace is an additional
>>> flag, it is used to disable optimizations which increase code size.
>>> Maybe `-O5 -xspace' works ok on sparc, I don't know.
>>
>> The bugs should be tracked down and fixed or worked around. Disabling
>> optimisations is a bad idea (except for the gcc vectoriser, which will
>> never be of any use).
>
> I thought that O2 is better than nothing and slightly better than O1.
> Currently, non-working O3 requires some hackery with the options like
> --disable-optimizations --extra-cflags='-O2 -xregs=frameptr' or
> --enable-small --disable-optimizations --extra-cflags='-O2 -xspace -xregs=frameptr'
But _why_ does -O[1-5] not work? We should make sure the bug isn't in
our code.
>>>>> --- ./configure.orig
>>>>> +++ ./configure
>>>>> @@ -1613,6 +1618,17 @@
>>>>> cc_version="AV_STRINGIFY(__SUNPRO_C)"
>>>>> DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\\\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
>>>>> DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -xM1'
>>>>> + filter_cflags=suncc_flags
>>>>> + suncc_flags(){
>>>>> + for flag; do
>>>>> + case $flag in
>>>>> + -std=c99) echo -xc99 ;;
>>>>> + -fomit-frame-pointer) echo -xregs=frameptr ;;
>>>>> + -Os) echo -O2 -xspace ;;
>>>>> + -O[1-5]|-g) echo $flag ;;
>>>>> + esac
>>>>> + done
>>>>> + }
>>>>> fi
>>>>
>>>> Do you realise that this will drop all other flags?
>>>
>>> I do. If you need more details:
>>> almost all warning options are on by default;
>>> it is not very easy to map -march and -mcpu, it can de done later.
>>
>> What do the equivalent options look like?
>
> -xarch=isa, simply the list of possible arguments differs.
It should be easy enough to make something work. A table mapping the
gcc names to the best matching suncc name would be a start.
>> What about other options?
>
> Oh, it seems I see what you mean. A bad news for me is that extra cflags are
> filtered too.
It probably makes sense to change that actually.
> Then I would suggest something like this:
>
> -std=c99) echo -xc99 ;;
> -fomit-frame-pointer) echo -xregs=frameptr ;;
> -fPIC) enabled x86 && echo -Kpic || echo -xcode=pic32 ;;
> -W*,*) echo $flag ;;
> -Os) echo -O3 -xspace ;;
> -f*-*|-W*) ;;
> *) echo $flag ;;
>
> Maybe someone has a better idea about filtering? The actual man page is here:
> http://developers.sun.com/sunstudio/documentation/ss12u1/mr/man/man1/cc.1.html
Feel free to suggest improvements to the filtering mechanism.
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list