Re: [PATCH] libdl: Refactor shared code in Arm and AArch64
OK Nice change and clean up. Thanks Chris On 29/7/2022 1:04 am, Ryan Long wrote: > rtl-mdreloc-arm.c was used as the basis for rtl-mdreloc-aarch64.c. This lead > to some code being shared by the two files. The code was consolidated into > rtl-unwind-arm.c. > > Closes #4686 > --- > cpukit/libdl/rtl-mdreloc-aarch64.c | 79 +- > cpukit/libdl/rtl-mdreloc-arm.c | 79 +- > cpukit/libdl/rtl-unwind-arm.c | 69 ++ > cpukit/libdl/rtl-unwind-arm.h | 46 + > spec/build/cpukit/objdlaarch64.yml | 1 + > spec/build/cpukit/objdlarm.yml | 1 + > 6 files changed, 119 insertions(+), 156 deletions(-) > create mode 100644 cpukit/libdl/rtl-unwind-arm.c > create mode 100644 cpukit/libdl/rtl-unwind-arm.h > > diff --git a/cpukit/libdl/rtl-mdreloc-aarch64.c > b/cpukit/libdl/rtl-mdreloc-aarch64.c > index 3b1bbff2d2..738c9eba70 100644 > --- a/cpukit/libdl/rtl-mdreloc-aarch64.c > +++ b/cpukit/libdl/rtl-mdreloc-aarch64.c > @@ -73,16 +73,12 @@ __RCSID("$NetBSD: mdreloc.c,v 1.14 2020/06/16 21:01:30 > joerg Exp $"); > #include > #include > #include > -#include > > #include > #include "rtl-elf.h" > #include "rtl-error.h" > #include > -#include "rtl-unwind.h" > - > -typedef unsigned _Unwind_Word __attribute__((__mode__(__word__))); > -typedef _Unwind_Word _uw; > +#include "rtl-unwind-arm.h" > > struct tls_data { >size_ttd_tlsindex; > @@ -523,76 +519,3 @@ rtems_rtl_elf_relocate_rel (rtems_rtl_obj* > obj, >return rtems_rtl_elf_rel_failure; > } > > -bool > -rtems_rtl_elf_unwind_parse (const rtems_rtl_obj* obj, > -const char* name, > -uint32_t flags) > -{ > - /* > - * We location the EH sections in section flags. > - */ > - return false; > -} > - > -bool > -rtems_rtl_elf_unwind_register (rtems_rtl_obj* obj) > -{ > - return true; > -} > - > -bool > -rtems_rtl_elf_unwind_deregister (rtems_rtl_obj* obj) > -{ > - return true; > -} > - > -/* An exception index table entry. */ > -typedef struct __EIT_entry > -{ > - _uw fnoffset; > - _uw content; > -} __EIT_entry; > - > -/* The exception index table location in the base module */ > -extern __EIT_entry __exidx_start; > -extern __EIT_entry __exidx_end; > - > -/* > - * A weak reference is in libgcc, provide a real version and provide a way to > - * manage loaded modules. > - * > - * Passed in the return address and a reference to the number of records > - * found. We set the start of the exidx data and the number of records. > - */ > -_Unwind_Ptr __gnu_Unwind_Find_exidx (_Unwind_Ptr return_address, > - int*nrec) __attribute__ > ((__noinline__, > - > __used__, > - > __noclone__)); > - > -_Unwind_Ptr __gnu_Unwind_Find_exidx (_Unwind_Ptr return_address, > - int*nrec) > -{ > - rtems_rtl_data* rtl; > - rtems_chain_node* node; > - __EIT_entry* exidx_start = &__exidx_start; > - __EIT_entry* exidx_end = &__exidx_end; > - > - rtl = rtems_rtl_lock (); > - > - node = rtems_chain_first (>objects); > - while (!rtems_chain_is_tail (>objects, node)) { > -rtems_rtl_obj* obj = (rtems_rtl_obj*) node; > -if (rtems_rtl_obj_text_inside (obj, (void*) return_address)) { > - exidx_start = (__EIT_entry*) obj->eh_base; > - exidx_end = (__EIT_entry*) (obj->eh_base + obj->eh_size); > - break; > -} > -node = rtems_chain_next (node); > - } > - > - rtems_rtl_unlock (); > - > - *nrec = exidx_end - exidx_start; > - > - return (_Unwind_Ptr) exidx_start; > -} > diff --git a/cpukit/libdl/rtl-mdreloc-arm.c b/cpukit/libdl/rtl-mdreloc-arm.c > index 4950dcdab1..fbfd42dc58 100644 > --- a/cpukit/libdl/rtl-mdreloc-arm.c > +++ b/cpukit/libdl/rtl-mdreloc-arm.c > @@ -12,14 +12,12 @@ > #include > #include > #include > -#include > -#include > > #include > #include "rtl-elf.h" > #include "rtl-error.h" > #include > -#include "rtl-unwind.h" > +#include "rtl-unwind-arm.h" > > /* > * Set to 1 to allow untested relocations. If you tested one and it > @@ -597,78 +595,3 @@ rtems_rtl_elf_relocate_rel (rtems_rtl_obj* > obj, >symvalue, >false); > } > - > -bool > -rtems_rtl_elf_unwind_parse (const rtems_rtl_obj* obj, > -const char* name, > -uint32_t flags) > -{ > - /* > - * We location the EH sections in section flags. > - */ > - return false; > -} > - > -bool > -rtems_rtl_elf_unwind_register (rtems_rtl_obj* obj) > -{ > - return true; > -} > - > -bool > -rtems_rtl_elf_unwind_deregister (rtems_rtl_obj* obj) > -{ > - obj->loader = NULL; > -
Re: [PATCH v3 0/5] Add AArch64 support to libdl
OK Thank you for the contribution. It is appreciated and a welcome addition. Chris On 28/7/2022 11:05 pm, Ryan Long wrote: > Hi, > > In this version of the patchset I just removed the line that was setting the > objects loader to NULL. > > Thanks, > Ryan > > Ryan Long (5): > sys/exec_elf.h: Bring in newer file > libdl/rtl-elf.h: Fix aarch64 define > cpukit/libdl: Add support for AArch64 > libtests/dl*: Bump up the size of CONFIGURE_INIT_TASK_STACK_SIZE > cpukit/libdl/rtl-sym.c: Fix increment of variable > > cpukit/include/sys/exec_elf.h | 840 +- > cpukit/libdl/rtl-elf.h| 2 +- > cpukit/libdl/rtl-mdreloc-aarch64.c| 598 + > cpukit/libdl/rtl-sym.c| 2 +- > .../cpu/aarch64/include/machine/elf_machdep.h | 256 ++ > spec/build/cpukit/objdl.yml | 2 + > spec/build/cpukit/objdlaarch64.yml| 15 + > spec/build/cpukit/optlibdl.yml| 1 + > testsuites/libtests/dl01/init.c | 2 +- > testsuites/libtests/dl02/init.c | 2 +- > testsuites/libtests/dl03/init.c | 2 +- > testsuites/libtests/dl04/init.c | 2 +- > testsuites/libtests/dl05/init.c | 2 +- > testsuites/libtests/dl06/initimpl.h | 2 +- > testsuites/libtests/dl07/init.c | 2 +- > testsuites/libtests/dl08/init.c | 2 +- > testsuites/libtests/dl09/init.c | 2 +- > testsuites/libtests/dl10/init.c | 2 +- > 18 files changed, 1492 insertions(+), 244 deletions(-) > create mode 100644 cpukit/libdl/rtl-mdreloc-aarch64.c > create mode 100644 cpukit/score/cpu/aarch64/include/machine/elf_machdep.h > create mode 100644 spec/build/cpukit/objdlaarch64.yml > ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH] libdl: Refactor shared code in Arm and AArch64
rtl-mdreloc-arm.c was used as the basis for rtl-mdreloc-aarch64.c. This lead to some code being shared by the two files. The code was consolidated into rtl-unwind-arm.c. Closes #4686 --- cpukit/libdl/rtl-mdreloc-aarch64.c | 79 +- cpukit/libdl/rtl-mdreloc-arm.c | 79 +- cpukit/libdl/rtl-unwind-arm.c | 69 ++ cpukit/libdl/rtl-unwind-arm.h | 46 + spec/build/cpukit/objdlaarch64.yml | 1 + spec/build/cpukit/objdlarm.yml | 1 + 6 files changed, 119 insertions(+), 156 deletions(-) create mode 100644 cpukit/libdl/rtl-unwind-arm.c create mode 100644 cpukit/libdl/rtl-unwind-arm.h diff --git a/cpukit/libdl/rtl-mdreloc-aarch64.c b/cpukit/libdl/rtl-mdreloc-aarch64.c index 3b1bbff2d2..738c9eba70 100644 --- a/cpukit/libdl/rtl-mdreloc-aarch64.c +++ b/cpukit/libdl/rtl-mdreloc-aarch64.c @@ -73,16 +73,12 @@ __RCSID("$NetBSD: mdreloc.c,v 1.14 2020/06/16 21:01:30 joerg Exp $"); #include #include #include -#include #include #include "rtl-elf.h" #include "rtl-error.h" #include -#include "rtl-unwind.h" - -typedef unsigned _Unwind_Word __attribute__((__mode__(__word__))); -typedef _Unwind_Word _uw; +#include "rtl-unwind-arm.h" struct tls_data { size_ttd_tlsindex; @@ -523,76 +519,3 @@ rtems_rtl_elf_relocate_rel (rtems_rtl_obj*obj, return rtems_rtl_elf_rel_failure; } -bool -rtems_rtl_elf_unwind_parse (const rtems_rtl_obj* obj, -const char* name, -uint32_t flags) -{ - /* - * We location the EH sections in section flags. - */ - return false; -} - -bool -rtems_rtl_elf_unwind_register (rtems_rtl_obj* obj) -{ - return true; -} - -bool -rtems_rtl_elf_unwind_deregister (rtems_rtl_obj* obj) -{ - return true; -} - -/* An exception index table entry. */ -typedef struct __EIT_entry -{ - _uw fnoffset; - _uw content; -} __EIT_entry; - -/* The exception index table location in the base module */ -extern __EIT_entry __exidx_start; -extern __EIT_entry __exidx_end; - -/* - * A weak reference is in libgcc, provide a real version and provide a way to - * manage loaded modules. - * - * Passed in the return address and a reference to the number of records - * found. We set the start of the exidx data and the number of records. - */ -_Unwind_Ptr __gnu_Unwind_Find_exidx (_Unwind_Ptr return_address, - int*nrec) __attribute__ ((__noinline__, - __used__, - __noclone__)); - -_Unwind_Ptr __gnu_Unwind_Find_exidx (_Unwind_Ptr return_address, - int*nrec) -{ - rtems_rtl_data* rtl; - rtems_chain_node* node; - __EIT_entry* exidx_start = &__exidx_start; - __EIT_entry* exidx_end = &__exidx_end; - - rtl = rtems_rtl_lock (); - - node = rtems_chain_first (>objects); - while (!rtems_chain_is_tail (>objects, node)) { -rtems_rtl_obj* obj = (rtems_rtl_obj*) node; -if (rtems_rtl_obj_text_inside (obj, (void*) return_address)) { - exidx_start = (__EIT_entry*) obj->eh_base; - exidx_end = (__EIT_entry*) (obj->eh_base + obj->eh_size); - break; -} -node = rtems_chain_next (node); - } - - rtems_rtl_unlock (); - - *nrec = exidx_end - exidx_start; - - return (_Unwind_Ptr) exidx_start; -} diff --git a/cpukit/libdl/rtl-mdreloc-arm.c b/cpukit/libdl/rtl-mdreloc-arm.c index 4950dcdab1..fbfd42dc58 100644 --- a/cpukit/libdl/rtl-mdreloc-arm.c +++ b/cpukit/libdl/rtl-mdreloc-arm.c @@ -12,14 +12,12 @@ #include #include #include -#include -#include #include #include "rtl-elf.h" #include "rtl-error.h" #include -#include "rtl-unwind.h" +#include "rtl-unwind-arm.h" /* * Set to 1 to allow untested relocations. If you tested one and it @@ -597,78 +595,3 @@ rtems_rtl_elf_relocate_rel (rtems_rtl_obj*obj, symvalue, false); } - -bool -rtems_rtl_elf_unwind_parse (const rtems_rtl_obj* obj, -const char* name, -uint32_t flags) -{ - /* - * We location the EH sections in section flags. - */ - return false; -} - -bool -rtems_rtl_elf_unwind_register (rtems_rtl_obj* obj) -{ - return true; -} - -bool -rtems_rtl_elf_unwind_deregister (rtems_rtl_obj* obj) -{ - obj->loader = NULL; - return true; -} - -/* An exception index table entry. */ -typedef struct __EIT_entry -{ - _uw fnoffset; - _uw content; -} __EIT_entry; - -/* The exception index table location in the base module */ -extern __EIT_entry __exidx_start; -extern __EIT_entry __exidx_end; - -/* - * A weak reference is in libgcc, provide a real version and provide a way to - * manage loaded modules. - * - * Passed in the return address and a
[PATCH v3 0/5] Add AArch64 support to libdl
Hi, In this version of the patchset I just removed the line that was setting the objects loader to NULL. Thanks, Ryan Ryan Long (5): sys/exec_elf.h: Bring in newer file libdl/rtl-elf.h: Fix aarch64 define cpukit/libdl: Add support for AArch64 libtests/dl*: Bump up the size of CONFIGURE_INIT_TASK_STACK_SIZE cpukit/libdl/rtl-sym.c: Fix increment of variable cpukit/include/sys/exec_elf.h | 840 +- cpukit/libdl/rtl-elf.h| 2 +- cpukit/libdl/rtl-mdreloc-aarch64.c| 598 + cpukit/libdl/rtl-sym.c| 2 +- .../cpu/aarch64/include/machine/elf_machdep.h | 256 ++ spec/build/cpukit/objdl.yml | 2 + spec/build/cpukit/objdlaarch64.yml| 15 + spec/build/cpukit/optlibdl.yml| 1 + testsuites/libtests/dl01/init.c | 2 +- testsuites/libtests/dl02/init.c | 2 +- testsuites/libtests/dl03/init.c | 2 +- testsuites/libtests/dl04/init.c | 2 +- testsuites/libtests/dl05/init.c | 2 +- testsuites/libtests/dl06/initimpl.h | 2 +- testsuites/libtests/dl07/init.c | 2 +- testsuites/libtests/dl08/init.c | 2 +- testsuites/libtests/dl09/init.c | 2 +- testsuites/libtests/dl10/init.c | 2 +- 18 files changed, 1492 insertions(+), 244 deletions(-) create mode 100644 cpukit/libdl/rtl-mdreloc-aarch64.c create mode 100644 cpukit/score/cpu/aarch64/include/machine/elf_machdep.h create mode 100644 spec/build/cpukit/objdlaarch64.yml -- 2.30.2 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH v3 1/5] sys/exec_elf.h: Bring in newer file
Updated this file with the newer version in NetBSD. Updates #4682 --- cpukit/include/sys/exec_elf.h | 840 -- 1 file changed, 608 insertions(+), 232 deletions(-) diff --git a/cpukit/include/sys/exec_elf.h b/cpukit/include/sys/exec_elf.h index 4242415f54..b50da6b272 100644 --- a/cpukit/include/sys/exec_elf.h +++ b/cpukit/include/sys/exec_elf.h @@ -1,4 +1,4 @@ -/* $NetBSD: exec_elf.h,v 1.102 2010/03/01 11:27:29 skrll Exp $ */ +/* $NetBSD: exec_elf.h,v 1.168 2020/10/19 19:33:02 christos Exp $ */ /*- * Copyright (c) 1994 The NetBSD Foundation, Inc. @@ -44,6 +44,7 @@ #include #else #include +#include #endif /* _KERNEL || _STANDALONE */ #if defined(ELFSIZE) @@ -60,49 +61,41 @@ #include #endif -typedefuint8_t Elf_Byte; - -typedefuint32_tElf32_Addr; -#defineELF32_FSZ_ADDR 4 -typedefuint32_tElf32_Off; -typedefint32_t Elf32_SOff; -#defineELF32_FSZ_OFF 4 -typedefint32_t Elf32_Sword; -#defineELF32_FSZ_SWORD 4 -typedefuint32_tElf32_Word; -#defineELF32_FSZ_WORD 4 -typedefuint16_tElf32_Half; -#defineELF32_FSZ_HALF 2 -typedefuint64_tElf32_Lword; -#defineELF32_FSZ_LWORD 8 - -typedefuint64_tElf64_Addr; -#defineELF64_FSZ_ADDR 8 -typedefuint64_tElf64_Off; -typedefint64_t Elf64_SOff; -#defineELF64_FSZ_OFF 8 -typedefint32_t Elf64_Shalf; -#defineELF64_FSZ_SHALF 4 - -#ifndef ELF64_FSZ_SWORD -typedefint32_t Elf64_Sword; -#defineELF64_FSZ_SWORD 4 -#endif /* ELF64_FSZ_SWORD */ -#ifndef ELF64_FSZ_WORD -typedefuint32_tElf64_Word; -#defineELF64_FSZ_WORD 4 -#endif /* ELF64_FSZ_WORD */ - -typedefint64_t Elf64_Sxword; -#defineELF64_FSZ_SXWORD 8 -typedefuint64_tElf64_Xword; -#defineELF64_FSZ_XWORD 8 -typedefuint64_tElf64_Lword; -#defineELF64_FSZ_LWORD 8 -typedefuint32_tElf64_Half; -#defineELF64_FSZ_HALF 4 -typedefuint16_tElf64_Quarter; -#defineELF64_FSZ_QUARTER 2 +typedef uint8_tElf_Byte; + +typedef uint32_t Elf32_Addr; +#define ELF32_FSZ_ADDR 4 +typedef uint32_t Elf32_Off; +typedef int32_tElf32_SOff; +#define ELF32_FSZ_OFF 4 +typedef int32_tElf32_Sword; +#define ELF32_FSZ_SWORD 4 +typedef uint32_t Elf32_Word; +#define ELF32_FSZ_WORD 4 +typedef uint16_t Elf32_Half; +#define ELF32_FSZ_HALF 2 +typedef uint64_t Elf32_Lword; +#define ELF32_FSZ_LWORD 8 + +typedef uint64_t Elf64_Addr; +#define ELF64_FSZ_ADDR 8 +typedef uint64_t Elf64_Off; +typedef int64_tElf64_SOff; +#define ELF64_FSZ_OFF 8 + +typedef int32_tElf64_Sword; +#define ELF64_FSZ_SWORD 4 +typedef uint32_t Elf64_Word; +#define ELF64_FSZ_WORD 4 + +typedef int64_tElf64_Sxword; +#define ELF64_FSZ_SXWORD 8 +typedef uint64_t Elf64_Xword; +#define ELF64_FSZ_XWORD 8 +typedef uint64_t Elf64_Lword; +#define ELF64_FSZ_LWORD 8 +typedef uint16_t Elf64_Half; +#define ELF64_FSZ_HALF 2 /* * ELF Header @@ -118,29 +111,29 @@ typedef struct { Elf32_Off e_phoff;/* Program hdr offset */ Elf32_Off e_shoff;/* Section hdr offset */ Elf32_Word e_flags;/* Processor flags */ - Elf32_Half e_ehsize; /* sizeof ehdr */ - Elf32_Half e_phentsize;/* Program header entry size */ - Elf32_Half e_phnum;/* Number of program headers */ - Elf32_Half e_shentsize;/* Section header entry size */ - Elf32_Half e_shnum;/* Number of section headers */ - Elf32_Half e_shstrndx; /* String table index */ + Elf32_Half e_ehsize; /* sizeof ehdr */ + Elf32_Half e_phentsize;/* Program header entry size */ + Elf32_Half e_phnum;/* Number of program headers */ + Elf32_Half e_shentsize;/* Section header entry size */ + Elf32_Half e_shnum;/* Number of section headers */ + Elf32_Half e_shstrndx; /* String table index */ } Elf32_Ehdr; typedef struct { unsigned char e_ident[ELF_NIDENT];/* Id bytes */ - Elf64_Quarter e_type; /* file type */ - Elf64_Quarter e_machine; /* machine type */ - Elf64_Half e_version; /* version number */ + Elf64_Half e_type; /* file type */ + Elf64_Half e_machine; /* machine type */ + Elf64_Word e_version; /* version
[PATCH v3 4/5] libtests/dl*: Bump up the size of CONFIGURE_INIT_TASK_STACK_SIZE
Updates #4682 --- testsuites/libtests/dl01/init.c | 2 +- testsuites/libtests/dl02/init.c | 2 +- testsuites/libtests/dl03/init.c | 2 +- testsuites/libtests/dl04/init.c | 2 +- testsuites/libtests/dl05/init.c | 2 +- testsuites/libtests/dl06/initimpl.h | 2 +- testsuites/libtests/dl07/init.c | 2 +- testsuites/libtests/dl08/init.c | 2 +- testsuites/libtests/dl09/init.c | 2 +- testsuites/libtests/dl10/init.c | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/testsuites/libtests/dl01/init.c b/testsuites/libtests/dl01/init.c index 59cf3147f0..06fa8004b8 100644 --- a/testsuites/libtests/dl01/init.c +++ b/testsuites/libtests/dl01/init.c @@ -94,7 +94,7 @@ static void Init(rtems_task_argument arg) #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_INIT_TASK_STACK_SIZE (8U * 1024U) +#define CONFIGURE_INIT_TASK_STACK_SIZE (CONFIGURE_MINIMUM_TASK_STACK_SIZE + (4U * 1024U)) #define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT diff --git a/testsuites/libtests/dl02/init.c b/testsuites/libtests/dl02/init.c index 19563e9093..495a58d287 100644 --- a/testsuites/libtests/dl02/init.c +++ b/testsuites/libtests/dl02/init.c @@ -94,7 +94,7 @@ static void Init(rtems_task_argument arg) #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_INIT_TASK_STACK_SIZE (8U * 1024U) +#define CONFIGURE_INIT_TASK_STACK_SIZE (CONFIGURE_MINIMUM_TASK_STACK_SIZE + (4U * 1024U)) #define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT) diff --git a/testsuites/libtests/dl03/init.c b/testsuites/libtests/dl03/init.c index 5080323c05..e953f1a4c6 100644 --- a/testsuites/libtests/dl03/init.c +++ b/testsuites/libtests/dl03/init.c @@ -80,7 +80,7 @@ static void Init(rtems_task_argument arg) #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_INIT_TASK_STACK_SIZE (8U * 1024U) +#define CONFIGURE_INIT_TASK_STACK_SIZE (CONFIGURE_MINIMUM_TASK_STACK_SIZE + (4U * 1024U)) #define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT) diff --git a/testsuites/libtests/dl04/init.c b/testsuites/libtests/dl04/init.c index a733d9da14..54a852800d 100644 --- a/testsuites/libtests/dl04/init.c +++ b/testsuites/libtests/dl04/init.c @@ -94,7 +94,7 @@ static void Init(rtems_task_argument arg) #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_INIT_TASK_STACK_SIZE (8U * 1024U) +#define CONFIGURE_INIT_TASK_STACK_SIZE (CONFIGURE_MINIMUM_TASK_STACK_SIZE + (4U * 1024U)) #define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT diff --git a/testsuites/libtests/dl05/init.c b/testsuites/libtests/dl05/init.c index 93d69578f7..7e34af757d 100644 --- a/testsuites/libtests/dl05/init.c +++ b/testsuites/libtests/dl05/init.c @@ -96,7 +96,7 @@ static void Init(rtems_task_argument arg) #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_INIT_TASK_STACK_SIZE (32U * 1024U) +#define CONFIGURE_INIT_TASK_STACK_SIZE (36U * 1024U) #define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT diff --git a/testsuites/libtests/dl06/initimpl.h b/testsuites/libtests/dl06/initimpl.h index 66e503b156..0d3987983d 100644 --- a/testsuites/libtests/dl06/initimpl.h +++ b/testsuites/libtests/dl06/initimpl.h @@ -98,7 +98,7 @@ static void Init(rtems_task_argument arg) #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_INIT_TASK_STACK_SIZE (8U * 1024U) +#define CONFIGURE_INIT_TASK_STACK_SIZE (CONFIGURE_MINIMUM_TASK_STACK_SIZE + (4U * 1024U)) #define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT) diff --git a/testsuites/libtests/dl07/init.c b/testsuites/libtests/dl07/init.c index 42b3bed3fc..8db106ba29 100644 --- a/testsuites/libtests/dl07/init.c +++ b/testsuites/libtests/dl07/init.c @@ -100,7 +100,7 @@ static void Init(rtems_task_argument arg) #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_INIT_TASK_STACK_SIZE (8U * 1024U) +#define CONFIGURE_INIT_TASK_STACK_SIZE (CONFIGURE_MINIMUM_TASK_STACK_SIZE + (4U * 1024U)) #define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT) diff --git a/testsuites/libtests/dl08/init.c b/testsuites/libtests/dl08/init.c index 02f999e0c6..23ebe41d63 100644 --- a/testsuites/libtests/dl08/init.c +++ b/testsuites/libtests/dl08/init.c @@ -100,7 +100,7 @@ static void Init(rtems_task_argument arg) #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_INIT_TASK_STACK_SIZE (8U * 1024U) +#define CONFIGURE_INIT_TASK_STACK_SIZE (CONFIGURE_MINIMUM_TASK_STACK_SIZE + (4U * 1024U)) #define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT) diff --git a/testsuites/libtests/dl09/init.c b/testsuites/libtests/dl09/init.c index e8caf9b6e8..b375fe3f38 100644 --- a/testsuites/libtests/dl09/init.c +++ b/testsuites/libtests/dl09/init.c @@ -100,7 +100,7 @@ static void Init(rtems_task_argument arg) #define
[PATCH v3 3/5] cpukit/libdl: Add support for AArch64
rtl-mdreloc-aarch64.c and elf_machdep.h came from NetBSD. Updates #4682 --- cpukit/libdl/rtl-mdreloc-aarch64.c| 598 ++ .../cpu/aarch64/include/machine/elf_machdep.h | 256 spec/build/cpukit/objdl.yml | 2 + spec/build/cpukit/objdlaarch64.yml| 15 + spec/build/cpukit/optlibdl.yml| 1 + 5 files changed, 872 insertions(+) create mode 100644 cpukit/libdl/rtl-mdreloc-aarch64.c create mode 100644 cpukit/score/cpu/aarch64/include/machine/elf_machdep.h create mode 100644 spec/build/cpukit/objdlaarch64.yml diff --git a/cpukit/libdl/rtl-mdreloc-aarch64.c b/cpukit/libdl/rtl-mdreloc-aarch64.c new file mode 100644 index 00..3b1bbff2d2 --- /dev/null +++ b/cpukit/libdl/rtl-mdreloc-aarch64.c @@ -0,0 +1,598 @@ +/* + * Taken from NetBSD and stripped of the relocations not needed on RTEMS. + */ + +/* $NetBSD: mdreloc.c,v 1.14 2020/06/16 21:01:30 joerg Exp $ */ + +/*- + * Copyright (c) 2014 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Matt Thomas of 3am Software Foundry. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/*- + * Copyright (c) 2014-2015 The FreeBSD Foundation + * All rights reserved. + * + * Portions of this software were developed by Andrew Turner + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#ifndef lint +__RCSID("$NetBSD: mdreloc.c,v 1.14 2020/06/16 21:01:30 joerg Exp $"); +#endif /* not lint */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include "rtl-elf.h" +#include "rtl-error.h" +#include +#include "rtl-unwind.h" + +typedef unsigned _Unwind_Word __attribute__((__mode__(__word__))); +typedef _Unwind_Word _uw; + +struct tls_data { + size_ttd_tlsindex; + Elf_Addr td_tlsoffs; +}; + +rtems_rtl_elf_rel_status +rtems_rtl_elf_reloc_rela ( + rtems_rtl_obj*obj, + const Elf_Rela* rela, + const rtems_rtl_obj_sect* sect, + const char* symname, + const Elf_Bytesyminfo, + const Elf_Wordsymvalue, + const boolparsing +); + +#define __BITS(hi,lo) ((~((~(Elf_Addr)0)<<((hi)+1)))&((~(Elf_Addr)0)<<(lo))) +#define WIDTHMASK(w) (0xUL >> (64 - (w))) + +static inline bool +checkoverflow(Elf_Addr addr, int
[PATCH v3 5/5] cpukit/libdl/rtl-sym.c: Fix increment of variable
In rtems_rtl_symbol_global_add() the loop that gets to the end of the symbol table used "unsigned long" to increment the index for the table. For most architectures this resulted in 4, but with AArch64, it results in 8. This resulted in the symbols being read in wrong. Changing this to void* along with changing the RISC-V specific code for 8 byte pointers in rtems-tools to work independent of the architecture. Updates #4673 Closes #4682 --- cpukit/libdl/rtl-sym.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpukit/libdl/rtl-sym.c b/cpukit/libdl/rtl-sym.c index c29c8c49d6..5c9c3981df 100644 --- a/cpukit/libdl/rtl-sym.c +++ b/cpukit/libdl/rtl-sym.c @@ -124,7 +124,7 @@ rtems_rtl_symbol_global_add (rtems_rtl_obj* obj, return false; } ++count; -s += l + sizeof (unsigned long) + 1; +s += l + sizeof (void *) + 1; } /* -- 2.30.2 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH v3 2/5] libdl/rtl-elf.h: Fix aarch64 define
The aarch64 define was incorrect. This was causing the libdl tests to not work correctly. Updates #4682 --- cpukit/libdl/rtl-elf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpukit/libdl/rtl-elf.h b/cpukit/libdl/rtl-elf.h index c7c17c525a..0476c1ecd7 100644 --- a/cpukit/libdl/rtl-elf.h +++ b/cpukit/libdl/rtl-elf.h @@ -51,7 +51,7 @@ extern "C" { /* * Do not add '()'. Leave plain. */ -#if defined(__powerpc64__) || defined(__arch64__) || (__riscv_xlen == 64) +#if defined(__powerpc64__) || defined(__aarch64__) || (__riscv_xlen == 64) #define ELFSIZE 64 #else #define ELFSIZE 32 -- 2.30.2 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH v3] aarch64/versal: Support DDRMC0 region 0 and 1
On 28/7/2022 4:57 pm, Sebastian Huber wrote: > Hello, > > I get now linker errors: > > /opt/rtems/6/lib/gcc/aarch64-rtems6/12.1.1/../../../../aarch64-rtems6/bin/ld: > ./librtemsbsp.a(bspstartmmu.c.7.o):(.rodata.bsp_r1_region+0x0): undefined > reference to `bsp_r1_ram_base' > /opt/rtems/6/lib/gcc/aarch64-rtems6/12.1.1/../../../../aarch64-rtems6/bin/ld: > ./librtemsbsp.a(bspstartmmu.c.7.o):(.rodata.bsp_r1_region+0x4): undefined > reference to `bsp_r1_ram_end' > /opt/rtems/6/lib/gcc/aarch64-rtems6/12.1.1/../../../../aarch64-rtems6/bin/ld: > ./librtemsbsp.a(bspstartmmu.c.7.o):(.bsp_start_data+0x140): undefined > reference > to `bsp_r1_ram_base' > /opt/rtems/6/lib/gcc/aarch64-rtems6/12.1.1/../../../../aarch64-rtems6/bin/ld: > ./librtemsbsp.a(bspstartmmu.c.7.o):(.bsp_start_data+0x144): undefined > reference > to `bsp_r1_ram_end' > collect2: error: ld returned 1 exit status > > Waf: Leaving directory `/tmp/sh/b-rtems/aarch64/xilinx_versal_ilp32_qemu' Thanks. I was not aware there was an ILP32 version of the Versal. I will add some ILP32 checks. Given the size and scale of the device I am not sure why ILP32 would be used. Chris ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH v3] aarch64/versal: Support DDRMC0 region 0 and 1
Hello, I get now linker errors: /opt/rtems/6/lib/gcc/aarch64-rtems6/12.1.1/../../../../aarch64-rtems6/bin/ld: ./librtemsbsp.a(bspstartmmu.c.7.o):(.rodata.bsp_r1_region+0x0): undefined reference to `bsp_r1_ram_base' /opt/rtems/6/lib/gcc/aarch64-rtems6/12.1.1/../../../../aarch64-rtems6/bin/ld: ./librtemsbsp.a(bspstartmmu.c.7.o):(.rodata.bsp_r1_region+0x4): undefined reference to `bsp_r1_ram_end' /opt/rtems/6/lib/gcc/aarch64-rtems6/12.1.1/../../../../aarch64-rtems6/bin/ld: ./librtemsbsp.a(bspstartmmu.c.7.o):(.bsp_start_data+0x140): undefined reference to `bsp_r1_ram_base' /opt/rtems/6/lib/gcc/aarch64-rtems6/12.1.1/../../../../aarch64-rtems6/bin/ld: ./librtemsbsp.a(bspstartmmu.c.7.o):(.bsp_start_data+0x144): undefined reference to `bsp_r1_ram_end' collect2: error: ld returned 1 exit status Waf: Leaving directory `/tmp/sh/b-rtems/aarch64/xilinx_versal_ilp32_qemu' -- embedded brains GmbH Herr Sebastian HUBER Dornierstr. 4 82178 Puchheim Germany email: sebastian.hu...@embedded-brains.de phone: +49-89-18 94 741 - 16 fax: +49-89-18 94 741 - 08 Registergericht: Amtsgericht München Registernummer: HRB 157899 Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler Unsere Datenschutzerklärung finden Sie hier: https://embedded-brains.de/datenschutzerklaerung/ ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel