diff options
author | Nick Desaulniers <ndesaulniers@google.com> | 2019-10-16 16:02:08 -0700 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2019-10-30 11:56:20 -0400 |
commit | 00db297106e81770e7c4319014a67896053b5a22 (patch) | |
tree | 1327f93bc836bb0a9e04f50468ab5b494cb542a5 /drivers/memory/tegra/mc.h | |
parent | c868868f6b6a5272350781f9a19b3a5ba1c00b02 (diff) | |
download | linux-00db297106e81770e7c4319014a67896053b5a22.tar.bz2 |
drm/amdgpu: fix stack alignment ABI mismatch for GCC 7.1+
GCC earlier than 7.1 errors when compiling code that makes use of
`double`s and sets a stack alignment outside of the range of [2^4-2^12]:
$ cat foo.c
double foo(double x, double y) {
return x + y;
}
$ gcc-4.9 -mpreferred-stack-boundary=3 foo.c
error: -mpreferred-stack-boundary=3 is not between 4 and 12
This is likely why the AMDGPU driver was ever compiled with a different
stack alignment (and thus different ABI) than the rest of the x86
kernel. The kernel uses 8B stack alignment, while the driver was using
16B stack alignment in a few places.
Since GCC 7.1+ doesn't error, fix the ABI mismatch for users of newer
versions of GCC.
There was discussion about whether to mark the driver broken or not for
users of GCC earlier than 7.1, but since the driver currently is
working, don't explicitly break the driver for them here.
Relying on differing stack alignment is unspecified behavior, and
brittle, and may break in the future.
This patch is no functional change for GCC users earlier than 7.1. It's
been compile tested on GCC 4.9 and 8.3 to check the correct flags. It
should be boot tested when built with GCC 7.1+.
-mincoming-stack-boundary= or -mstackrealign may help keep this code
building for pre-GCC 7.1 users.
The version check for GCC is broken into two conditionals, both because
cc-ifversion is currently GCC specific, and it simplifies a subsequent
patch.
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/memory/tegra/mc.h')
0 files changed, 0 insertions, 0 deletions