diff options
author | Andre McCurdy <armccurdy@gmail.com> | 2017-10-09 09:00:35 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-10-16 23:52:44 +0100 |
commit | 65458b6e83eec3d44cc7ad7f67ee792d94bdeaa8 (patch) | |
tree | 72b82de2ceccae85ec6a86c8cd8dcaed7bebe676 | |
parent | 48fee62075e3efe5869003be34e1909991962a23 (diff) | |
download | poky-65458b6e83eec3d44cc7ad7f67ee792d94bdeaa8.tar.gz |
musl: use a more specific fix for ARM thumb + frame pointers
When compiling for Thumb or Thumb2, frame pointers _must_ be disabled
since the Thumb frame pointer in r7 clashes with musl's use of inline
asm to make syscalls (where r7 is used for the syscall NR).
In most cases, frame pointers will be disabled automatically due to
the optimisation level, but appending an explicit -fomit-frame-pointer
to CFLAGS handles cases where optimisation is set to -O0 or frame
pointers have been enabled by -fno-omit-frame-pointer earlier in
CFLAGS, etc.
Note that this limitation applies both to gcc and clang, the only
difference between the two being that where gcc aborts with an error
about reusing r7, clang apparently silently generates broken code:
https://bugs.llvm.org/show_bug.cgi?id=34165
(From OE-Core rev: d7580cd7792982fd9e98086e4edc490635e9adca)
Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-core/musl/musl_git.bb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-core/musl/musl_git.bb index 8b6a2e3454..bd7573e0f3 100644 --- a/meta/recipes-core/musl/musl_git.bb +++ b/meta/recipes-core/musl/musl_git.bb | |||
@@ -28,7 +28,13 @@ export CROSS_COMPILE="${TARGET_PREFIX}" | |||
28 | 28 | ||
29 | LDFLAGS += "-Wl,-soname,libc.so" | 29 | LDFLAGS += "-Wl,-soname,libc.so" |
30 | 30 | ||
31 | ARM_INSTRUCTION_SET_toolchain-clang = "arm" | 31 | # When compiling for Thumb or Thumb2, frame pointers _must_ be disabled since the |
32 | # Thumb frame pointer in r7 clashes with musl's use of inline asm to make syscalls | ||
33 | # (where r7 is used for the syscall NR). In most cases, frame pointers will be | ||
34 | # disabled automatically due to the optimisation level, but append an explicit | ||
35 | # -fomit-frame-pointer to handle cases where optimisation is set to -O0 or frame | ||
36 | # pointers have been enabled by -fno-omit-frame-pointer earlier in CFLAGS, etc. | ||
37 | CFLAGS_append_arm = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}" | ||
32 | 38 | ||
33 | CONFIGUREOPTS = " \ | 39 | CONFIGUREOPTS = " \ |
34 | --prefix=${prefix} \ | 40 | --prefix=${prefix} \ |