diff --git a/community/newlib/0002-or1k-missing-include.patch b/community/newlib/0002-or1k-missing-include.patch new file mode 100644 index 00000000000..9cbe902e3ac --- /dev/null +++ b/community/newlib/0002-or1k-missing-include.patch @@ -0,0 +1,13 @@ +mlock.c calls into a function from libgloss without including the header. +We add the relative path to the header here instead of adding the libgloss +includes to include paths to keep the patch short. +--- a/newlib/libc/sys/or1k/mlock.c 2023-12-31 18:00:18.000000000 +0100 ++++ b/newlib/libc/sys/or1k/mlock.c 2024-05-09 13:26:08.523124156 +0200 +@@ -17,6 +17,7 @@ + + #include + #include ++#include "../../../../libgloss/or1k/include/or1k-support.h" + + /* Lock calls from different cores, but allows recursive calls from the same + * core. The lock is not only atomic to other cores calling malloc, but also diff --git a/community/newlib/0003-or1k-fix-uart-irq-handler-signature.patch b/community/newlib/0003-or1k-fix-uart-irq-handler-signature.patch new file mode 100644 index 00000000000..eeaa40d99a0 --- /dev/null +++ b/community/newlib/0003-or1k-fix-uart-irq-handler-signature.patch @@ -0,0 +1,24 @@ +The IRQ handler signature does not match the expected signature, so let's +fix that. The data argument is unused anyway. +--- a/libgloss/or1k/or1k_uart.c 2024-05-09 13:34:05.290587255 +0200 ++++ b/libgloss/or1k/or1k_uart.c 2024-05-09 13:33:36.794072659 +0200 +@@ -90,7 +90,7 @@ void (*_or1k_uart_read_cb)(char c); + * This is the interrupt handler that is registered for the callback + * function. + */ +-void _or1k_uart_interrupt_handler(uint32_t data) ++void _or1k_uart_interrupt_handler(void *data) + { + uint8_t iir = REG8(IIR); + +--- a/libgloss/or1k/or1k_uart.h 2024-05-09 13:34:40.180397343 +0200 ++++ b/libgloss/or1k/or1k_uart.h 2024-05-09 13:33:36.794072659 +0200 +@@ -30,7 +30,7 @@ extern void (*_or1k_uart_read_cb)(char c + /** + * The UART interrupt handler + */ +-void _or1k_uart_interrupt_handler(uint32_t data); ++void _or1k_uart_interrupt_handler(void *data); + + /** + * Initialize UART diff --git a/community/newlib/0004-or1k-drop-invalid-cast.patch b/community/newlib/0004-or1k-drop-invalid-cast.patch new file mode 100644 index 00000000000..79c8a63e138 --- /dev/null +++ b/community/newlib/0004-or1k-drop-invalid-cast.patch @@ -0,0 +1,17 @@ +Storing a void pointer into a void pointer variable does not need an +intermediate cast to uint32_t and is frowned upon by modern C compilers. +--- a/libgloss/or1k/interrupts.c 2024-05-09 13:37:00.289629242 +0200 ++++ b/libgloss/or1k/interrupts.c 2024-05-09 13:35:29.896791467 +0200 +@@ -35,10 +35,10 @@ void or1k_interrupt_handler_add(uint32_t + { + #ifdef __OR1K_MULTICORE__ + _or1k_interrupt_handler_table[or1k_coreid()][id] = handler; +- _or1k_interrupt_handler_data_ptr_table[or1k_coreid()][id] = (uint32_t) data_ptr; ++ _or1k_interrupt_handler_data_ptr_table[or1k_coreid()][id] = data_ptr; + #else + _or1k_interrupt_handler_table[id] = handler; +- _or1k_interrupt_handler_data_ptr_table[id] = (uint32_t) data_ptr; ++ _or1k_interrupt_handler_data_ptr_table[id] = data_ptr; + #endif + } + diff --git a/community/newlib/0005-or1k-add-missing-cast.patch b/community/newlib/0005-or1k-add-missing-cast.patch new file mode 100644 index 00000000000..881cb23e193 --- /dev/null +++ b/community/newlib/0005-or1k-add-missing-cast.patch @@ -0,0 +1,13 @@ +This adds a missing cast. uintptr_t would have been better here than uint32_t, +but the code is not intended to be portable anyway. +--- a/libgloss/or1k/sbrk.c 2024-05-09 13:38:08.089257549 +0200 ++++ b/libgloss/or1k/sbrk.c 2024-05-09 13:35:29.896791467 +0200 +@@ -20,7 +20,7 @@ + #include "include/or1k-support.h" + + extern uint32_t end; /* Set by linker. */ +-uint32_t _or1k_heap_start = &end; ++uint32_t _or1k_heap_start = (uint32_t)&end; + uint32_t _or1k_heap_end; + + void * diff --git a/community/newlib/APKBUILD b/community/newlib/APKBUILD index 06ed727a1b4..b9be94f1d8c 100644 --- a/community/newlib/APKBUILD +++ b/community/newlib/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: Marian Buschsieweke pkgname=newlib -pkgver=4.3.0.20230120 -pkgrel=4 +pkgver=4.4.0.20231231 +pkgrel=0 pkgdesc="C standard library implementation intended for use on embedded systems" url="https://www.sourceware.org/newlib/" makedepends="texinfo" @@ -12,6 +12,10 @@ source=" msp430-elf-nano.specs 0001-msp430-enable-syscalls.patch + 0002-or1k-missing-include.patch + 0003-or1k-fix-uart-irq-handler-signature.patch + 0004-or1k-drop-invalid-cast.patch + 0005-or1k-add-missing-cast.patch " options="!check" @@ -164,7 +168,11 @@ _install_subpkg() { } sha512sums=" -4a06309d36c2255fef8fc8f2d133cafa850f1ed2eddfb27b5d45f5d16af69e0fca829a0b4c9b34af4ed3a28c6fcc929761e0ee823a4229f35c2853d432b5e7ef newlib-4.3.0.20230120.tar.gz +ea3baa0b7c9175aae024f0b7d272be092ef2c07483239a99329203e18a44bc23093d29e0ffcbe14bc591f610f0829eacd646cabb06d1c34aa23239cb1b814b46 newlib-4.4.0.20231231.tar.gz 647b79e3cc6f3bb98b1263ebbf4b3efa4a4692fddc0df6491c726de2fa0ee46b05ab2ddf96c2c8c785f3cd6a442135ec97bf8df93a8f371d479ea46d03aa8a08 msp430-elf-nano.specs 268c44f8056067e03ee9914d04e8cfa2bb22764bb294b7d16dbfdd51c2e5ef0ad221037a86caafd20ab755b16b38519d61e27ffcd13239cbdbbfad421fa8cb60 0001-msp430-enable-syscalls.patch +f48058084d25d59edf4d4bd4ffc23428a4a89e00c9f6ed7588315ddb5bafcc68e2b63945b135e3ba0128d108d410ec042e27f32c79dbd3a0bcc9b21c2ba236f7 0002-or1k-missing-include.patch +780d4c8e3b90f875044891a03f8215a7ea857601c908434d31691c47da09af967e264a0f350e165a7b3c674fb7b49421bde96acd9a8a7936a549e53ae79e8acd 0003-or1k-fix-uart-irq-handler-signature.patch +0a8b9ea27998baab7f499f45fe8b3e537919142e1372055fef7ed221428c2e02fc00ec21470c8820115ea65f20d23050ae3f0639094aed1368d1447d293f8382 0004-or1k-drop-invalid-cast.patch +997fcf0dc49d0f92e49c8148959e9979a7721b2da1defa0ffc67379b028ef66a454b7582f06b9965280fe9c58cf65b8f4f4127490cb7e6cd209be3b244bb65ae 0005-or1k-add-missing-cast.patch "