X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=object.c;h=1b33ffc15cc1fd161f2fe579771cce04beda57ec;hb=cbc8347d4ffea164ca05b03e4e3be39945be8777;hp=0b7df7ed8ecc77b1d7bb2eb1ad9ad26b6319821b;hpb=39dff26a3bec02d03f6283657c45f33070ff7d7a;p=rmac diff --git a/object.c b/object.c index 0b7df7e..1b33ffc 100644 --- a/object.c +++ b/object.c @@ -1,7 +1,7 @@ // -// RMAC - Reboot's Macro Assembler for all Atari computers +// RMAC - Renamed Macro Assembler for all Atari computers // OBJECT.C - Writing Object Files -// Copyright (C) 199x Landon Dyer, 2011-2020 Reboot and Friends +// Copyright (C) 199x Landon Dyer, 2011-2021 Reboot and Friends // RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986 // Source utilised with the kind permission of Landon Dyer // @@ -224,7 +224,7 @@ uint8_t * AddELFSymEntry(uint8_t * buf, SYM * sym, int globflag) if (w1 & DEFINED) { if (globflag) // Export the symbol - st_info |= 16; //STB_GLOBAL (1<<4) + st_info |= 16; // STB_GLOBAL (1<<4) } else if (w1 & (GLOBAL | REFERENCED)) st_info |= 16; @@ -232,7 +232,7 @@ uint8_t * AddELFSymEntry(uint8_t * buf, SYM * sym, int globflag) D_byte(st_info); D_byte(0); // st_other - uint16_t st_shndx = 0xFFF1; // Assume absolute (equated) number + uint16_t st_shndx = SHN_ABS; // Assume absolute (equated) number if (w1 & TEXT) st_shndx = elfHdrNum[ES_TEXT]; @@ -240,8 +240,13 @@ uint8_t * AddELFSymEntry(uint8_t * buf, SYM * sym, int globflag) st_shndx = elfHdrNum[ES_DATA]; else if (w1 & BSS) st_shndx = elfHdrNum[ES_BSS]; - else if (globflag) - st_shndx = 0; // Global, not absolute + else if (globflag && !(w1 & DEFINED) && (w1 & REFERENCED)) + { + st_shndx = SHN_UNDEF; + } // If the symbol is global then probably we + // don't need to do anything (probably) + // since we set STB_GLOBAL in st_info above. + // Unless we need to set it to SHN_COMMON? D_word(st_shndx);