From adb474090420c6520f6d039e36871d573e281607 Mon Sep 17 00:00:00 2001 From: Roy Rankin Date: Jul 20 2018 05:09:27 +0000 Subject: add patches --- 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/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 da2daec..4d735b9 100644 --- a/gputils.spec +++ b/gputils.spec @@ -1,6 +1,6 @@ Name: gputils Version: 1.5.0 -Release: 0%{?dist} +Release: 1%{?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) @@ -8,6 +8,8 @@ Group: Development/Languages License: GPLv2+ URL: http://gputils.sourceforge.net Source: http://downloads.sourceforge.net/%{name}/%{name}-%{version}-1.tar.bz2 +Patch1: gplink_%{version}.patch +Patch2: gpasm_%{version}.patch Provides: bundled(libiberty) BuildRequires: gcc @@ -33,6 +35,8 @@ This package containes gputils documentation and HTML documentation for supporte %prep %setup -q +%patch1 -p0 +%patch2 -p0 %build autoconf -f -i @@ -60,6 +64,9 @@ cp -f doc/%{name}.p* %{buildroot}/usr/share/doc/%{name}-doc/ %changelog +* Fri Jul 20 2018 Roy Rankin 1.5.0-1 +- Add patches to fix bugs found by gpsim + * Mon Jul 16 2018 Roy Rankin 1.5.0-0 - Upstream release, Add debug flag to configure