avr-gcc: Import update to 14.1.0

master
Michael Baeuerle 2024-05-15 16:47:56 +02:00
parent f17d5b174d
commit 8725c54b0d
10 changed files with 1292 additions and 0 deletions

View File

@ -245,6 +245,7 @@ SUBDIR+= avidemux-cli
SUBDIR+= avidemux-plugins
SUBDIR+= avidemux-qt
SUBDIR+= avp
SUBDIR+= avr-gcc
SUBDIR+= avr-gdb
SUBDIR+= avra
SUBDIR+= avrdude

69
avr-gcc/COMMIT_MSG Normal file
View File

@ -0,0 +1,69 @@
cross/avr-gcc: Update to 14.1.0
Remove pkgsrc patches that were merged upstream.
Full changelog can be found here:
<https://gcc.gnu.org/gcc-14/changes.html>
Changes for AVR architecture
============================
- On AVR64* and AVR128* devices, read-only data is now located in
program memory per default and no longer in RAM.
- Only a 32 KiB block of program memory can be used to store and
access .rodata in that way. Which block is used can be selected by
defining the symbol __flmap. As an alternative, the byte address of
the block can be specified by the symbol __RODATA_FLASH_START__
which takes precedence over __flmap. For example, linking with
-Wl,--defsym,__RODATA_FLASH_START__=32k chooses the second 32 KiB
block.
- The default uses the last 32 KiB block, which is also the hardware
default for bit-field NVMCTRL_CTRLB.FLMAP.
- When a non-default block is used, then NVMCTRL_CTRLB.FLMAP must be
initialized accordingly by hand, or AVR-LibC v2.2 that implements
#931 can be used. The latter initializes NVMCTRL_CTRLB.FLMAP in the
startup code and according to the value of __flmap or
__RODATA_FLASH_START__.
- When AVR-LibC with #931 is used, then defining the symbol
__flmap_lock to a non-zero value will set bit
NVMCTRL_CTRLB.FLMAPLOCK. This will protect NVMCTRL_CTRLB.FLMAP from
any further changes â which would be Undefined Behaviour in C/C++.
If you prefer to define the symbol in a C/C++ file, an asm statement
can be used:
__asm (".global __flmap_lock" "\n\t"
"__flmap_lock = 1");
- When you do not want the code from #931, then define a global symbol
__do_flmap_init and the linker will not pull in that code from
libmcu.a any more.
- In order to return to the old placement of read-only data in RAM,
the new compiler option -mrodata-in-ram can be used. This is
required on devices where the hardware revision is affected by a
silicon bug concerning the FLMAP functionality.
- Read-only data is located in output section .rodata, whereas it is
part of .text when located in RAM.
- The feature is only available when the compiler is configured with a
version of Binutils that implements PR31124, which is the case for
Binutils v2.42 and up.
- The implementation consists of two parts:
1. Binutils support new emulations avrxmega2_flmap and
avrxmega4_flmap. The sole purpose of these emulations is to
provide adjusted default linker description files. Apart from
that, these emulations behave exactly the same like avrxmega2
resp. avrxmega4.
2. The compiler uses a device-specs file which links the program
with -mavrxmega2_flmap or -mavrxmega2 depending on
-m[no-]rodata-in-ram; and similar for -mavrxmega4[_flmap].
This means the feature can be used with older compiler or Binutils
versions; all what's needed is an adjusted linker script and a custom
device-specs file.
- A new compiler option -m[no-]rodata-in-ram has been added. The default
is to locate read-only data in program memory for devices that support
it, e.g. for AVR64* and AVR128* devices as explained above, and for
devices from the avrxmega3 and avrtiny families.
- The new built-in macro __AVR_RODATA_IN_RAM__ is supported on all
devices. It's defined to 0 or 1.
- A new optimization tries to improve code generation for indirect
memory accesses on Reduced Tiny devices. It can be controlled by the
new compiler option -mfuse-add=level where level may be 0, 1 or 2.
- On the Reduced Tiny devices, the meaning of register constraint "w"
has been changed. It now constrains the registers R24...R31 as is the
case for all the other devices.

