diff --git a/.gitignore b/.gitignore index 9219618..d3d4eab 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,3 @@ gputils-0.13.7.tar.gz /gputils-1.3.0.tar.gz /gputils-1.4.2-1.tar.gz /gputils-1.5.0-1.tar.bz2 -/gputils-1.5.2.tar.bz2 diff --git a/gpasm_1.5.0.patch b/gpasm_1.5.0.patch new file mode 100644 index 0000000..60344d5 --- /dev/null +++ b/gpasm_1.5.0.patch @@ -0,0 +1,542 @@ +Index: gpasm/symbol_list.c +=================================================================== +--- gpasm/symbol_list.c (revision 1311) ++++ gpasm/symbol_list.c (nonexistent) +@@ -1,145 +0,0 @@ +-/* Symbol list support. +- +- Copyright (C) 2016 Molnar Karoly +- +-This file is part of gputils. +- +-gputils is free software; you can redistribute it and/or modify +-it under the terms of the GNU General Public License as published by +-the Free Software Foundation; either version 2, or (at your option) +-any later version. +- +-gputils is distributed in the hope that it will be useful, +-but WITHOUT ANY WARRANTY; without even the implied warranty of +-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-GNU General Public License for more details. +- +-You should have received a copy of the GNU General Public License +-along with gputils; see the file COPYING. If not, write to +-the Free Software Foundation, 59 Temple Place - Suite 330, +-Boston, MA 02111-1307, USA. */ +- +-#include "stdhdr.h" +- +-#include "libgputils.h" +-#include "gpasm.h" +-#include "coff.h" +-#include "symbol_list.h" +- +-/*------------------------------------------------------------------------------------------------*/ +- +-/* Auxiliary function for this module. */ +- +-static void +-_node_free(void *Node) +-{ +- symbol_node_t *n; +- +- n = (symbol_node_t *)Node; +- +- if (n->name != NULL) { +- free(n->name); +- } +- +- free(n); +-} +- +-/*------------------------------------------------------------------------------------------------*/ +- +-/* Initialize the symbol list. */ +- +-void +-symbol_list_init(void) +-{ +- gp_list_set_delete_node_func(&state.obj.symbol_fifo, _node_free); +-} +- +-/*------------------------------------------------------------------------------------------------*/ +- +-/* Add a new symbol to the list (fifo). */ +- +-void +-symbol_list_add_symbol(const symbol_t *Symbol, const char *Name, unsigned int Symbol_number, +- int Section_number, unsigned int Base_class, unsigned int Byte_address) +-{ +- symbol_node_t *node; +- +- +- if (state.pass != 1) { +- return; +- } +- +- node = (symbol_node_t *)gp_list_node_append(&state.obj.symbol_fifo, gp_list_node_new(sizeof(symbol_node_t))); +- node->symbol = Symbol; +- node->name = GP_Strdup(Name); +- node->symbol_number = Symbol_number; +- node->section_number = Section_number; +- node->base_class = Base_class; +- node->byte_address = Byte_address; +-} +- +-/*------------------------------------------------------------------------------------------------*/ +- +-/* Empties the list up to this symbol. */ +- +-void +-symbol_list_flush_symbols(const char *End_symbol_name) +-{ +- symbol_node_t *node; +- const symbol_t *symbol; +- const char *name; +- const variable_t *var; +- char *coff_name; +- +- if (state.obj.symbol_fifo.first == NULL) { +- return; +- } +- +- node = state.obj.symbol_fifo.curr; +- while (node != NULL) { +- symbol = node->symbol; +- +- if (symbol != NULL) { +- /* This is a "normal" symbol, not section or other. */ +- name = gp_sym_get_symbol_name(symbol); +- var = (const variable_t *)gp_sym_get_symbol_annotation(symbol); +- assert(var != NULL); +- coff_name = coff_local_name(name); +- /* Create new symbol. */ +- coff_add_sym(coff_name, var->value, var->type, node->section_number); +- +- if (coff_name != NULL) { +- free(coff_name); +- } +- } +- +- if ((End_symbol_name != NULL) && (strcmp(node->name, End_symbol_name) == 0)) { +- node = node->next; +- break; +- } +- +- node = node->next; +- } +- +- state.obj.symbol_fifo.curr = node; +-} +- +-/*------------------------------------------------------------------------------------------------*/ +- +-/* Restores the current pointer of list to the beginning. */ +- +-void +-symbol_list_reset(void) +-{ +- gp_list_reset(&state.obj.symbol_fifo); +-} +- +-/*------------------------------------------------------------------------------------------------*/ +- +-/* Freeing the entire list. */ +- +-void +-symbol_list_free(void) +-{ +- gp_list_delete(&state.obj.symbol_fifo); +-} + +Property changes on: gpasm/symbol_list.c +___________________________________________________________________ +Deleted: svn:eol-style +## -1 +0,0 ## +-native +\ No newline at end of property +Deleted: svn:keywords +## -1 +0,0 ## +-Author Date Id Revision +\ No newline at end of property +Index: gpasm/symbol_list.h +=================================================================== +--- gpasm/symbol_list.h (revision 1311) ++++ gpasm/symbol_list.h (nonexistent) +@@ -1,55 +0,0 @@ +-/* Symbol list support. +- +- Copyright (C) 2016 Molnar Karoly +- +-This file is part of gputils. +- +-gputils is free software; you can redistribute it and/or modify +-it under the terms of the GNU General Public License as published by +-the Free Software Foundation; either version 2, or (at your option) +-any later version. +- +-gputils is distributed in the hope that it will be useful, +-but WITHOUT ANY WARRANTY; without even the implied warranty of +-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-GNU General Public License for more details. +- +-You should have received a copy of the GNU General Public License +-along with gputils; see the file COPYING. If not, write to +-the Free Software Foundation, 59 Temple Place - Suite 330, +-Boston, MA 02111-1307, USA. */ +- +-#ifndef __SYMBOL_LIST_H__ +-#define __SYMBOL_LIST_H__ +- +-#include "gpasm.h" +- +-typedef struct symbol_node { +- /* This always should be the first item! (gplist.c) */ +- GPNodeHeader(struct symbol_node); +- +- const symbol_t *symbol; +- char *name; +- unsigned int symbol_number; +- int section_number; +- unsigned int base_class; +- unsigned int byte_address; +-} symbol_node_t; +- +-typedef struct symbol_list { +- /* head of symbol nodes +- * tail of symbol nodes +- * number of symbol nodes */ +- GPListHeader(symbol_node_t); +-} symbol_list_t; +- +-extern void symbol_list_init(void); +- +-extern void symbol_list_add_symbol(const symbol_t *Symbol, const char *Name, unsigned int Symbol_number, +- int Section_number, unsigned int Base_class, unsigned int Byte_address); +- +-extern void symbol_list_flush_symbols(const char *End_symbol_name); +-extern void symbol_list_reset(void); +-extern void symbol_list_free(void); +- +-#endif /* __SYMBOL_LIST_H__ */ + +Property changes on: gpasm/symbol_list.h +___________________________________________________________________ +Deleted: svn:eol-style +## -1 +0,0 ## +-native +\ No newline at end of property +Deleted: svn:keywords +## -1 +0,0 ## +-Author Date Id Revision +\ No newline at end of property +Index: gpasm/Makefile.am +=================================================================== +--- gpasm/Makefile.am (revision 1311) ++++ gpasm/Makefile.am (revision 1312) +@@ -39,8 +39,6 @@ + scan.l \ + special.c \ + special.h \ +- symbol_list.c \ +- symbol_list.h \ + util.c + + gpasm_SOURCES = main.c +Index: gpasm/Makefile.in +=================================================================== +--- gpasm/Makefile.in (revision 1311) ++++ gpasm/Makefile.in (revision 1312) +@@ -113,7 +113,7 @@ + gpasm.$(OBJEXT) gpmsg.$(OBJEXT) lst.$(OBJEXT) macro.$(OBJEXT) \ + parse.$(OBJEXT) ppparse.$(OBJEXT) ppscan.$(OBJEXT) \ + preprocess.$(OBJEXT) processor.$(OBJEXT) scan.$(OBJEXT) \ +- special.$(OBJEXT) symbol_list.$(OBJEXT) util.$(OBJEXT) ++ special.$(OBJEXT) util.$(OBJEXT) + libgpasm_a_OBJECTS = $(am_libgpasm_a_OBJECTS) + am__installdirs = "$(DESTDIR)$(bindir)" + PROGRAMS = $(bin_PROGRAMS) +@@ -347,8 +347,6 @@ + scan.l \ + special.c \ + special.h \ +- symbol_list.c \ +- symbol_list.h \ + util.c + + gpasm_SOURCES = main.c +@@ -480,7 +478,6 @@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/processor.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scan.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/special.Po@am__quote@ +-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symbol_list.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@ + + .c.o: +Index: gpasm/coff.c +=================================================================== +--- gpasm/coff.c (revision 1311) ++++ gpasm/coff.c (revision 1312) +@@ -89,8 +89,6 @@ + state.obj.flags = Flags; + + if (!state.obj.enabled) { +- symbol_list_add_symbol(NULL, Name, state.obj.symbol_num - 2, state.obj.section_num, C_SECTION, +- state.byte_addr); + state.byte_addr = Address; + return; + } +@@ -97,8 +95,6 @@ + + assert(state.obj.object != NULL); + +- symbol_list_flush_symbols(Name); +- + state.obj.section = gp_coffgen_add_section(state.obj.object, Name, Data); + state.obj.section->address = Address; + state.obj.section->shadow_address = Address; +@@ -199,8 +195,6 @@ + /* store data from the last section */ + coff_close_section(); + +- symbol_list_flush_symbols(NULL); +- + /* update relocation symbol pointers */ + _update_reloc_ptr(); + +@@ -248,8 +242,6 @@ + state.obj.flags = Flags; + + if (!state.obj.enabled) { +- symbol_list_add_symbol(NULL, Name, state.obj.symbol_num - 2, state.obj.section_num, C_SECTION, +- state.byte_addr); + state.byte_addr = Address; + return; + } +@@ -256,8 +248,6 @@ + + assert(state.obj.object != NULL); + +- symbol_list_flush_symbols(Name); +- + /* store data from the last section */ + coff_close_section(); + +@@ -446,7 +436,6 @@ + state.obj.symbol_num += 2; + + if (!state.obj.enabled) { +- symbol_list_add_symbol(NULL, ".file", state.obj.symbol_num - 2, 0, C_FILE, state.byte_addr); + return NULL; + } + +@@ -481,12 +470,9 @@ + state.obj.symbol_num++; + + if (!state.obj.enabled) { +- symbol_list_add_symbol(NULL, ".eof", state.obj.symbol_num - 1, 0, C_EOF, state.byte_addr); + return; + } + +- symbol_list_flush_symbols(".eof"); +- + /* add .eof symbol */ + symbol = gp_coffgen_add_symbol(state.obj.object, ".eof", N_DEBUG); + symbol->class = C_EOF; +@@ -508,13 +494,9 @@ + state.obj.symbol_num++; + + if (!state.obj.enabled) { +- symbol_list_add_symbol(NULL, ".list", state.obj.symbol_num - 1, state.obj.section_num, C_LIST, +- state.byte_addr); + return; + } + +- symbol_list_flush_symbols(".list"); +- + /* add .list symbol */ + symbol = gp_coffgen_add_symbol(state.obj.object, ".list", N_DEBUG); + symbol->value = state.src_list.last->line_number; +@@ -537,13 +519,9 @@ + state.obj.symbol_num++; + + if (!state.obj.enabled) { +- symbol_list_add_symbol(NULL, ".nolist", state.obj.symbol_num - 1, state.obj.section_num, C_LIST, +- state.byte_addr); + return; + } + +- symbol_list_flush_symbols(".nolist"); +- + /* add .nolist symbol */ + symbol = gp_coffgen_add_symbol(state.obj.object, ".nolist", N_DEBUG); + symbol->value = state.src_list.last->line_number; +@@ -563,13 +541,9 @@ + state.obj.symbol_num += 2; + + if (!state.obj.enabled) { +- symbol_list_add_symbol(NULL, ".direct", state.obj.symbol_num - 2, state.obj.section_num, C_NULL, +- state.byte_addr); + return; + } + +- symbol_list_flush_symbols(".direct"); +- + /* add .direct symbol */ + symbol = gp_coffgen_add_symbol(state.obj.object, ".direct", state.obj.section_num); + symbol->value = gp_processor_insn_from_byte_c(state.device.class, state.byte_addr); +@@ -593,13 +567,9 @@ + + state.obj.symbol_num += 2; + if (!state.obj.enabled) { +- symbol_list_add_symbol(NULL, ".ident", state.obj.symbol_num - 2, state.obj.section_num, C_NULL, +- state.byte_addr); + return; + } + +- symbol_list_flush_symbols(".ident"); +- + /* add .ident symbol */ + symbol = gp_coffgen_add_symbol(state.obj.object, ".ident", N_DEBUG); + +Index: gpasm/directive.c +=================================================================== +--- gpasm/directive.c (revision 1311) ++++ gpasm/directive.c (revision 1312) +@@ -2210,7 +2210,7 @@ + org = gp_processor_insn_from_byte_p(state.processor, begin_byte_addr); + + if ((gp_processor_is_config_org(state.processor, org) < 0) && +- (gp_processor_is_idlocs_org(state.processor, org) < 0) && ++ (gp_processor_is_idlocs_org(state.processor, org) < 0) && + (gp_processor_is_eeprom_org(state.processor, org) < 0)) { + if ((state.mode == MODE_ABSOLUTE) || !(SECTION_FLAGS & (STYP_DATA | STYP_BPACK))) { + if ((state.byte_addr - begin_byte_addr) & 1) { +@@ -2488,7 +2488,6 @@ + + if ((state.pass == 2) && (new_class || new_type)) { + /* Up to this point creates each symbol. */ +- symbol_list_flush_symbols(symbol_name); + coff_symbol = gp_coffgen_find_symbol(state.obj.object, symbol_name); + assert(coff_symbol != NULL); + +@@ -2579,8 +2578,6 @@ + + if (eval_enforce_simple(p)) { + symbol_name = PnSymbol(p); +- /* Up to this point creates each symbol. */ +- symbol_list_flush_symbols(symbol_name); + /* lookup the symbol */ + coff_symbol = gp_coffgen_find_symbol(state.obj.object, symbol_name); + +@@ -4746,8 +4743,6 @@ + + if (eval_enforce_simple(p)) { + symbol_name = PnSymbol(p); +- /* Up to this point creates each symbol. */ +- symbol_list_flush_symbols(symbol_name); + coff_symbol = gp_coffgen_find_symbol(state.obj.object, symbol_name); + + if (coff_symbol == NULL) { +Index: gpasm/gpasm.c +=================================================================== +--- gpasm/gpasm.c (revision 1311) ++++ gpasm/gpasm.c (revision 1312) +@@ -963,7 +963,6 @@ + state.cmd_line.processor = true; + } + +- symbol_list_init(); + _set_global_constants(); + + state.pass = 1; +@@ -1013,7 +1012,6 @@ + state.cmd_line.processor = true; + } + +- symbol_list_reset(); + _set_global_constants(); + + open_src(state.src_file_name, false); +@@ -1064,7 +1062,6 @@ + + file_free(); + gp_bitarray_delete(&state.badrom); +- symbol_list_free(); + gpmsg_close(); + return (((state.num.errors > 0) || (gp_num_errors > 0)) ? EXIT_FAILURE : EXIT_SUCCESS); + } +Index: gpasm/gpasm.h.in +=================================================================== +--- gpasm/gpasm.h.in (revision 1311) ++++ gpasm/gpasm.h.in (revision 1312) +@@ -22,8 +22,6 @@ + #ifndef __GPASM_H__ + #define __GPASM_H__ + +-#include "symbol_list.h" +- + #define GPASM_VERSION_STRING ("gpasm-" VERSION " #" @REVISION@ " (" __DATE__ ")") + + /* This symbol will get placed into the symbol table for the 16bit cores +@@ -363,7 +361,6 @@ + gp_symbol_t *debug_file; /* Debug information for high level langs. */ + unsigned int debug_line; + gp_boolean newcoff; +- symbol_list_t symbol_fifo; + } obj; + + source_context_list_t src_list; /* The stack of source files. */ +Index: gpasm/util.c +=================================================================== +--- gpasm/util.c (revision 1311) ++++ gpasm/util.c (revision 1312) +@@ -28,7 +28,6 @@ + #include "gpmsg.h" + #include "directive.h" + #include "coff.h" +-#include "symbol_list.h" + + #define STR_INHX8M "inhx8m" + #define STR_INHX8S "inhx8s" +@@ -670,11 +669,12 @@ + set_global(const char *Name, gpasmVal Value, enum gpasmValTypes Type, gp_boolean Proc_dependent, + gp_boolean Has_no_value) + { +- symbol_t *sym; +- variable_t *var; +- unsigned int flags; +- int section_number; +- unsigned int class; ++ symbol_t* sym; ++ variable_t* var; ++ unsigned int flags; ++ int section_number; ++ unsigned int class; ++ char* coff_name; + + /* Search the entire stack (i.e. include macro's local symbol tables) for the symbol. + If not found, then add it to the global symbol table. */ +@@ -702,8 +702,6 @@ + gp_sym_annotate_symbol(sym, var); + + if (set_symbol_attr(§ion_number, &class, Type)) { +- /* Gives to the list the properties of this prospective symbol. */ +- symbol_list_add_symbol(sym, Name, state.obj.symbol_num, section_number, class, state.byte_addr); + /* Increment the index into the coff symbol table for the relocations. */ + state.obj.symbol_num++; + } +@@ -730,6 +728,13 @@ + else if (var->value != Value) { + gpmsg_verror(GPE_DIFFLAB, NULL, Name); + } ++ ++ coff_name = coff_local_name(Name); ++ coff_add_sym(coff_name, Value, var->type, state.obj.section_num); ++ ++ if (coff_name != NULL) { ++ free(coff_name); ++ } + } + } + diff --git a/gpasm_1.5.2.patch b/gpasm_1.5.2.patch deleted file mode 100644 index 1963b5e..0000000 --- a/gpasm_1.5.2.patch +++ /dev/null @@ -1,24 +0,0 @@ -Index: gpasm/directive.c -=================================================================== ---- gpasm/directive.c (revision 1330) -+++ gpasm/directive.c (working copy) -@@ -128,6 +128,19 @@ - --Max_size; - break; - -+ // special characters -+ case '0': //(NULL) -+ case 'a': //(bell) -+ case 'b': //(backspace) -+ case 't': //(tab) -+ case 'n': //(newline) -+ case 'v': //(vertical tab) -+ case 'f': //(form feed) -+ case 'r': //(return) -+ *d++ = '\\'; -+ *d++ = ch; -+ break; -+ - default: { - *d++ = ch; - --Max_size; diff --git a/gplink_1.5.0.patch b/gplink_1.5.0.patch new file mode 100644 index 0000000..06d36bd --- /dev/null +++ b/gplink_1.5.0.patch @@ -0,0 +1,13 @@ +Index: libgputils/gpcod.c +=================================================================== +--- libgputils/gpcod.c (revision 1312) ++++ libgputils/gpcod.c (working copy) +@@ -206,7 +206,7 @@ + + for (i = mem_base; (i - mem_base) <= I_MEM_MAX; i += 2) { + if (((i - mem_base) < I_MEM_MAX) && +- (Class->i_memory_get(Mem, i, &insn, NULL, NULL) == W_USED_ALL)) { ++ (Class->i_memory_get(Mem, i, &insn, NULL, NULL))) { + gp_cod_emit_opcode(dbi, i, insn); + + if (!used_flag) { diff --git a/gputils.spec b/gputils.spec index 3f2dd19..70501e2 100644 --- a/gputils.spec +++ b/gputils.spec @@ -1,18 +1,18 @@ Name: gputils -Version: 1.5.2 -Release: 11%{?dist} +Version: 1.5.0 +Release: 9%{?dist} Summary: Development utilities for Microchip (TM) PIC (TM) microcontrollers Summary(fr): Outils de développement pour les microcontrôleurs PIC (TM) de Microchip (TM) -# Automatically converted from old format: GPLv2+ - review is highly recommended. -License: GPL-2.0-or-later +License: GPLv2+ URL: http://gputils.sourceforge.net -Source: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2 -Patch1: gpasm_%{version}.patch -Patch2: libgputils-%{version}.patch +Source: http://downloads.sourceforge.net/%{name}/%{name}-%{version}-1.tar.bz2 +Patch1: gplink_%{version}.patch +Patch2: gpasm_%{version}.patch +Patch3: link_%{version}.patch Provides: bundled(libiberty) -BuildRequires: gcc +BuildRequires: gcc BuildRequires: autoconf flex bison BuildRequires: make @@ -36,8 +36,9 @@ This package containes gputils documentation and HTML documentation for supporte %prep %setup -q -%patch -P 1 -p0 -%patch -P 2 -p1 +%patch1 -p0 +%patch2 -p0 +%patch3 -p1 %build autoconf -f -i @@ -65,45 +66,6 @@ cp -f doc/%{name}.p* %{buildroot}/usr/share/doc/%{name}-doc/ %changelog -* Thu Jul 16 2026 Fedora Release Engineering - 1.5.2-11 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild - -* Fri Jan 16 2026 Fedora Release Engineering - 1.5.2-10 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild - -* Thu Jul 24 2025 Fedora Release Engineering - 1.5.2-9 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild - -* Mon Jan 27 2025 Roy Rankin 1.5.2-8 -- patch to build with gcc C23 - -* Fri Jan 17 2025 Fedora Release Engineering - 1.5.2-7 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild - -* Fri Jul 26 2024 Miroslav Suchý - 1.5.2-6 -- convert license to SPDX - -* Thu Jul 18 2024 Fedora Release Engineering - 1.5.2-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild - -* Wed Jan 24 2024 Fedora Release Engineering - 1.5.2-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Sat Jan 20 2024 Fedora Release Engineering - 1.5.2-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Thu Jul 20 2023 Fedora Release Engineering - 1.5.2-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild - -* Thu Jan 19 2023 Fedora Release Engineering - 1.5.2-1 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild - -* Sun Jan 01 2023 Roy Rankin 1.5.2-0 -- Upstream release - -* Thu Jul 21 2022 Fedora Release Engineering - 1.5.0-10 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild - * Thu Jan 20 2022 Fedora Release Engineering - 1.5.0-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild diff --git a/libgputils-1.5.2.patch b/libgputils-1.5.2.patch deleted file mode 100644 index affea32..0000000 --- a/libgputils-1.5.2.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff --git a/libgputils/gpcoffgen.h b/libgputils/gpcoffgen.h -index 41d3f89..8ee08b9 100644 ---- a/libgputils/gpcoffgen.h -+++ b/libgputils/gpcoffgen.h -@@ -88,7 +88,7 @@ extern gp_reloc_t *gp_coffgen_add_reloc(gp_section_t *Section); - #define RELOC_DISABLE_WARN (1 << 0) - #define RELOC_ENABLE_CINIT_WARN (1 << 1) - --extern void gp_coffgen_check_relocations(const gp_object_t *Object, unsigned int Behavior); -+extern void gp_coffgen_check_relocations(const gp_object_t *Object, gp_boolean Behavior); - - extern gp_boolean gp_coffgen_del_reloc(gp_section_t *Section, gp_reloc_t *Relocation); - extern const char *gp_coffgen_reloc_type_to_str(uint16_t Type); -diff --git a/libgputils/gptypes.h b/libgputils/gptypes.h -index 95eb609..8356d8f 100644 ---- a/libgputils/gptypes.h -+++ b/libgputils/gptypes.h -@@ -26,10 +26,14 @@ Boston, MA 02111-1307, USA. */ - - #include "stdhdr.h" - --typedef enum { -- false = (0 == 1), -- true = (0 == 0) --} gp_boolean; -+#if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L -+// ISO C standard >= C23 -+#define gp_boolean bool -+#else -+#define gp_boolean _Bool -+#define true 1 -+#define false 0 -+#endif - - typedef long gp_symvalue_t; - diff --git a/link_1.5.0.patch b/link_1.5.0.patch new file mode 100644 index 0000000..53dae32 --- /dev/null +++ b/link_1.5.0.patch @@ -0,0 +1,307 @@ +diff --git a/gputils/gpstrip.c b/gputils/gpstrip.c +index dce5ddb..06b7d97 100644 +--- a/gputils/gpstrip.c ++++ b/gputils/gpstrip.c +@@ -92,7 +92,7 @@ _conditional_remove(gp_symbol_t *Symbol) + gp_message("removing symbol \"%s\"", Symbol->name); + } + +- gp_coffgen_del_symbol(state.object, Symbol); ++ gp_coffgen_del_symbol(state.object, Symbol, true); + } + } + +diff --git a/libgputils/gpcoffgen.c b/libgputils/gpcoffgen.c +index 8ebcf15..dc60348 100644 +--- a/libgputils/gpcoffgen.c ++++ b/libgputils/gpcoffgen.c +@@ -346,7 +346,7 @@ gp_coffgen_del_section_symbols(gp_object_t *Object, gp_section_t *Section) + list = list->next; + + if (symbol->section == Section) { +- gp_coffgen_del_symbol(Object, symbol); ++ gp_coffgen_del_symbol(Object, symbol, true); + } + } + } +@@ -732,8 +732,10 @@ gp_coffgen_move_reserve_symbol(gp_object_t *Object, gp_symbol_t *Symbol) + /* Delete the symbol from the object. */ + + gp_boolean +-gp_coffgen_del_symbol(gp_object_t *Object, gp_symbol_t *Symbol) ++gp_coffgen_del_symbol(gp_object_t *Object, gp_symbol_t *Symbol, gp_boolean Touch_number) + { ++ unsigned int n_deleted; ++ + if (Object->symbol_list.first == NULL) { + return false; + } +@@ -745,7 +747,13 @@ gp_coffgen_del_symbol(gp_object_t *Object, gp_symbol_t *Symbol) + } + + gp_list_node_remove(&Object->symbol_list, Symbol); +- Object->num_symbols -= 1 + gp_coffgen_free_symbol(Symbol); ++ ++ n_deleted = 1 + gp_coffgen_free_symbol(Symbol); ++ ++ if (Touch_number) { ++ Object->num_symbols -= n_deleted; ++ } ++ + return true; + } + +@@ -999,7 +1007,7 @@ _check_section_relocations(proc_class_t Class, gp_section_t *Section, unsigned i + if (sym_sect == NULL) { + /* This is an orphan symbol. */ + if (FlagIsClr(Behavior, RELOC_DISABLE_WARN)) { +- if (FlagIsSet(Behavior, RELOC_ENABLE_CINIT_WARN) || (strcmp(symbol->name, "_cinit") != 0)) { ++ if (FlagIsSet(Behavior, RELOC_ENABLE_CINIT_WARN) && (strcmp(symbol->name, "_cinit") != 0)) { + gp_warning("Relocation symbol \"%s\" [0x%0*X] has no section. (pass %u)", + symbol->name, Class->addr_digits, relocation->address, Pass); + } +diff --git a/libgputils/gpcoffgen.h b/libgputils/gpcoffgen.h +index ffb5b5c..41d3f89 100644 +--- a/libgputils/gpcoffgen.h ++++ b/libgputils/gpcoffgen.h +@@ -73,7 +73,7 @@ extern gp_symbol_t *gp_coffgen_add_symbol(gp_object_t *Object, const char *Name, + extern gp_aux_t *gp_coffgen_add_aux(gp_object_t *Object, gp_symbol_t *Symbol); + extern gp_aux_t *gp_coffgen_make_block_aux(gp_symbol_t *Symbol, unsigned int Num_auxsyms); + extern gp_symbol_t *gp_coffgen_move_reserve_symbol(gp_object_t *Object, gp_symbol_t *Symbol); +-extern gp_boolean gp_coffgen_del_symbol(gp_object_t *Object, gp_symbol_t *Symbol); ++extern gp_boolean gp_coffgen_del_symbol(gp_object_t *Object, gp_symbol_t *Symbol, gp_boolean Touch_number); + extern gp_symbol_t **gp_coffgen_make_symbol_array(const gp_object_t *Object, int (*Cmp)(const void *, const void *)); + extern const char *gp_coffgen_symbol_type_to_str(uint8_t Type); + extern const char *gp_coffgen_symbol_derived_type_to_str(uint32_t Type); +diff --git a/libgputils/gpcofflink.c b/libgputils/gpcofflink.c +index 7511c36..1283e63 100644 +--- a/libgputils/gpcofflink.c ++++ b/libgputils/gpcofflink.c +@@ -174,9 +174,12 @@ gp_cofflink_clean_table(gp_object_t *Object, symbol_table_t *Symbols) + const gp_coffsymbol_t *var; + const symbol_t *sym; + gp_symbol_t *next; ++ int num_clean_errors; + + gp_debug("Cleaning symbol table."); + ++ num_clean_errors = gp_real_num_errors(); ++ + /* point all relocations to the symbol definitions */ + section = Object->section_list.first; + while (section != NULL) { +@@ -186,13 +189,17 @@ gp_cofflink_clean_table(gp_object_t *Object, symbol_table_t *Symbols) + + if (gp_coffgen_is_external_symbol(symbol)) { + /* This is an external symbol defined elsewhere. */ +- sym = gp_sym_get_symbol(Symbols, symbol->name); +- assert(sym != NULL); +- var = (const gp_coffsymbol_t *)gp_sym_get_symbol_annotation(sym); +- assert(var != NULL); +- symbol = var->symbol; +- assert(symbol != NULL); +- relocation->symbol = symbol; ++ sym = gp_sym_get_symbol(Symbols, symbol->name); ++ if (sym == NULL) { ++ gp_error("Non-existent external symbol - \"%s\" - used in \"%s\" section.", symbol->name, section->name); ++ } ++ else { ++ var = (const gp_coffsymbol_t *)gp_sym_get_symbol_annotation(sym); ++ assert(!(var == NULL)); ++ symbol = var->symbol; ++ assert(!(symbol == NULL)); ++ relocation->symbol = symbol; ++ } + } + + relocation = relocation->next; +@@ -201,13 +208,17 @@ gp_cofflink_clean_table(gp_object_t *Object, symbol_table_t *Symbols) + section = section->next; + } + ++ if (gp_real_num_errors() > num_clean_errors) { ++ exit(1); ++ } ++ + symbol = Object->symbol_list.first; + while (symbol != NULL) { + next = symbol->next; + + if (gp_coffgen_is_external_symbol(symbol)) { + gp_debug(" removed symbol \"%s\"", symbol->name); +- gp_coffgen_del_symbol(Object, symbol); ++ gp_coffgen_del_symbol(Object, symbol, true); + } + + symbol = next; +@@ -265,7 +276,7 @@ gp_cofflink_combine_overlay(gp_object_t *Object, gp_boolean Remove_symbol) + + /* Remove the section symbol. */ + if (Remove_symbol) { +- gp_coffgen_del_symbol(Object, second->symbol); ++ gp_coffgen_del_symbol(Object, second->symbol, true); + } + + /* Update the symbol table */ +@@ -1570,6 +1581,7 @@ _patch_addr(gp_object_t *Object, gp_section_t *Section, const gp_reloc_t *Reloca + int bank; + int page; + gp_boolean write_data; ++ const insn_t *instruction; + + class = Object->class; + num_pages = gp_processor_num_pages(Object->processor); +@@ -1602,9 +1614,23 @@ _patch_addr(gp_object_t *Object, gp_section_t *Section, const gp_reloc_t *Reloca + data = class->reloc_goto(value); + break; + +- case RELOC_LOW: +- data = value & 0xff; ++ case RELOC_LOW: { ++ instruction = class->find_insn(class, current_value); ++ ++ if (instruction == NULL) { ++ gp_error("No instruction for %#x at %#x(%s/%s)", current_value, ++ byte_addr, Section->name, symbol->name); ++ return; ++ } ++ ++ if (instruction->class == INSN_CLASS_LIT8) { ++ data = value & 0xff; ++ } ++ else { ++ data = class->reloc_f(value); ++ } + break; ++ } + + case RELOC_HIGH: + data = class->reloc_high(FlagIsSet(symbol->section->flags, STYP_ROM_AREA), value); +diff --git a/libgputils/gpmessage.c b/libgputils/gpmessage.c +index 0a640eb..1573193 100644 +--- a/libgputils/gpmessage.c ++++ b/libgputils/gpmessage.c +@@ -34,14 +34,20 @@ int gp_num_errors = 0; + int gp_num_warnings = 0; + int gp_num_messages = 0; + ++static int _real_num_errors = 0; ++static int _real_num_warnings = 0; ++static int _real_num_messages = 0; ++ + /*------------------------------------------------------------------------------------------------*/ + + void +-gp_error(const char *Format, ...) ++gp_error(const char* Format, ...) + { + va_list args; + char buffer[BUFSIZ]; + ++ _real_num_errors++; ++ + if (gp_message_disable) { + return; + } +@@ -62,11 +68,13 @@ gp_error(const char *Format, ...) + /*------------------------------------------------------------------------------------------------*/ + + void +-gp_warning(const char *Format, ...) ++gp_warning(const char* Format, ...) + { + va_list args; + char buffer[BUFSIZ]; + ++ _real_num_warnings++; ++ + if (gp_message_disable) { + return; + } +@@ -87,11 +95,13 @@ gp_warning(const char *Format, ...) + /*------------------------------------------------------------------------------------------------*/ + + void +-gp_message(const char *Format, ...) ++gp_message(const char* Format, ...) + { + va_list args; + char buffer[BUFSIZ]; + ++ _real_num_messages++; ++ + if (gp_message_disable) { + return; + } +@@ -112,7 +122,7 @@ gp_message(const char *Format, ...) + /*------------------------------------------------------------------------------------------------*/ + + void +-gp_debug(const char *Format, ...) ++gp_debug(const char* Format, ...) + { + va_list args; + char buffer[BUFSIZ]; +@@ -131,3 +141,27 @@ gp_debug(const char *Format, ...) + + printf("debug: %s\n", buffer); + } ++ ++/*------------------------------------------------------------------------------------------------*/ ++ ++int ++gp_real_num_errors(void) ++{ ++ return _real_num_errors; ++} ++ ++/*------------------------------------------------------------------------------------------------*/ ++ ++int ++gp_real_num_warnings(void) ++{ ++ return _real_num_warnings; ++} ++ ++/*------------------------------------------------------------------------------------------------*/ ++ ++int ++gp_real_num_messages(void) ++{ ++ return _real_num_messages; ++} +diff --git a/libgputils/gpmessage.h b/libgputils/gpmessage.h +index d2f6ffa..2329f4c 100644 +--- a/libgputils/gpmessage.h ++++ b/libgputils/gpmessage.h +@@ -30,9 +30,13 @@ extern int gp_num_errors; + extern int gp_num_warnings; + extern int gp_num_messages; + +-extern void gp_error(const char *Format, ...); +-extern void gp_warning(const char *Format, ...); +-extern void gp_message(const char *Format, ...); +-extern void gp_debug(const char *Format, ...); ++extern void gp_error(const char* Format, ...); ++extern void gp_warning(const char* Format, ...); ++extern void gp_message(const char* Format, ...); ++extern void gp_debug(const char* Format, ...); ++ ++extern int gp_real_num_errors(void); ++extern int gp_real_num_warnings(void); ++extern int gp_real_num_messages(void); + + #endif +diff --git a/libgputils/gpreadobj.c b/libgputils/gpreadobj.c +index f1cc22d..57de3f0 100644 +--- a/libgputils/gpreadobj.c ++++ b/libgputils/gpreadobj.c +@@ -648,7 +648,7 @@ _clean_symbol_table(gp_object_t *Object) + for (i = 0; i < curr_symbol->aux_list.num_nodes; ++i) { + aux_symbol = next_symbol; + next_symbol = next_symbol->next; +- gp_coffgen_del_symbol(Object, aux_symbol); ++ gp_coffgen_del_symbol(Object, aux_symbol, false); + } + } + curr_symbol = curr_symbol->next; diff --git a/sources b/sources index dd898ca..2dadcbb 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (gputils-1.5.2.tar.bz2) = 43ed508d164152bf36e4f27b09656e6e3d58fc174806ad57d6415e6e2726a56381b1323be3acfc635f2a05babade695e9777b0db8b5f4b90da00b9d29e75eddc +SHA512 (gputils-1.5.0-1.tar.bz2) = 18cbc2c5d52a67f40ac99a7966ecff07cf0eb114aa919c76dedffc311e4dfa23f72b7ab842416f54be156891db8d80e616c4591ceb27280a5a833364ffd49a41