diff options
author | Maciej W. Rozycki <macro@imgtec.com> | 2016-05-17 01:12:27 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2016-05-17 05:02:45 -0400 |
commit | e49d38488515057dba8f0c2ba4cfde5be4a7281f (patch) | |
tree | cc141fabd9a4622c560e71beaaddffd0dd0ca5be /arch/mips/include/asm/msa.h | |
parent | 0868971a8dad52e726711a2a4b161ace9ed011fa (diff) |
MIPS: MSA: Fix a link error on `_init_msa_upper' with older GCC
Fix a build regression from commit c9017757c532 ("MIPS: init upper 64b
of vector registers when MSA is first used"):
arch/mips/built-in.o: In function `enable_restore_fp_context':
traps.c:(.text+0xbb90): undefined reference to `_init_msa_upper'
traps.c:(.text+0xbb90): relocation truncated to fit: R_MIPS_26 against `_init_msa_upper'
traps.c:(.text+0xbef0): undefined reference to `_init_msa_upper'
traps.c:(.text+0xbef0): relocation truncated to fit: R_MIPS_26 against `_init_msa_upper'
to !CONFIG_CPU_HAS_MSA configurations with older GCC versions, which are
unable to figure out that calls to `_init_msa_upper' are indeed dead.
Of the many ways to tackle this failure choose the approach we have
already taken in `thread_msa_context_live'.
[ralf@linux-mips.org: Drop patch segment to junk file.]
Signed-off-by: Maciej W. Rozycki <macro@imgtec.com>
Cc: stable@vger.kernel.org # v3.16+
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/13271/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/include/asm/msa.h')
-rw-r--r-- | arch/mips/include/asm/msa.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/mips/include/asm/msa.h b/arch/mips/include/asm/msa.h index bbb85fe21642..6e4effa6f626 100644 --- a/arch/mips/include/asm/msa.h +++ b/arch/mips/include/asm/msa.h | |||
@@ -147,6 +147,19 @@ static inline void restore_msa(struct task_struct *t) | |||
147 | _restore_msa(t); | 147 | _restore_msa(t); |
148 | } | 148 | } |
149 | 149 | ||
150 | static inline void init_msa_upper(void) | ||
151 | { | ||
152 | /* | ||
153 | * Check cpu_has_msa only if it's a constant. This will allow the | ||
154 | * compiler to optimise out code for CPUs without MSA without adding | ||
155 | * an extra redundant check for CPUs with MSA. | ||
156 | */ | ||
157 | if (__builtin_constant_p(cpu_has_msa) && !cpu_has_msa) | ||
158 | return; | ||
159 | |||
160 | _init_msa_upper(); | ||
161 | } | ||
162 | |||
150 | #ifdef TOOLCHAIN_SUPPORTS_MSA | 163 | #ifdef TOOLCHAIN_SUPPORTS_MSA |
151 | 164 | ||
152 | #define __BUILD_MSA_CTL_REG(name, cs) \ | 165 | #define __BUILD_MSA_CTL_REG(name, cs) \ |