Changeset 61


Ignore:
Timestamp:
Apr 29, 2003, 6:26:33 PM (22 years ago)
Author:
bird
Message:
  • emxbind sets heap size to 0 when making a DLL (same as if you would use -h0). This solves a real big problem with all DLLs made from a.out having a very large heap segment (32Mb) and eating up virtual address space.
  • fixed emxbind to use hash tables instead of linear search when exporting DLL symbols. This allows for a huge speedup when building large DLLs from a.out object files.
  • exports by names without ordinals goes into resident names table rather than into non-resident names table. This is the behaviour of LINK386.
  • emxbind now honors properly the NONAME keyword in .def files
  • disabled emxbind warnings about a DLL entry being exported more than once. LINK386 does not emit any warnings about this, so why emxbind should do? Still if you use the -v option, this warning is back.
Location:
trunk/src/emx/src/emxbind
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/src/emxbind/cmd.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r60 r61  
    4747      relocatable = TRUE;
    4848      stack_size = 0;
     49      heap_size = 0;
    4950    }
    5051}
  • trunk/src/emx/src/emxbind/emxbind.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r60 r61  
    172172
    173173      exp.ord = stmt->export.ordinal;
    174       exp.resident = (stmt->export.flags & _MDEP_RESIDENTNAME) ? TRUE : FALSE;
     174      exp.resident = (!exp.ord || (stmt->export.flags & _MDEP_RESIDENTNAME)) ? TRUE : FALSE;
    175175      exp.entryname = xstrdup (stmt->export.entryname);
     176      exp.flags = stmt->export.flags;
    176177      if (stmt->export.internalname[0] != 0)
    177178        exp.internalname = xstrdup (stmt->export.internalname);
     
    325326    error ("file name missing");
    326327  else
    327     {
    328328      strcpy (dst, def);
    329       if (ext != NULL)
    330         _remext (dst);
    331     }
    332   if (ext != NULL)
    333     _defext (dst, ext);
     329  if (ext)
     330  {
     331    char *curext = _getext2 (dst);
     332    if (curext && *curext == '.')
     333      curext++;
     334    if (strcmp (curext, ext))
     335    {
     336      if (strlen (dst) > FNAME_SIZE - 5)
     337        error ("file name too long");
     338      strcat (dst, ".");
     339      strcat (dst, ext);
     340    }
     341    }
    334342}
    335343
     
    433441
    434442  opterr = FALSE;
    435   optswchar = "-";
     443//optswchar = "-";
    436444
    437445  /* No command option has been seen yet. */
  • trunk/src/emx/src/emxbind/emxbind.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r60 r61  
    149149  dword offset;
    150150  int object;
     151  int flags;
    151152};
    152153
     
    529530
    530531void build_sym_hash_table (void);
     532struct nlist *find_symbol (const char *name, int underscore);
    531533void sort_fixup (void);
    532534void create_fixup (const struct fixup *fp, int neg);
  • trunk/src/emx/src/emxbind/exec.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r60 r61  
    167167{
    168168  if (os2_bind_h.text_base != TEXT_BASE
    169       || os2_bind_h.text_end != TEXT_BASE + a_in_h.text_size
     169      || round_page (os2_bind_h.text_end) != TEXT_BASE + round_page (a_in_h.text_size)
    170170      || os2_bind_h.data_base != data_base)
    171171    return FALSE;
  • trunk/src/emx/src/emxbind/export.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r60 r61  
    2323#include <stdlib.h>
    2424#include <string.h>
     25#include <sys/moddef.h>
    2526#include "defs.h"
    2627#include "emxbind.h"
     
    4748      if (stricmp (exp->entryname, export_data[i].entryname) == 0)
    4849        error ("export multiply defined: %s", exp->entryname);
    49       if (strcmp (exp->internalname, export_data[i].internalname) == 0)
     50      if ((verbosity >= 2) &&
     51          (strcmp (exp->internalname, export_data[i].internalname) == 0))
    5052        printf ("emxbind: %s multiply exported (warning)\n",
    5153                exp->internalname);
     
    8486}
    8587
     88#if 0
    8689
    8790/* Find the symbol NAME in the a.out symbol table of the input
     
    123126}
    124127
     128#endif
    125129
    126130/* Compare two entries of an int array for qsort().  This function is
     
    195199          export_data[i].object = OBJ_TEXT;
    196200          break;
     201        case N_BSS:
    197202        case N_DATA:
    198203          export_data[i].offset = nl->value - obj_data.virt_base;
     
    231236    {
    232237      exp = &export_data[i];
     238      if (!(exp->flags & _MDEP_NONAME))
    233239      entry_name ((exp->resident ? &resnames : &nonresnames),
    234240                  exp->entryname, exp->ord);
  • trunk/src/emx/src/emxbind/fixup.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r60 r61  
    2323#include <stdlib.h>
    2424#include <string.h>
     25#include <alloca.h>
    2526#include "defs.h"
    2627#include "emxbind.h"
     
    99100      sym_hash_table[hash] = i;
    100101    }
     102}
     103
     104
     105/* Find the symbol NAME in the a.out symbol table of the input
     106   executable.  If UNDERSCORE is true, an underscore is prepended to
     107   NAME.  If the symbol is found, find_symbol() returns a pointer to
     108   the symbol table entry.  Otherwise, NULL is returned. */
     109
     110struct nlist *find_symbol (const char *name, int underscore)
     111{
     112  int j, len;
     113  const char *name1 = name;
     114
     115  len = strlen (name);
     116  if (underscore)
     117  {
     118    name1 = alloca (len + 2);
     119    ((char *)name1)[0] = '_';
     120    memcpy (((char *)name1) + 1, name, len + 1);
     121  }
     122
     123  for (j = sym_hash_table[sym_hash (name1)]; j != -1;
     124       j = sym_hash_next[j])
     125    {
     126      const char *name2 = sym_image[j].string + str_image;
     127
     128      if (memcmp (name1, name2, len) == 0)
     129      {
     130        int t = sym_image[j].type & ~N_EXT;
     131        if (t == N_TEXT || t == N_DATA || t == N_BSS)
     132          return sym_image+j;
     133      }
     134    }
     135
     136  return NULL;
    101137}
    102138
  • trunk/src/emx/src/emxbind/map.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r60 r61  
    2323#include <stdlib.h>
    2424#include <string.h>
     25#include <alloca.h>
    2526#include "defs.h"
    2627#include "emxbind.h"
Note: See TracChangeset for help on using the changeset viewer.