[Mesa-dev] [PATCH V2] mesa: use build flag to ensure stack is realigned on x86
Matt Turner
mattst88 at gmail.com
Mon Dec 8 14:03:45 PST 2014
On Mon, Dec 8, 2014 at 1:59 PM, Ian Romanick <idr at freedesktop.org> wrote:
> On 12/08/2014 01:56 PM, Matt Turner wrote:
>> On Mon, Dec 8, 2014 at 1:54 PM, Ian Romanick <idr at freedesktop.org> wrote:
>>>> diff --git a/configure.ac b/configure.ac
>>>> index b0df1bb..7dc435a 100644
>>>> --- a/configure.ac
>>>> +++ b/configure.ac
>>>> @@ -253,8 +253,9 @@ AC_SUBST([VISIBILITY_CXXFLAGS])
>>>> dnl
>>>> dnl Optional flags, check for compiler support
>>>> dnl
>>>> +SSE41_CFLAGS="-msse4.1"
>>>> save_CFLAGS="$CFLAGS"
>>>> -CFLAGS="-msse4.1 $CFLAGS"
>>>> +CFLAGS="$SSE41_CFLAGS $CFLAGS"
>>>> AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
>>>> #include <smmintrin.h>
>>>> int main () {
>>>> @@ -474,6 +475,12 @@ fi
>>>> dnl
>>>> dnl Arch/platform-specific settings
>>>> dnl
>>>> +case "$target_cpu" in
>>>> + i?86)
>>>> + SSE41_CFLAGS="$SSE41_CFLAGS -mstackrealign"
>>>> +;;
>>>> +esac
>>>
>>> Should we only add -mstackrealign if SSE41_CFLAGS is not empty?
>>
>> It looks like it's unconditionally set.
>
> Right... I'm asking if we should conditionally add it instead. Is there
> any harm in doing -mstackrealign when it's not needed?
Ah, I see. Unclear whether -mstackrealign does anything on x86-64.
I do see some reports like [1] or [2] where some version of gcc
errored out with "error: -mstackrealign not supported in the 64bit
mode" or ICE'd so I suspect we shouldn't use it unconditionally.
[1] http://tremulous.net/forum/index.php?topic=16205.10;wap2
[2] https://www.mail-archive.com/gcc-bugs@gcc.gnu.org/msg256007.html
More information about the mesa-dev
mailing list