home *** CD-ROM | disk | FTP | other *** search
- From: loic@adesign.uucp (Loic Dachary)
- Newsgroups: alt.sources
- Subject: gas-1.36 patches for COFF generation patch01
- Message-ID: <LOIC.90Oct23011902@adesign.uucp>
- Date: 23 Oct 90 00:19:02 GMT
-
-
- Here is the first bug fix to gas-coff patches (gas-coff/patch01).
-
- . Special conditions where not tested when manipulating the double linked list
- of symbols. This was not very clean but harmless. However the code has
- been changed.
- . The c_dot_file_symbol function messed up the symbol list if called by
- write_object instead of s_file. I.e. if .file was missing, gas bombed.
-
- *** coff.c Mon Oct 15 08:53:16 1990
- --- /spare/usenet/port/gas-1.36/coff.c Tue Oct 23 00:06:12 1990
- ***************
- *** 242,250 ****
- char* filename;
- {
- symbolS* symbolP;
- - symbolS* ante_lastP;
- -
- - ante_lastP = symbol_lastP;
-
- symbolP = symbol_new(".file", SEG_DEBUG, 0,
- C_FILE, &zero_address_frag);
- --- 242,247 ----
- ***************
- *** 254,262 ****
-
- /* Make sure that the symbol is first on the symbol chain */
- if(symbol_rootP != symbolP) {
- ! symbol_lastP = ante_lastP;
- ! symbol_lastP->sy_next = NULL;
- ! symbolP->sy_next = symbol_rootP;
- symbol_rootP = symbolP;
- }
- }
- --- 251,259 ----
-
- /* Make sure that the symbol is first on the symbol chain */
- if(symbol_rootP != symbolP) {
- ! symbol_lastP = symbol_lastP->sy_previous;
- ! DL_REMOVE(symbolP);
- ! DL_INSERT(symbolP, symbol_rootP);
- symbol_rootP = symbolP;
- }
- }
- *** coff.h Mon Oct 15 09:59:28 1990
- --- /spare/usenet/port/gas-1.36/coff.h Mon Oct 22 17:29:56 1990
- ***************
- *** 57,62 ****
- --- 57,88 ----
- #define DO_NOT_STRIP 0
- #define DO_STRIP 1
-
- + /* Double linked list manipulations macros. */
- + /* See struc-symbol.h for a definition of symbolS. */
- +
- + /* Remove the argument from the list. */
- + #define DL_REMOVE(p) \
- + (((p)->sy_next && ((p)->sy_next->sy_previous = (p)->sy_previous)),\
- + ((p)->sy_previous && ((p)->sy_previous->sy_next = (p)->sy_next)))
- +
- + /* Set the chain symbols to null. */
- + #define DL_CLEAR(p) \
- + ((p)->sy_next = (symbolS*)0, (p)->sy_previous = (symbolS*)0)
- +
- + /* Link symbol p after symbol w in the chain. */
- + #define DL_APPEND(p,w) \
- + (((w)->sy_next && ((w)->sy_next->sy_previous = (p))), \
- + ((p)->sy_next = (w)->sy_next), \
- + ((w)->sy_next = (p)), \
- + ((p)->sy_previous = (w)))
- +
- + /* Link symbol p before symbol w in the chain. */
- + #define DL_INSERT(p,w) \
- + (((w)->sy_previous && ((w)->sy_previous->sy_next = (p))), \
- + ((p)->sy_previous = (w)->sy_previous), \
- + ((w)->sy_previous = (p)), \
- + ((p)->sy_next = (w)))
- +
- /* Symbol table macros and constants */
-
- /* Possible and usefull section number in symbol table
- *** read.c Mon Oct 22 22:35:07 1990
- --- /spare/usenet/port/gas-1.36/read.c Mon Oct 22 22:39:11 1990
- ***************
- *** 1395,1402 ****
- symbolP = (symbolS *)obstack_alloc(¬es, sizeof(symbolS));
- memcpy((char*)symbolP, &symbol, sizeof(symbolS));
-
- ! symbol_lastP->sy_next = symbolP;
- ! symbolP->sy_previous = symbol_lastP;
- symbol_lastP = symbolP;
-
- } else {
- --- 1395,1401 ----
- symbolP = (symbolS *)obstack_alloc(¬es, sizeof(symbolS));
- memcpy((char*)symbolP, &symbol, sizeof(symbolS));
-
- ! DL_APPEND(symbolP, symbol_lastP);
- symbol_lastP = symbolP;
-
- } else {
- ***************
- *** 1408,1424 ****
- c_symbol_merge(&symbol, symbolP);
- /* For the function, the symbol *must* be were the debug symbol
- appear. Move the existing symbol to the current place. */
- - /* Do not take in account special cases where symbolP is first
- - in the list. It is always after a .bf */
- if(SF_GET_FUNCTION(symbolP)) {
- /* If it already is at the end of the symbol list, do nothing */
- if(symbolP != symbol_lastP) {
- ! /* Remove from the list */
- ! symbolP->sy_next->sy_previous = symbolP->sy_previous;
- ! symbolP->sy_previous->sy_next = symbolP->sy_next;
- ! /* Append at the end of the list */
- ! symbol_lastP->sy_next = symbolP;
- ! symbolP->sy_previous = symbol_lastP;
- symbol_lastP = symbolP;
- }
- } else
- --- 1407,1417 ----
- c_symbol_merge(&symbol, symbolP);
- /* For the function, the symbol *must* be were the debug symbol
- appear. Move the existing symbol to the current place. */
- if(SF_GET_FUNCTION(symbolP)) {
- /* If it already is at the end of the symbol list, do nothing */
- if(symbolP != symbol_lastP) {
- ! DL_REMOVE(symbolP);
- ! DL_APPEND(symbolP, symbol_lastP);
- symbol_lastP = symbolP;
- }
- } else
- *** symbols.c Mon Oct 22 22:35:10 1990
- --- /spare/usenet/port/gas-1.36/symbols.c Mon Oct 22 22:38:42 1990
- ***************
- *** 220,227 ****
- * Link to end of symbol chain .
- */
- if (symbol_lastP) {
- ! symbol_lastP->sy_next = symbolP;
- ! symbolP->sy_previous = symbol_lastP;
- } else {
- symbol_rootP = symbolP;
- }
- --- 220,226 ----
- * Link to end of symbol chain .
- */
- if (symbol_lastP) {
- ! DL_APPEND(symbolP, symbol_lastP);
- } else {
- symbol_rootP = symbolP;
- }
- *** write.c Mon Oct 22 22:35:15 1990
- --- /spare/usenet/port/gas-1.36/write.c Mon Oct 22 22:38:18 1990
- ***************
- *** 405,416 ****
- /* The symbols will never be the last or the first
- because : 1st symbol is .file and 3 last symbols are
- .text, .data, .bss */
- ! real_symbolP->sy_previous->sy_next = real_symbolP->sy_next;
- ! real_symbolP->sy_next->sy_previous = real_symbolP->sy_previous;
- ! symbolP->sy_previous->sy_next = real_symbolP;
- ! symbolP->sy_next->sy_previous = real_symbolP;
- ! real_symbolP->sy_next = symbolP->sy_next;
- ! real_symbolP->sy_previous = symbolP->sy_previous;
- symbolP = real_symbolP;
- }
- if(flagseen['R'] && S_IS_DATA(symbolP))
- --- 405,413 ----
- /* The symbols will never be the last or the first
- because : 1st symbol is .file and 3 last symbols are
- .text, .data, .bss */
- ! DL_REMOVE(real_symbolP);
- ! DL_INSERT(real_symbolP, symbolP);
- ! DL_REMOVE(symbolP);
- symbolP = real_symbolP;
- }
- if(flagseen['R'] && S_IS_DATA(symbolP))
- ***************
- *** 488,510 ****
-
- symbolP = thisP->sy_next;
- /* remove C_EFCN and LOCAL (L...) symbols */
- ! if(SF_GET_LOCAL(thisP)) {
- ! thisP->sy_next->sy_previous = thisP->sy_previous;
- ! thisP->sy_previous->sy_next = thisP->sy_next;
- ! } else {
- if(S_GET_STORAGE_CLASS(thisP) == C_EXT &&
- !SF_GET_FUNCTION(thisP)) {
- /* Remove from the list */
- ! thisP->sy_next->sy_previous = thisP->sy_previous;
- ! thisP->sy_previous->sy_next = thisP->sy_next;
- /* Move at the end of the list */
- ! if (symbol_extern_lastP) {
- ! symbol_extern_lastP->sy_next = thisP;
- ! thisP->sy_previous = symbol_extern_lastP;
- ! } else {
- symbol_externP = thisP;
- ! }
- ! thisP->sy_next = (symbolS*)0;
- symbol_extern_lastP = thisP;
- } else {
- if(SF_GET_STRING(thisP)) {
- --- 485,503 ----
-
- symbolP = thisP->sy_next;
- /* remove C_EFCN and LOCAL (L...) symbols */
- ! if(SF_GET_LOCAL(thisP))
- ! DL_REMOVE(thisP);
- ! else {
- if(S_GET_STORAGE_CLASS(thisP) == C_EXT &&
- !SF_GET_FUNCTION(thisP)) {
- /* Remove from the list */
- ! DL_REMOVE(thisP);
- ! DL_CLEAR(thisP);
- /* Move at the end of the list */
- ! if (symbol_extern_lastP == (symbolS*)0)
- symbol_externP = thisP;
- ! else
- ! DL_APPEND(thisP, symbol_extern_lastP);
- symbol_extern_lastP = thisP;
- } else {
- if(SF_GET_STRING(thisP)) {
- --
- Loic Dachary loic@adesign.uucp or loic@afp.uucp
- Voice +33 1 40 35 20 20
-