Skip to content

Instantly share code, notes, and snippets.

View eblot's full-sized avatar

Emmanuel Blot eblot

  • France, Provence
View GitHub Profile
@eblot
eblot / newlib-libgloss-armv6m-none-eabi.diff
Created October 21, 2023 08:17
Fix libgloss build for ARMv6m
diff --git a/libgloss/arm/crt0.S b/libgloss/arm/crt0.S
index 8490bde..bde5f98 100644
--- a/libgloss/arm/crt0.S
+++ b/libgloss/arm/crt0.S
@@ -565,7 +565,7 @@ change_back:
/* For Thumb, constants must be after the code since only
positive offsets are supported for PC relative addresses. */
- .align 0
+ .align 2
@eblot
eblot / newlib-libgloss-arm-none-eabi.diff
Created October 21, 2023 08:15
Fix libgloss build for arm-none-eabi
diff --git a/libgloss/arm/Makefile.in b/libgloss/arm/Makefile.in
index e1bad17..e8ddd42 100644
--- a/libgloss/arm/Makefile.in
+++ b/libgloss/arm/Makefile.in
@@ -109,17 +109,7 @@ INCLUDES += `if [ -d ${objroot}/newlib ]; then echo -I$(srcroot)/newlib/libc/mac
# build a test program for each target board. Just trying to get
# it to link is a good test, so we ignore all the errors for now.
#
-all: ${CRT0} ${LINUX_CRT0} ${LINUX_BSP} ${REDBOOT_CRT0} ${REDBOOT_OBJS} ${RDPMON_CRT0} ${RDPMON_BSP} ${RDIMON_CRT0} ${RDIMON_BSP}
- @rootpre=`pwd`/; export rootpre; \
@eblot
eblot / newlib-stdio.diff
Created October 21, 2023 08:14
Newlib: Fix warning in stdio.h
diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h
index 7748351..b94a847 100644
--- a/newlib/libc/include/stdio.h
+++ b/newlib/libc/include/stdio.h
@@ -690,7 +690,7 @@ _ELIDABLE_INLINE int __sputc_r(struct _reent *_ptr, int _c, FILE *_p) {
__sputc_r (_ptr, '\r', _p);
#endif
if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
- return (*_p->_p++ = _c);
+ return (*_p->_p++ = (unsigned char)_c);
@eblot
eblot / newlib-4.1.0-armv6m.diff
Created October 21, 2023 07:35
Newlib-4.1.0 fix for ARMv6m
diff -ur a/libgloss/arm/crt0.S b/libgloss/arm/crt0.S
--- a/libgloss/arm/crt0.S 2020-01-22 11:05:51.000000000 +0100
+++ b/libgloss/arm/crt0.S 2020-05-01 21:19:59.000000000 +0200
@@ -565,7 +565,7 @@
/* For Thumb, constants must be after the code since only
positive offsets are supported for PC relative addresses. */
- .align 0
+ .align 2
.LC0:
@eblot
eblot / newlib-3.3.0-armv6m.diff
Last active May 1, 2020 19:21
Newlib-3.3.0 fix for ARMv6m
diff -ur a/libgloss/arm/crt0.S b/libgloss/arm/crt0.S
--- a/libgloss/arm/crt0.S 2020-01-22 11:05:51.000000000 +0100
+++ b/libgloss/arm/crt0.S 2020-05-01 21:19:59.000000000 +0200
@@ -565,7 +565,7 @@
/* For Thumb, constants must be after the code since only
positive offsets are supported for PC relative addresses. */
- .align 0
+ .align 2
.LC0:
@eblot
eblot / newlib-3.3.0-armv6m.diff
Created May 1, 2020 19:05
Newlib-3.3.0 fix for ARMv6m
diff --git a/libgloss/arm/crt0.S b/libgloss/arm/crt0.S
index 48f3d6b1d..1a0a446e4 100644
--- a/libgloss/arm/crt0.S
+++ b/libgloss/arm/crt0.S
@@ -565,7 +565,7 @@
/* For Thumb, constants must be after the code since only
positive offsets are supported for PC relative addresses. */
- .align 0
+ .align 2
@eblot
eblot / 0003-enable-atomic-header-on-thread-less-builds.patch
Created October 28, 2019 16:55
Atomic w/ threadless bare metal (adapter from Yves Delley's)
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 044cd0ceb00..f388afee43e 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -1204,14 +1204,13 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
#if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && \
!defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) && \
- !defined(_LIBCPP_HAS_EXTERNAL_ATOMIC_IMP)) \
- || defined(_LIBCPP_HAS_NO_THREADS)
@eblot
eblot / 0002-explicitly-specify-location-of-libunwind-in-static-b.patch
Created October 28, 2019 16:53
Libunwind w/ static linkage (adapter from Yves Delley's)
diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt
index b38973b0b17..a06c9cba498 100644
--- a/libcxxabi/src/CMakeLists.txt
+++ b/libcxxabi/src/CMakeLists.txt
@@ -84,9 +84,11 @@ if (LIBCXXABI_USE_LLVM_UNWINDER)
if (NOT LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY AND (TARGET unwind_shared OR HAVE_LIBUNWIND))
list(APPEND LIBCXXABI_STATIC_LIBRARIES unwind_shared)
elseif (LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY AND (TARGET unwind_static OR HAVE_LIBUNWIND))
- # We handle this by directly merging libunwind objects into libc++abi.
+ # We handle this by directly merging libunwind objects into libc++abi.
@eblot
eblot / 0001-support-FPv4-SP.patch
Created October 28, 2019 16:52
FP support for bare metal CortexM (adapted from Yves Delley's)
diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
index f42e13714c9..35fe752f037 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -380,52 +380,61 @@ set(arm_Thumb1_SjLj_EH_SOURCES
arm/restore_vfp_d8_d15_regs.S
arm/save_vfp_d8_d15_regs.S
)
-set(arm_Thumb1_VFPv2_SOURCES
- arm/adddf3vfp.S
diff --git a/newlib/libc/machine/arm/strlen-thumb2-Os.S b/newlib/libc/machine/arm/strlen-thumb2-Os.S
index 961f41a0a..7a8b3d93b 100644
--- a/newlib/libc/machine/arm/strlen-thumb2-Os.S
+++ b/newlib/libc/machine/arm/strlen-thumb2-Os.S
@@ -45,7 +45,7 @@
def_fn strlen p2align=1
mov r3, r0
-1: ldrb.w r2, [r3], #1
+1: ldrb r2, [r3], #1