[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] DRI/GST symbol table offsets in binaries?

On Thu, May 1, 2014 at 12:07 PM, Eero Tamminen <oak@helsinkinet.fi> wrote:
In VBCC/Vlink generated code, all symbols are relative
to TEXT section start, in everything else I've checked
(e.g. VBCC/Vasm and GCC "-Wl,--traditional-format -g"),
all symbol addresses are relative to their own
(=TEXT/DATA/BSS) section's start.

I assume latter is correct, right?

Is there anywhere documentation on this?

I'm not sure what do you mean by 'VBCC/vlink' generated code but I guess the author has made a mistake by misreading this sentence in the GEMDOS reference: "All relocation information is relative to the beginning load address (start of text)." which applies to Relocation information part of the file, not Symbol table which is defined like this:

The  symbol  table  defines the symbols referenced by a command file.  Each
entry in the symbol table is associated with an index  that  indicates  its
entry  number.    Entries are numbered sequentially starting with zero.  As
shown in Figure 3-3, each symbol table entry is  composed  of  seven  words
that describe the symbol's name, type, and value.

                           0 |                 |
                             +      Symbol     +
                             |                 |
                             +                 +
                             |       Name      |
                             +                 +
                           6 |                 |
                           8 |       Type      |
                           A |                 |
                             +      Value      +
                           C |                 |

                      Figure 3-3.  Symbol Table Entry

Table 3-1 describes the fields of a symbol table entry.

                   Table 3-1.  Symbol Table Entry Fields

   Field     Definition 

   Name      Symbol   name,   null-padded   right  if  less  than  eight

   Type      Symbol type as indicated by the following values:

             0100H:  bss-based relocatable
             0200H:  text-based relocatable
             0400H:  data-based relocatable
             0800H:  external reference
             1000H:  equated register
             2000H:  global
             4000H:  equated
             8000H:  defined

   Value     Symbol value where the value can be  an  address,  register
             number, value of an _expression_, and so forth. Note that the
             linkers interpret the value when  the  symbol  is  external
             (0800H) as the size of a common region.  

As you can see, there's no explicit statement about the base but my guess would be that 'bss-based relocatable' means really relative to the bss segment.

MiKRO / Mystic Bytes