diff options
author | Khem Raj <raj.khem@gmail.com> | 2015-09-10 21:44:37 +0000 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2015-09-10 21:44:37 +0000 |
commit | 65217adcff479aca7b4769e8258f7650a8876c7c (patch) | |
tree | 76c7ae72c3fa44b8b06d5176d7456247b503c60b | |
parent | 88030533d281f96a2a384cec92a1456ce2d3bdb5 (diff) | |
download | meta-clang-65217adcff479aca7b4769e8258f7650a8876c7c.tar.gz |
llvm-libunwind: Add recipe
Apple has contributed libunwind implementation to llvm which is needed
for libcxx to work and is equivalent in APIs to HP's libunwind implementation
from good old days
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r-- | recipes-devtools/clang/llvm-libunwind/0001-aarch64-Use-x29-and-x30-for-fp-and-lr-respectively.patch | 65 | ||||
-rw-r--r-- | recipes-devtools/clang/llvm-libunwind_git.bb | 47 |
2 files changed, 112 insertions, 0 deletions
diff --git a/recipes-devtools/clang/llvm-libunwind/0001-aarch64-Use-x29-and-x30-for-fp-and-lr-respectively.patch b/recipes-devtools/clang/llvm-libunwind/0001-aarch64-Use-x29-and-x30-for-fp-and-lr-respectively.patch new file mode 100644 index 0000000..0c65dba --- /dev/null +++ b/recipes-devtools/clang/llvm-libunwind/0001-aarch64-Use-x29-and-x30-for-fp-and-lr-respectively.patch | |||
@@ -0,0 +1,65 @@ | |||
1 | From 5def58395d2248dfcd3165b4f23ba04b7f355837 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Thu, 10 Sep 2015 21:27:28 +0000 | ||
4 | Subject: [PATCH] aarch64: Use x29 and x30 for fp and lr respectively | ||
5 | |||
6 | This does not change the code generation with integrated asm | ||
7 | but using x30 and x29 helps compile the code with gnu as. Currently gas | ||
8 | fails to assemble this code with errors as below | ||
9 | |||
10 | Error: operand X should be an integer register | ||
11 | |||
12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
13 | --- | ||
14 | Upstream-Status: Submitted[http://reviews.llvm.org/D12777] | ||
15 | |||
16 | src/UnwindRegistersRestore.S | 6 +++--- | ||
17 | src/UnwindRegistersSave.S | 6 +++--- | ||
18 | 2 files changed, 6 insertions(+), 6 deletions(-) | ||
19 | |||
20 | diff --git a/src/UnwindRegistersRestore.S b/src/UnwindRegistersRestore.S | ||
21 | index 7d21953..1244d82 100644 | ||
22 | --- a/src/UnwindRegistersRestore.S | ||
23 | +++ b/src/UnwindRegistersRestore.S | ||
24 | @@ -282,8 +282,8 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind15Registers_arm646jumptoEv) | ||
25 | ldp x22,x23, [x0, #0x0B0] | ||
26 | ldp x24,x25, [x0, #0x0C0] | ||
27 | ldp x26,x27, [x0, #0x0D0] | ||
28 | - ldp x28,fp, [x0, #0x0E0] | ||
29 | - ldr lr, [x0, #0x100] // restore pc into lr | ||
30 | + ldp x28,x29, [x0, #0x0E0] | ||
31 | + ldr x30, [x0, #0x100] // restore pc into lr | ||
32 | ldr x1, [x0, #0x0F8] | ||
33 | mov sp,x1 // restore sp | ||
34 | |||
35 | @@ -306,7 +306,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind15Registers_arm646jumptoEv) | ||
36 | ldr d31, [x0, #0x208] | ||
37 | |||
38 | ldp x0, x1, [x0, #0x000] // restore x0,x1 | ||
39 | - ret lr // jump to pc | ||
40 | + ret x30 // jump to pc | ||
41 | |||
42 | #elif defined(__arm__) && !defined(__APPLE__) | ||
43 | |||
44 | diff --git a/src/UnwindRegistersSave.S b/src/UnwindRegistersSave.S | ||
45 | index d26908c..80776c8 100644 | ||
46 | --- a/src/UnwindRegistersSave.S | ||
47 | +++ b/src/UnwindRegistersSave.S | ||
48 | @@ -254,11 +254,11 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext) | ||
49 | stp x22,x23, [x0, #0x0B0] | ||
50 | stp x24,x25, [x0, #0x0C0] | ||
51 | stp x26,x27, [x0, #0x0D0] | ||
52 | - stp x28,fp, [x0, #0x0E0] | ||
53 | - str lr, [x0, #0x0F0] | ||
54 | + stp x28,x29, [x0, #0x0E0] | ||
55 | + str x30, [x0, #0x0F0] | ||
56 | mov x1,sp | ||
57 | str x1, [x0, #0x0F8] | ||
58 | - str lr, [x0, #0x100] // store return address as pc | ||
59 | + str x30, [x0, #0x100] // store return address as pc | ||
60 | // skip cpsr | ||
61 | stp d0, d1, [x0, #0x110] | ||
62 | stp d2, d3, [x0, #0x120] | ||
63 | -- | ||
64 | 2.5.1 | ||
65 | |||
diff --git a/recipes-devtools/clang/llvm-libunwind_git.bb b/recipes-devtools/clang/llvm-libunwind_git.bb new file mode 100644 index 0000000..4e77dce --- /dev/null +++ b/recipes-devtools/clang/llvm-libunwind_git.bb | |||
@@ -0,0 +1,47 @@ | |||
1 | # Copyright (C) 2015 Khem Raj <raj.khem@gmail.com> | ||
2 | # Released under the MIT license (see COPYING.MIT for the terms) | ||
3 | |||
4 | DESCRIPTION = "libunwind implements a stack unwinder, needed to perform C++ exception handling." | ||
5 | HOMEPAGE = "http://llvm.org/" | ||
6 | LICENSE = "MIT & UIUC" | ||
7 | SECTION = "base" | ||
8 | INHIBIT_DEFAULT_DEPS = "1" | ||
9 | |||
10 | DEPENDS += "clang-cross-${TARGET_ARCH}" | ||
11 | |||
12 | require clang.inc | ||
13 | |||
14 | inherit cmake | ||
15 | |||
16 | DEPENDS += "libcxx" | ||
17 | LIC_FILES_CHKSUM = "file://../libcxx/LICENSE.TXT;md5=149d2e8e8d99e3a2d702997b5f919fd9; \ | ||
18 | " | ||
19 | SRCREV_libunwind = "1d9ef03c3ee017838437e0f3197f2912eebdce5a" | ||
20 | SRC_URI = "\ | ||
21 | git://github.com/llvm-mirror/llvm.git;branch=${BRANCH};name=llvm \ | ||
22 | git://github.com/llvm-mirror/libcxx.git;branch=${BRANCH};name=libcxx;destsuffix=git/projects/libcxx \ | ||
23 | git://github.com/llvm-mirror/libcxxabi.git;branch=${BRANCH};name=libcxxabi;destsuffix=git/projects/libcxxabi \ | ||
24 | git://github.com/llvm-mirror/libunwind.git;branch=master;name=libunwind;destsuffix=git/projects/libunwind \ | ||
25 | file://0001-aarch64-Use-x29-and-x30-for-fp-and-lr-respectively.patch \ | ||
26 | " | ||
27 | |||
28 | SRCREV_FORMAT = "llvm_libcxx_libcxxabi_libunwind" | ||
29 | |||
30 | S = "${WORKDIR}/git/projects/libunwind" | ||
31 | |||
32 | THUMB_TUNE_CCARGS = "" | ||
33 | TUNE_CCARGS += "-ffreestanding -nostdlib" | ||
34 | |||
35 | EXTRA_OECMAKE += "-DLIBCXXABI_LIBCXX_PATH=${S}/../libcxxabi \ | ||
36 | -DLLVM_PATH=${S}/../../ \ | ||
37 | -DLLVM_ENABLE_LIBCXX=True \ | ||
38 | -DLLVM_ENABLE_LIBCXXABI=True \ | ||
39 | -DLLVM_BUILD_EXTERNAL_COMPILER_RT=True \ | ||
40 | -DLIBCXXABI_ENABLE_SHARED=False \ | ||
41 | -DUNIX=True \ | ||
42 | -DLIBUNWIND_ENABLE_SHARED=False \ | ||
43 | " | ||
44 | do_configure_prepend () { | ||
45 | (cd ${S}/include && ln -sf ../../libcxxabi/include/__cxxabi_config.h) | ||
46 | } | ||
47 | BBCLASSEXTEND = "native nativesdk" | ||