Changeset 1247


Ignore:
Timestamp:
Feb 15, 2004, 10:49:46 AM (21 years ago)
Author:
bird
Message:

#905: Implemented ABS symbols. Corrected fixups making fixups to weak symbols work. Fixed case where base_dir is missing a slash.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/src/emxomf/emxomf.c

    • Property cvs2svn:cvs-rev changed from 1.35 to 1.36
    r1246 r1247  
    730730      struct weaksym *next = cur->next;
    731731      free (cur->name);
     732      free (cur);
    732733      free (cur->module);
    733       free (cur);
    734734      cur = next;
    735735    }
     
    14061406                    put_idx (flat_index);
    14071407                    put_idx (index);
     1408                    if (!index)
     1409                        put_16 (0);
    14081410                    started = TRUE;
    14091411                  }
     
    14671469static void write_pubdef (void)
    14681470{
     1471  write_pubdef1 (N_ABS,  0,          FALSE, 0);
     1472  write_pubdef1 (N_ABS,  0,          TRUE, 0);
    14691473  write_pubdef1 (N_TEXT, text_index, FALSE, 0);
    14701474  write_pubdef1 (N_TEXT, text_index, TRUE,  0);
     
    14751479  if (!weak_list_filename)
    14761480  {
     1481      write_pubdef1 (N_WEAKA, 0,          FALSE, 0);
     1482      write_pubdef1 (N_WEAKA, 0,          TRUE, 0);
    14771483      write_pubdef1 (N_WEAKT, text_index, FALSE, 0);
    14781484      write_pubdef1 (N_WEAKT, text_index, TRUE,  0);
     
    17441750               symbol table to find the fixup type and target
    17451751               address. */
    1746 
    1747             switch (sym_ptr[r->r_symbolnum].n_type)
     1752            const struct nlist *sym = &sym_ptr[r->r_symbolnum];
     1753/*#ifdef DEBUG
     1754            const char *psz = sym->n_un.n_strx + str_ptr;
     1755#endif*/
     1756            switch (sym->n_type)
    17481757              {
     1758              case N_TEXT:
     1759              case N_WEAKD:
     1760              case N_WEAKB:
     1761              case N_WEAKA:
     1762                break;
     1763
    17491764              case N_EXT:
    17501765              case N_WEAKU:
    1751                 if (r->r_pcrel)
    1752                   *(dword *)(src + r->r_address) = 0;
    1753                 break;
    1754               case N_TEXT:
    1755                 break;
    17561766              case N_TEXT|N_EXT:
    17571767              case N_WEAKT:
    1758                 *(dword *)(src + r->r_address) = 0;
     1768                if (r->r_pcrel)
     1769                  { /* example: r_address = 0xc, dw=0xfffffff6. disp=6 */
     1770                    dword dw = *(dword *)(src + r->r_address);
     1771                    dw += r->r_address + 4;
     1772                    *(dword *)(src + r->r_address) = dw;
     1773                  }
    17591774                break;
    17601775              case N_DATA:
    17611776              case N_DATA|N_EXT:
    1762               case N_WEAKD:
    17631777                *(dword *)(src + r->r_address) -= start_data;
    17641778                break;
    17651779              case N_BSS:
    17661780              case N_BSS|N_EXT:
    1767               case N_WEAKB:
    17681781                *(dword *)(src + r->r_address) -= start_bss;
    17691782                break;
     1783
    17701784              default:
    17711785                error ("write_seg: Invalid symbol type (0x%.2x)",
     
    28572871  /* make sure we have base_dir and that it's an abspath */
    28582872  if (!base_dir[0])
     2873    {
    28592874      getcwd(base_dir, sizeof(base_dir));
     2875      len = strlen(base_dir);
     2876      base_dir[len++] = '\\';
     2877      base_dir[len] = '\0';
     2878    }
    28602879  else if (   (base_dir[0] == '\\' ||  base_dir[0] == '/')
    28612880           &&  base_dir[1] != '\\' &&  base_dir[1] != '/') /* unc */
Note: See TracChangeset for help on using the changeset viewer.