Skip to content

Commit 44ed0dd

Browse files
Fix embedded-runtimes and newlib for arm-elf
1 parent 04cdb51 commit 44ed0dd

File tree

3 files changed

+107
-4
lines changed

3 files changed

+107
-4
lines changed

specs/embedded-runtimes.anod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class EmbeddedRuntimes(spec("common")):
1212

1313
@property
1414
def commit_id(self):
15-
return "0d5e0999c7bf5e8f29aeb69b9cb3d0b687c6d373"
15+
return "4386b1dcd0e995ac9b9e1b221cf386238d3c1537"
1616

1717
@property
1818
def tarball(self):

specs/newlib.anod

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
from e3.os.fs import unixpath
1+
from e3.os.fs import unixpath, touch
22
from e3.anod.helper import Configure, Make
33
from e3.anod.spec import Anod
44
from e3.anod.loader import spec
5+
from e3.diff import patch
6+
from e3.fs import cp
7+
import os
58

69

10+
patch_name = "newlib-fix-arm-eh_frame.patch"
11+
712
class Newlib(spec("common")):
813
@property
914
def version(self):
@@ -19,12 +24,15 @@ class Newlib(spec("common")):
1924
self.HTTPSSourceBuilder(
2025
name=self.tarball,
2126
url="https://sourceware.org/pub/newlib/" + self.tarball,
22-
)
27+
),
28+
self.LocalSourceBuilder(name=patch_name),
2329
]
2430

2531
@property
2632
def build_source_list(self):
27-
return [Anod.Source(name=self.tarball, publish=True, dest="")]
33+
return [Anod.Source(name=self.tarball, publish=True, dest=""),
34+
self.Source(name=patch_name, publish=True, unpack_cmd=cp, dest="patches"),
35+
]
2836

2937
@property
3038
def build_deps(self):
@@ -45,6 +53,17 @@ class Newlib(spec("common")):
4553
def build(self):
4654
self.deps["gcc"].setenv()
4755

56+
# Little hack to apply the patch only once, there is probably a clean
57+
# way to do that.
58+
patched = os.path.join(self["SRC_DIR"], "patches", ".patched")
59+
if not os.path.exists(patched):
60+
patch(
61+
os.path.join(self["SRC_DIR"], "patches", patch_name),
62+
self.build_space.src_dir,
63+
)
64+
touch(patched)
65+
66+
4867
configure = Configure(self)
4968
configure.add("--prefix=%s" % unixpath(self["INSTALL_DIR"]))
5069

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
diff --git newlib/libc/machine/arm/aeabi_memmove-thumb2.S newlib/libc/machine/arm/aeabi_memmove-thumb2.S
2+
index 20ca993e56651796ef515ed646776bc58bdb69cd..3018e74126925277d4bbaff7ff7c4144ef2522c8 100644
3+
--- newlib/libc/machine/arm/aeabi_memmove-thumb2.S
4+
+++ newlib/libc/machine/arm/aeabi_memmove-thumb2.S
5+
@@ -36,6 +36,7 @@
6+
ASM_ALIAS __aeabi_memmove8 __aeabi_memmove
7+
__aeabi_memmove:
8+
.fnstart
9+
+ .cfi_sections .debug_frame
10+
.cfi_startproc
11+
prologue 4
12+
cmp r0, r1
13+
diff --git newlib/libc/machine/arm/aeabi_memset-thumb2.S newlib/libc/machine/arm/aeabi_memset-thumb2.S
14+
index 6b77d3820eef22bb256b59bf4cbd0da9a72c1dd9..a1b8f053229cf8ec2b6132253b90948c0f43c870 100644
15+
--- newlib/libc/machine/arm/aeabi_memset-thumb2.S
16+
+++ newlib/libc/machine/arm/aeabi_memset-thumb2.S
17+
@@ -33,6 +33,7 @@
18+
.global __aeabi_memset
19+
.type __aeabi_memset, %function
20+
.fnstart
21+
+ .cfi_sections .debug_frame
22+
.cfi_startproc
23+
ASM_ALIAS __aeabi_memset4 __aeabi_memset
24+
ASM_ALIAS __aeabi_memset8 __aeabi_memset
25+
diff --git newlib/libc/machine/arm/memchr.S newlib/libc/machine/arm/memchr.S
26+
index d13ef8d65454a1e493b74333071b4875577d214b..f0b3650aa336214e88dbe1617e9e8178f152c028 100644
27+
--- newlib/libc/machine/arm/memchr.S
28+
+++ newlib/libc/machine/arm/memchr.S
29+
@@ -293,6 +293,7 @@ memchr:
30+
.global memchr
31+
.type memchr,%function
32+
.fnstart
33+
+ .cfi_sections .debug_frame
34+
.cfi_startproc
35+
memchr:
36+
@ r0 = start of memory to scan
37+
diff --git newlib/libc/machine/arm/memcpy-armv7m.S newlib/libc/machine/arm/memcpy-armv7m.S
38+
index ec1ad6485e582592ed578024e7a3d8959f99ab1d..13ffdb343f013d6fdbda51319a2b26c59ad9df36 100644
39+
--- newlib/libc/machine/arm/memcpy-armv7m.S
40+
+++ newlib/libc/machine/arm/memcpy-armv7m.S
41+
@@ -88,6 +88,7 @@
42+
.thumb
43+
.thumb_func
44+
.fnstart
45+
+ .cfi_sections .debug_frame
46+
.cfi_startproc
47+
.type memcpy, %function
48+
memcpy:
49+
diff --git newlib/libc/machine/arm/setjmp.S newlib/libc/machine/arm/setjmp.S
50+
index 5e5952296c9daa0197b74e157a9068ef9d115cc8..0070f17cdcef9e1b70aeded257019a55d61f035e 100644
51+
--- newlib/libc/machine/arm/setjmp.S
52+
+++ newlib/libc/machine/arm/setjmp.S
53+
@@ -183,6 +183,7 @@ SYM (.arm_start_of.\name):
54+
MODE
55+
.globl SYM (\name)
56+
.fnstart
57+
+ .cfi_sections .debug_frame
58+
.cfi_startproc
59+
TYPE (\name)
60+
SYM (\name):
61+
diff --git newlib/libc/machine/arm/strlen-armv7.S newlib/libc/machine/arm/strlen-armv7.S
62+
index 6aa122c075bbd395c1c1b53925b0a28c3be7294e..1c2b5c532bb4a6392159b4284cfe48d318e19b62 100644
63+
--- newlib/libc/machine/arm/strlen-armv7.S
64+
+++ newlib/libc/machine/arm/strlen-armv7.S
65+
@@ -106,6 +106,7 @@
66+
67+
def_fn strlen p2align=6
68+
.fnstart
69+
+ .cfi_sections .debug_frame
70+
.cfi_startproc
71+
prologue 4 5 push_ip=HAVE_PAC_LEAF
72+
pld [srcin, #0]
73+
diff --git newlib/libc/machine/arm/strlen-thumb2-Os.S newlib/libc/machine/arm/strlen-thumb2-Os.S
74+
index 4adbc61d2e032ca7593db6b39e938202058583ba..b8a615a15d8fb0cf4221fbe439f8989e277f201a 100644
75+
--- newlib/libc/machine/arm/strlen-thumb2-Os.S
76+
+++ newlib/libc/machine/arm/strlen-thumb2-Os.S
77+
@@ -47,6 +47,7 @@
78+
79+
def_fn strlen p2align=1
80+
.fnstart
81+
+ .cfi_sections .debug_frame
82+
.cfi_startproc
83+
prologue
84+
mov r3, r0

0 commit comments

Comments
 (0)