4
avr-gcc/DESCR Normal file
View File

@ -0,0 +1,4 @@
GCC configured as cross-compiler for Atmel AVR 8-bit RISC
microcontrollers.
This package includes C and C++ compilers.

78
avr-gcc/Makefile Normal file
View File

@ -0,0 +1,78 @@
# $NetBSD$
DISTNAME= gcc-14.1.0
PKGNAME= ${DISTNAME:C/^/avr-/}
CATEGORIES= cross
MASTER_SITES= ${MASTER_SITE_GNU:=gcc/${DISTNAME}/}
#EXTRACT_SUFX= .tar.xz
MAINTAINER= micha@NetBSD.org
COMMENT= GCC for Atmel AVR 8-bit RISC microcontrollers
LICENSE= gnu-gpl-v2 AND gnu-gpl-v3 AND gnu-lgpl-v2 AND gnu-lgpl-v3
# Required at least on AMD64
MKPIE_SUPPORTED= no
DISTFILES= ${DEFAULT_DISTFILES}
EXTRACT_ONLY= ${DEFAULT_DISTFILES}
DEPENDS+= avr-binutils>=2.42:../../cross/avr-binutils
.include "../../mk/bsd.prefs.mk"
USE_LANGUAGES= c c++
USE_CXX_FEATURES+= c++11
# Required for ISL with option "gcc-inplace-math"
FORCE_CXX_STD= c++11
USE_LIBTOOL= yes
USE_TOOLS+= bash gmake gsed:run perl
GNU_CONFIGURE= yes
GNU_CONFIGURE_STRICT= no
CHECK_PORTABILITY_SKIP+= contrib/* # not needed for building
# Build outside ${WRKSRC}
OBJDIR= ../build
CONFIGURE_DIRS= ${OBJDIR}
CONFIGURE_SCRIPT= ../${DISTNAME}/configure
CONFIG_SHELL= ${TOOLS_PATH.bash}
CONFIGURE_ARGS+= --enable-languages='c c++'
CONFIGURE_ARGS+= --enable-multilib
CONFIGURE_ARGS+= --disable-libcc1
CONFIGURE_ARGS+= --disable-libquadmath-support
CONFIGURE_ARGS+= --disable-lto
CONFIGURE_ARGS+= --disable-nls
CONFIGURE_ARGS+= --target=avr
CONFIGURE_ARGS+= --with-system-zlib
# XXX: Workaround for configure error:
# checking dependency style of c++... none
# configure: error: no usable dependency style found
MAKE_ENV+= am_cv_CXX_dependencies_compiler_type=gcc3
# From lang/gcc10
MAKE_ENV.NetBSD+= ac_cv_func_clock_gettime=yes
MAKE_ENV.NetBSD+= ac_cv_func_gethostbyname_r=no
MAKE_ENV.NetBSD+= ac_cv_func_freelocale=no
MAKE_ENV.NetBSD+= ac_cv_func_newlocale=no
MAKE_ENV.NetBSD+= ac_cv_func_uselocale=no
MAKE_ENV.SunOS+= ac_cv_func_mkostemp=no
INSTALLATION_DIRS+= avr/bin
.include "options.mk"
pre-configure:
${RUN} cd ${WRKSRC} && ${MKDIR} ${OBJDIR}
# Remove some manual pages from generic locations
# File paths from this package should not overlap with other GCC packages
post-install:
${RM} -rf ${DESTDIR}${PREFIX}/${PKGMANDIR}/man7
BUILDLINK_API_DEPENDS.zlib+= zlib>=1.2.3
.include "../../devel/zlib/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

1064
avr-gcc/PLIST Normal file

File diff suppressed because it is too large Load Diff

6
avr-gcc/TODO Normal file
View File

@ -0,0 +1,6 @@
[X] Remove pkgsrc patches that were merged upstream
[X] Update PLIST
[X] Test option "gcc-inplace-math"
[X] Verify whether MKPIE must still be disabled
[ ] Test with real hardware

14
avr-gcc/buildlink3.mk Normal file
View File

@ -0,0 +1,14 @@
# $NetBSD$
BUILDLINK_TREE+= avr-gcc
.if !defined(AVR_GCC_BUILDLINK3_MK)
AVR_GCC_BUILDLINK3_MK:=
USE_CXX_FEATURES+= c++11
BUILDLINK_API_DEPENDS.avr-gcc+= avr-gcc>=14.1.0
BUILDLINK_PKGSRCDIR.avr-gcc?= ../../wip/avr-gcc
.endif # AVR_GCC_BUILDLINK3_MK
BUILDLINK_TREE+= -avr-gcc

6
avr-gcc/distinfo Normal file
View File

@ -0,0 +1,6 @@
$NetBSD$
BLAKE2s (gcc-14.1.0.tar.gz) = 0da28ec7254aa68e5e6709a72ce4575b5cb4b9a8f0f59c194d09f364bd29251d
SHA512 (gcc-14.1.0.tar.gz) = d1ef7c8ba4134e7c64f715665f41eef5af30662352503442241a73772ce03de804ea4ca667353731b67c9fc66bdc2faec2bec3fd3d5bce1826c8ad545698345b
Size (gcc-14.1.0.tar.gz) = 160641299 bytes
SHA1 (patch-libgcc_libgcov.h) = 1fe3a2b55bac15ea1332040462675755945f5b05

28
avr-gcc/options.mk Normal file
View File

@ -0,0 +1,28 @@
# $NetBSD$
PKG_OPTIONS_VAR= PKG_OPTIONS.avr-gcc
PKG_SUPPORTED_OPTIONS= gcc-inplace-math
PKG_SUGGESTED_OPTIONS=
.include "../../mk/bsd.options.mk"
# gcc-inplace-math: Build math libraries in place
.if !empty(PKG_OPTIONS:Mgcc-inplace-math)
. include "../../devel/gmp/inplace.mk"
. include "../../math/isl/inplace.mk"
. include "../../math/mpcomplex/inplace.mk"
. include "../../math/mpfr/inplace.mk"
.else
CONFIGURE_ARGS+= --with-gmp=${BUILDLINK_PREFIX.gmp}
CONFIGURE_ARGS+= --with-isl=${BUILDLINK_PREFIX.isl}
CONFIGURE_ARGS+= --with-mpc=${BUILDLINK_PREFIX.mpcomplex}
CONFIGURE_ARGS+= --with-mpfr=${BUILDLINK_PREFIX.mpfr}
BUILDLINK_API_DEPENDS.gmp+= gmp>=4.3.2
. include "../../devel/gmp/buildlink3.mk"
BUILDLINK_API_DEPENDS.isl+= isl>=0.15
. include "../../math/isl/buildlink3.mk"
BUILDLINK_API_DEPENDS.mpcomplex+= mpcomplex>=1.0.1
. include "../../math/mpcomplex/buildlink3.mk"
BUILDLINK_API_DEPENDS.mpfr+= mpfr>=3.1.0
. include "../../math/mpfr/buildlink3.mk"
.endif

View File

@ -0,0 +1,22 @@
$NetBSD: patch-libgcc_libgcov.h,v 1.1 2024/04/26 13:05:01 micha Exp $
System include directory is not searched, even if "sys/mman.h" header
file is present. Quoted from "libgcc/configure.ac":
| The libgcc should not depend on any header files
=> Redefine HAVE_SYS_MMAN_H to zero.
--- libgcc/libgcov.h.orig 2022-05-06 07:30:59.000000000 +0000
+++ libgcc/libgcov.h
@@ -45,6 +45,12 @@
#include "libgcc_tm.h"
#include "gcov.h"
+// ----------------------------------
+// pkgsrc patch
+#undef HAVE_SYS_MMAN_H
+#define HAVE_SYS_MMAN_H 0
+// ----------------------------------
+
#if HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif