ARM: fix put_user() for gcc-8 35/220135/3
authorArnd Bergmann <arnd@arndb.de>
Thu, 26 Jul 2018 08:13:23 +0000 (10:13 +0200)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Mon, 16 Dec 2019 01:32:07 +0000 (10:32 +0900)
commit8e6a1fd5c7dce3ff645c5c06e9c615126f52af79
tree9f01c306b259830b36fa259ebde56fa978c38e95
parent7d2baa6cd08fb41210921e2f4e0e2eb937c7a9c1
ARM: fix put_user() for gcc-8

Building kernels before linux-4.7 with gcc-8 results in many build failures
when gcc triggers a check that was meant to catch broken compilers:

/tmp/ccCGMQmS.s:648: Error: .err encountered

According to the discussion in the gcc bugzilla, a local "register
asm()" variable is still supposed to be the correct way to force an
inline assembly to use a particular register, but marking it 'const'
lets the compiler do optimizations that break that, i.e the compiler is
free to treat the variable as either 'const' or 'register' in that case.

Upstream commit 9f73bd8bb445 ("ARM: uaccess: remove put_user() code
duplication") fixed this problem in linux-4.8 as part of a larger change,
but seems a little too big to be backported to 4.4.

Let's take the simplest fix and change only the one broken line in the
same way as newer kernels.

Suggested-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85745
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86673
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Johannes Pointner <h4nn35.work@gmail.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
[sw0312.kim: backport stable linux-3.16.y commit 5f8f9f872097 for gcc 9 build]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Ifa7372959ae576f32543605101530cbf66893ce5
arch/arm/include/asm/uaccess.h