[RFC] libdl: Make Elf_Sym::st_other available
The 64-bit PowerPC ELFv2 relocation support needs access to the Elf_Sym::st_other symbol information. The machine-specific relocation handler had only access to the Elf_Sym::st_info symbol information. This change extends the 8-bit syminfo parameter to 16-bit and uses the additional 8-bits to provide Elf_Sym::st_other. Another approach could be to pass a pointer to an Elf_Sym object instead of symname, syminfo, and symvalue. Update #4996. --- cpukit/libdl/rtl-elf.c | 12 ++-- cpukit/libdl/rtl-elf.h | 8 cpukit/libdl/rtl-mdreloc-powerpc.c | 10 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/cpukit/libdl/rtl-elf.c b/cpukit/libdl/rtl-elf.c index dddf9aceab..cf56929198 100644 --- a/cpukit/libdl/rtl-elf.c +++ b/cpukit/libdl/rtl-elf.c @@ -275,7 +275,7 @@ rtems_rtl_elf_reloc_parser (rtems_rtl_obj* obj, (uintmax_t) symvalue, (int) ELF_R_TYPE (rela->r_info), (uintmax_t) rela->r_offset, (int) rela->r_addend); rs = rtems_rtl_elf_relocate_rela_tramp (obj, rela, targetsect, -symname, sym->st_info, symvalue); +symname, (sym->st_other << 8) | sym->st_info, symvalue); rel_words[REL_R_OFFSET] = rela->r_offset; rel_words[REL_R_INFO] = rela->r_info; rel_words[REL_R_ADDEND] = rela->r_addend; @@ -392,7 +392,7 @@ rtems_rtl_elf_reloc_relocator (rtems_rtl_obj* obj, (uintmax_t) symvalue, (int) ELF_R_TYPE (rela->r_info), (uintmax_t) rela->r_offset, (int) rela->r_addend); rs = rtems_rtl_elf_relocate_rela (obj, rela, targetsect, -symname, sym->st_info, symvalue); +symname, (sym->st_other << 8) | sym->st_info, symvalue); if (rs != rtems_rtl_elf_rel_no_error) return false; } @@ -404,7 +404,7 @@ rtems_rtl_elf_reloc_relocator (rtems_rtl_obj* obj, (uintmax_t) symvalue, (int) ELF_R_TYPE (rel->r_info), (uintmax_t) rel->r_offset); rs = rtems_rtl_elf_relocate_rel (obj, rel, targetsect, - symname, sym->st_info, symvalue); + symname, (sym->st_other << 8) | sym->st_info, symvalue); if (rs != rtems_rtl_elf_rel_no_error) return false; } @@ -1217,7 +1217,7 @@ rtems_rtl_elf_symbols_load (rtems_rtl_obj* obj, memcpy (string, name, strlen (name) + 1); osym->name = string; osym->value = (void*) (intptr_t) value; -osym->data = symbol.st_shndx; +osym->data = (symbol.st_other << 8) | symbol.st_shndx; if (rtems_rtl_trace (RTEMS_RTL_TRACE_SYMBOL)) printf ("rtl: sym:add:%-4d name:%-4d: %-20s: bind:%-2d " \ @@ -1246,7 +1246,7 @@ rtems_rtl_elf_symbols_locate (rtems_rtl_obj* obj, { rtems_rtl_obj_sym* osym = &obj->local_table[sym]; rtems_rtl_obj_sect* symsect; - symsect = rtems_rtl_obj_find_section_by_index (obj, osym->data); + symsect = rtems_rtl_obj_find_section_by_index (obj, osym->data & 0xff); if (symsect) { osym->value += (intptr_t) symsect->base; @@ -1261,7 +1261,7 @@ rtems_rtl_elf_symbols_locate (rtems_rtl_obj* obj, { rtems_rtl_obj_sym* osym = &obj->global_table[sym]; rtems_rtl_obj_sect* symsect; - symsect = rtems_rtl_obj_find_section_by_index (obj, osym->data); + symsect = rtems_rtl_obj_find_section_by_index (obj, osym->data & 0xff); if (symsect) { osym->value += (intptr_t) symsect->base; diff --git a/cpukit/libdl/rtl-elf.h b/cpukit/libdl/rtl-elf.h index 0476c1ecd7..98b460e6f4 100644 --- a/cpukit/libdl/rtl-elf.h +++ b/cpukit/libdl/rtl-elf.h @@ -185,7 +185,7 @@ rtems_rtl_elf_rel_status rtems_rtl_elf_relocate_rel_tramp (rtems_rtl_obj* const Elf_Rel* rel, const rtems_rtl_obj_sect* sect, const char* symname, - const Elf_Byte syminfo, + const Elf_Half syminfo, const Elf_Word symvalue); /** @@ -205,7 +205,7 @@ rtems_rtl_elf_rel_status rtems_rtl_elf_relocate_rela_tramp (rtems_rtl_obj* const Elf_Rela* rela, const rtems_rtl_obj_sect* sect, const char* symname, - const Elf_Byte syminfo,
Re: [PATCH] improved error checking in ticks per timeslice
On 19.02.24 03:13, zakthertems...@gmail.com wrote: +#if defined(CONFIGURE_TICKS_PER_TIMESLICE) + #if CONFIGURE_TICKS_PER_TIMESLICE <= 0 +#error "CONFIGURE_TICKS_PER_TIMESLICE shall be greater than zero" + #endif +#endif This should be #if defined(CONFIGURE_TICKS_PER_TIMESLICE) && CONFIGURE_TICKS_PER_TIMESLICE <= 0 from my point of view. Just check the style of the related header files for a reference. -- embedded brains GmbH & Co. KG 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
Re: [PATCH] improved error checking in ticks per timeslice
ping On Tue, 20 Feb 2024 at 20:25, zack leung wrote: > ping > > On Sun, 18 Feb 2024 at 21:15, wrote: > >> --- >> cpukit/doxygen/appl-config.h | 2 +- >> cpukit/include/rtems/confdefs/clock.h | 6 ++ >> 2 files changed, 7 insertions(+), 1 deletion(-) >> >> diff --git a/cpukit/doxygen/appl-config.h b/cpukit/doxygen/appl-config.h >> index bd7cde628f..d480eb3971 100644 >> --- a/cpukit/doxygen/appl-config.h >> +++ b/cpukit/doxygen/appl-config.h >> @@ -3312,7 +3312,7 @@ >> * @parblock >> * The following constraints apply to this configuration option: >> * >> - * * The value of the configuration option shall be greater than or >> equal to >> + * * The value of the configuration option shall be greater than >> * zero. >> * >> * * The value of the configuration option shall be less than or equal >> to > diff --git a/cpukit/include/rtems/confdefs/clock.h >> b/cpukit/include/rtems/confdefs/clock.h >> index 26519cc70b..f4c4575057 100644 >> --- a/cpukit/include/rtems/confdefs/clock.h >> +++ b/cpukit/include/rtems/confdefs/clock.h >> @@ -74,6 +74,12 @@ >>#error "CONFIGURE_MICROSECONDS_PER_TICK must be positive" >> #endif >> >> +#if defined(CONFIGURE_TICKS_PER_TIMESLICE) >> + #if CONFIGURE_TICKS_PER_TIMESLICE <= 0 >> +#error "CONFIGURE_TICKS_PER_TIMESLICE shall be greater than zero" >> + #endif >> +#endif >> + >> #ifdef __cplusplus >> extern "C" { >> #endif >> -- >> 2.43.0 >> >> ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Patch with modified hello world
SeifalrahmanAhmedAlfakharany.patch Description: Binary data ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[RTEMS Tools 4/4] rld: Recognize 64-bit PowerPC
Close #4995. --- rtemstoolkit/rld-elf.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/rtemstoolkit/rld-elf.cpp b/rtemstoolkit/rld-elf.cpp index 8b55818..b131461 100644 --- a/rtemstoolkit/rld-elf.cpp +++ b/rtemstoolkit/rld-elf.cpp @@ -1178,6 +1178,7 @@ namespace rld { "m68k",EM_COLDFIRE }, { "mips",EM_MIPS }, { "powerpc", EM_PPC }, +{ "powerpc", EM_PPC64 }, #ifndef EM_RISCV { "riscv", 243 }, /* If not in libelf yet */ #else -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[RTEMS Tools 2/4] linkers: Constify read-only data
--- linkers/rtems-syms.cpp | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/linkers/rtems-syms.cpp b/linkers/rtems-syms.cpp index 9fe552e..377007d 100644 --- a/linkers/rtems-syms.cpp +++ b/linkers/rtems-syms.cpp @@ -53,7 +53,7 @@ /** * Header text. */ -static const char* c_header[] = +static const char* const c_header[] = { "/*", " * RTEMS Global Symbol Table", @@ -90,7 +90,7 @@ static const char* c_header[] = 0 }; -static const char* c_sym_table_end[] = +static const char* const c_sym_table_end[] = { "asm(\" .byte0\");", "asm(\" .ascii \\\"\\xde\\xad\\xbe\\xef\\\"\");", @@ -98,13 +98,13 @@ static const char* c_sym_table_end[] = 0 }; -static const char* c_tls_call_table_start[] = +static const char* const c_tls_call_table_start[] = { "rtems_rtl_tls_offset rtems_rtl_tls_offsets[] = {", 0 }; -static const char* c_tls_call_table_end[] = +static const char* const c_tls_call_table_end[] = { "};", "#define RTEMS_RTL_TLS_OFFSETS_NUM " \ @@ -113,7 +113,7 @@ static const char* c_tls_call_table_end[] = 0 }; -static const char* c_trailer[] = +static const char* const c_trailer[] = { "/*", " * Symbol table size.", @@ -127,7 +127,7 @@ static const char* c_trailer[] = 0 }; -static const char* c_rtl_call_body_embeded[] = +static const char* const c_rtl_call_body_embeded[] = { "{", " rtems_rtl_base_sym_global_add (&rtems__rtl_base_globals[0],", @@ -138,7 +138,7 @@ static const char* c_rtl_call_body_embeded[] = 0 }; -static const char* c_rtl_call_body[] = +static const char* const c_rtl_call_body[] = { "{", " rtems_rtl_base_sym_global_add (&rtems__rtl_base_globals[0],", @@ -153,7 +153,7 @@ static const char* c_rtl_call_body[] = * Paint the data to the temporary file. */ static void -temporary_file_paint (rld::process::tempfile& t, const char* lines[]) +temporary_file_paint (rld::process::tempfile& t, const char* const lines[]) { for (int l = 0; lines[l]; ++l) t.write_line (lines[l]); -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[RTEMS Tools 1/4] linkers: Avoid void pointer arithmetic
--- linkers/rtems-syms.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/linkers/rtems-syms.cpp b/linkers/rtems-syms.cpp index f0ac2bb..9fe552e 100644 --- a/linkers/rtems-syms.cpp +++ b/linkers/rtems-syms.cpp @@ -322,9 +322,9 @@ output_sym::operator ()(const rld::symbols::symtab::value_type& value) if (sym.type () == STT_TLS) { c.write_line ("#define RTEMS_TLS_INDEX_" + sym.name () + " " + std::to_string(index)); c.write_line ("static size_t rtems_rtl_tls_" + sym.name () + "(void) {"); -c.write_line (" extern __thread void* " + sym.name () + ";"); -c.write_line (" const void* tls_base = rtems_rtl_tls_get_base ();"); -c.write_line (" const void* tls_addr = (void*) &" + sym.name () + ";"); +c.write_line (" extern __thread char " + sym.name () + "[];"); +c.write_line (" size_t tls_base = (size_t) rtems_rtl_tls_get_base ();"); +c.write_line (" size_t tls_addr = (size_t) " + sym.name () + ";"); c.write_line (" return tls_addr - tls_base;"); c.write_line ("}"); c.write_line (""); -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[RTEMS Tools 3/4] linkers: Allow generation of symbol map file only
If a symbol map file is specified by the user and no output file, then just generate the symbol map file. The user can then compile the file using its own build jobs. --- linkers/rtems-syms.cpp | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/linkers/rtems-syms.cpp b/linkers/rtems-syms.cpp index 377007d..9dd845f 100644 --- a/linkers/rtems-syms.cpp +++ b/linkers/rtems-syms.cpp @@ -345,6 +345,10 @@ generate_c (rld::process::tempfile& c, rld::symbols::symtab& symbols, boolembed) { + if (rld::verbose ()) +std::cout << "symbol C file: " << c.name () << std::endl; + + c.open (true); temporary_file_paint (c, c_header); /* @@ -390,11 +394,6 @@ generate_symmap (rld::process::tempfile& c, rld::symbols::symtab& symbols, boolembed) { - c.open (true); - - if (rld::verbose ()) -std::cout << "symbol C file: " << c.name () << std::endl; - generate_c (c, symbols, embed); if (rld::verbose ()) @@ -622,8 +621,8 @@ main (int argc, char* argv[]) throw rld::error ("no kernel file", "options"); if (argc != 1) throw rld::error ("only one kernel file", "options"); -if (output.empty () && map.empty ()) - throw rld::error ("no output or map", "options"); +if (output.empty () && symc.empty() && map.empty ()) + throw rld::error ("no output, symbol C file, or map", "options"); kernel_name = *argv; @@ -683,7 +682,7 @@ main (int argc, char* argv[]) /* * Create an output file if asked too. */ - if (!output.empty ()) + if (!output.empty () || !symc.empty()) { rld::process::tempfile c (".c"); @@ -694,9 +693,12 @@ main (int argc, char* argv[]) } /* - * Generate and compile the symbol map. + * Generate and if requested compile the symbol map. */ -generate_symmap (c, output, filter_symbols, embed); +if (output.empty()) + generate_c (c, filter_symbols, embed); +else + generate_symmap (c, output, filter_symbols, embed); } kernel.close (); -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel