Changeset 236


Ignore:
Timestamp:
May 26, 2003, 4:43:12 PM (22 years ago)
Author:
zap
Message:

See ChangeLog.

Location:
trunk/src/emx
Files:
6 added
9 deleted
376 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/Makefile

    • Property cvs2svn:cvs-rev changed from 1.15 to 1.16
    r235 r236  
    4747
    4848# The C compiler
    49 CC = gcc -c
     49CC = gcc -c -Zmt
    5050# The C compiler flags
    5151CFLAGS.INC = -Iinclude -Isrc/include
    52 CFLAGS = -Wall -mstack-arg-probe -Zmt $(CFLAGS.INC) $(CFLAGS.$(MODE)) $(CFLAGS.KIND)
     52CFLAGS = -Wall -mstack-arg-probe $(CFLAGS.INC) $(CFLAGS.$(MODE)) $(CFLAGS.KIND)
    5353# The additional C compiler flags for different build modes
    5454CFLAGS.opt = -s -O3
    55 CFLAGS.dbg = -g
     55CFLAGS.dbg = -g -DDEBUG
    5656CFLAGS.aout =
    5757CFLAGS.omf = -Zomf
     
    6565
    6666# The linker
    67 LD = gcc
     67LD = gcc -Zmt
    6868# Linker flags
    69 LDFLAGS = -Zmt $(LDFLAGS.$(MODE)) $(LDFLAGS.KIND)
     69LDFLAGS = $(LDFLAGS.$(MODE)) $(LDFLAGS.KIND)
    7070LDFLAGS.DLL = $(LDFLAGS) -Zdll
    7171# Linker flags for different build modes
     
    126126MAKEDEPFLAGS = $(CFLAGS.INC)
    127127DO.DEPS = $(MAKEDEP) $(MAKEDEPFLAGS) \
    128   -I$(subst $(SPACE), -I,$(sort $(dir $^))) -p$(@D)/ -c -S -f$@ $^
     128  -I$(subst $(SPACE), -I,$(sort $(dir $^))) -I$. -p$(@D)/ -c -S -f$@ $^
    129129
    130130# How to convert an a.out file to the OMF format
     
    166166# Miscelaneous tools
    167167MKDIR = mkdir.exe -p $1
     168# How to update a file only if it has been changed
     169UPDATE = (cmp -s $1 $2 || mv -f $1 $2) && rm -f $1
     170# How to touch a file
     171TOUCH = touch $1
    168172# Re-build the original string including the ',' between args. Also escape
    169173# dollars since otherwise ash would expand them.
     
    186190DO.HELP.VARS := $(call ECHO,    MODE={dbg|opt} - choose between debug and optimized build modes.)$(NL)
    187191DO.HELP.VARS += $(call ECHO,    OBJF={omf|aout} - build object files in omf or a.out format.)$(NL)
    188 # The commands to install everything we have built
    189 DO.INSTALL :=
    190 # The list of install directories
    191 INSDIRS :=
    192192# The list of work directories needeed for building all targets
    193193TARGDIRS :=
     
    196196# The list of dependency files
    197197TARGDEPEND :=
    198 
    199 .PHONY: default help all tools clean install cleandep cleandepend dep depend depdone
     198# The list of installed files
     199INS.FILES :=
     200
     201.PHONY: default help all libs tools clean install install cleandep \
     202  cleandepend dep depend depdone
    200203.SUFFIXES:
    201204.SUFFIXES: .c .cpp .asm .s .o .exe .dll .a .lib .obj
     
    210213-include $(SUBMAK)
    211214
    212 # Sort and remove duplicate install directories
     215# Sort and remove duplicate directories
    213216TARGDIRS := $(sort $(TARGDIRS))
    214 INSDIRS := $(sort $(INSDIRS))
     217# Find out which directories are needed for installation
     218INSDIRS := $(sort $(dir $(INS.FILES)))
    215219
    216220#------------ Global targets ------------
     
    223227        @$(call ECHO,    {module-name} - build just a particular module)
    224228        @$(call ECHO,    tools - build just the tools)
     229        @$(call ECHO,    libs - build all libraries)
    225230        @$(call ECHO,    clean - remove all generated files (remove all built files))
    226231        @$(call ECHO,    install - generate a installation tree in $(INS))
     
    250255        @$(call ECHO,Dependency files succesfully updated)
    251256
    252 install: all $(INSDIRS)
    253         $(DO.INSTALL)
     257install: all $(INSDIRS) $(INS.FILES)
    254258
    255259$. $(INSDIRS) $(TARGDIRS):
  • trunk/src/emx/common.smak

    • Property cvs2svn:cvs-rev changed from 1.5 to 1.6
    r235 r236  
    3737
    3838ifdef .INSDIR
    39 DO.INSTALL += $(call CP,$.$(.TARG),$(INS)$(.INSDIR)$(.TARGET))$(NL)
    40 INSDIRS += $(INS)$(.INSDIR)
     39INS.FILES += $(INS)$(.INSDIR)$(.TARGET)
     40$(INS)$(.INSDIR)$(.TARGET): $.$(.TARG)
     41        $(call CP,$<,$@)
    4142endif # def .INSDIR
    4243
  • trunk/src/emx/include/a_out.h

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    138138/* emx */
    139139#define N_IMP1  0x68            /* Import definition symbol */
     140#define N_IMP2  0x6a            /* Import definition symbol */
    140141
    141142
     
    168169  unsigned int r_pad:4;
    169170};
     171
    170172#endif /* __A_OUT_GNU_H__ */
  • trunk/src/emx/include/emx/asm386.h

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    22
    33#include <sys/errno.h>
     4
     5/* Macros for defining standard libc functions */
     6
     7#define _STD(x) __std_ ## x
    48
    59#define _xam fxam; fstsw %ax; andb $0x45, %ah
     
    1418#if defined (LONG_DOUBLE)
    1519#define FLD fldt
    16 #define MATHSUFFIX1(X)   _##X##l
    17 #define MATHSUFFIX2(X)  _##X##l
    18 #define MATHSUFFIX3(X)  X##l
     20#define MATHSUFFIX1(X)  _STD(##X##l)
     21#define MATHSUFFIX2(X)  _STD(##X##l)
     22#define MATHSUFFIX3(X)  _##X##l
    1923#define CONV(X)
    2024#elif defined (FLOAT)
    2125#define FLD flds
    22 #define MATHSUFFIX1(X)  _##X##f
    23 #define MATHSUFFIX2(X)  _##X##f
    24 #define MATHSUFFIX3(X)  X##f
     26#define MATHSUFFIX1(X)  _STD(##X##f)
     27#define MATHSUFFIX2(X)  _STD(##X##f)
     28#define MATHSUFFIX3(X)  _##X##f
    2529#define CONV(X) fstps X; flds X
    2630#else
    2731#define FLD fldl
    28 #define MATHSUFFIX1(X)  X
    29 #define MATHSUFFIX2(X)  _##X
    30 #define MATHSUFFIX3(X)  X
     32#define MATHSUFFIX1(X)  _STD(X)
     33#define MATHSUFFIX2(X)  _STD(X)
     34#define MATHSUFFIX3(X)  _##X
    3135#define CONV(X) fstpl X; fldl X
    3236#endif
    3337
    34 #define LABEL0(name)    _##name
    35 #define LABEL(name)     LABEL0(name)
    36 
    3738#define ALIGN   .align  2, 0x90
    38 
    39 #if !defined (__MT__)
    40 
    41 #define SET_ERRNO_CONST(x) \
    42         movl    x, _errno
    43 
    44 #else
    4539
    4640#define SET_ERRNO_CONST(x) \
    4741        call    __errno ;\
    4842        movl    x, (%eax)
    49 
    50 #endif
    5143
    5244#if defined (__GPROF__)
     
    7365#define FP_INFINITE     3
    7466#define FP_NAN          4
    75 
    76 /* Macros for defining standard libc functions */
    77 
    78 #define CONCAT(x,y) x ## y
    79 #define _STD(x) CONCAT(__std_,x)
  • trunk/src/emx/include/emx/io.h

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    165165extern struct fdvec _fdvec_head;
    166166
    167 #if defined (__MT__)
    168 
    169167/* This is currently used only in the multi-thread libraries.  We
    170168   can't use and reallocate a single array because rmutex semaphores
     
    207205
    208206#endif /* defined (_SYS_RMUTEX_H) */
    209 
    210 #else /* !defined (__MT__) */
    211 
    212 #define STREAMV_LOCK            (void)0
    213 #define STREAMV_UNLOCK          (void)0
    214 
    215 #define STREAM_LOCK(f)          (void)0
    216 #define STREAM_UNLOCK(f)        (void)0
    217 #define STREAM_LOCK_NOWAIT(f)   1
    218 #define STREAM_UNLOCKED(f)      1
    219 
    220 #endif /* !defined (__MT__) */
    221207
    222208
  • trunk/src/emx/include/emx/startup.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    88#endif
    99
     10extern int _CRT_init (void);
     11extern void _CRT_term (void);
     12
    1013/* argv[i][-1] contains some flag bits: */
    1114
     
    1619#define _ARG_NONZERO  0x80          /* Always set, to avoid end of string   */
    1720
    18 /* Arrange that FUN will be called by _startup(). */
     21/* Arrange that FUN will be called by _CRT_init(). */
    1922
    2023#define _CRT_INIT1(fun) __asm__ (".stabs \"___crtinit1__\", 23, 0, 0, _" #fun);
    2124
    22 /* Arrange that FUN will be called by _cleanup(). */
     25/* Arrange that FUN will be called by _CRT_term(). */
    2326
    2427#define _CRT_EXIT1(fun) __asm__ (".stabs \"___crtexit1__\", 23, 0, 0, _" #fun);
     
    2932extern char ** _org_environ;
    3033
    31 extern char _cdll_flag;
    32 
    33 void _cleanup (void);
    34 
    3534#if defined (__cplusplus)
    3635}
  • trunk/src/emx/include/emx/thread.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    77extern "C" {
    88#endif
    9 
    10 #if defined (__MT__)
    119
    1210#if !defined (_TM)
     
    5351struct _thread *_thread (void);
    5452
    55 #endif /* defined (__MT__) */
    56 
    5753
    5854#if defined (__cplusplus)
  • trunk/src/emx/include/emx/umalloc.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    598598/* Each thread has its own default heap. */
    599599
    600 #if defined (__MT__)
    601600#define _UM_DEFAULT_REGULAR_HEAP tp->_th_rheap
    602601#define _UM_DEFAULT_TILED_HEAP   tp->_th_theap
    603602#define _UM_MT_DECL              struct _thread *tp = _thread ();
    604 #else
    605 #define _UM_DEFAULT_REGULAR_HEAP _um_regular_heap
    606 #define _UM_DEFAULT_TILED_HEAP   _um_tiled_heap
    607 #define _UM_MT_DECL
    608 #endif
    609603
    610604/* Note that _um_regular_heap is declared in <umalloc.h>.
     
    735729static __inline__ void _um_heap_lock (Heap_t h)
    736730{
    737 #if defined (__MT__)
    738731  _rmutex_checked_request (&h->rsem, _FMR_IGNINT);
    739 #endif
    740732}
    741733
     
    743735static __inline__ void _um_heap_unlock (Heap_t h)
    744736{
    745 #if defined (__MT__)
    746737  _rmutex_checked_release (&h->rsem);
    747 #endif
    748738}
    749739
  • trunk/src/emx/include/os2thunk.h

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    66typedef unsigned long _far16ptr;
    77
    8 _far16ptr _emx_32to16 (void *ptr);
    9 void *_emx_16to32 (_far16ptr ptr);
     8_far16ptr _libc_32to16 (void *ptr);
     9void *_libc_16to32 (_far16ptr ptr);
    1010
    11 unsigned long _emx_thunk1 (void *args, void *fun);
     11unsigned long _libc_thunk1 (void *args, void *fun);
    1212
    1313#define _THUNK_PASCAL_PROLOG(SIZE) \
     
    1717#define _THUNK_PASCAL_SHORT(ARG)    (*--((unsigned short *)_tp) = (ARG))
    1818#define _THUNK_PASCAL_LONG(ARG)     (*--((unsigned long *)_tp) = (ARG))
    19 #define _THUNK_PASCAL_FLAT(ARG)     _THUNK_PASCAL_LONG (_emx_32to16 (ARG))
     19#define _THUNK_PASCAL_FLAT(ARG)     _THUNK_PASCAL_LONG (_libc_32to16 (ARG))
    2020#define _THUNK_PASCAL_FAR16(ARG)    _THUNK_PASCAL_LONG (ARG)
    2121#define _THUNK_PASCAL_FUNCTION(FUN) APIENTRY _16_##FUN
    22 #define _THUNK_PASCAL_CALL(FUN)     _emx_thunk1 (_tb, (void *)(_16_##FUN)); })
    23 #define _THUNK_PASCAL_CALLI(FUN)    _emx_thunk1 (_tb, (void *)(FUN)); })
     22#define _THUNK_PASCAL_CALL(FUN)     _libc_thunk1 (_tb, (void *)(_16_##FUN)); })
     23#define _THUNK_PASCAL_CALLI(FUN)    _libc_thunk1 (_tb, (void *)(FUN)); })
    2424
    2525#define _THUNK_C_PROLOG(SIZE) \
     
    2929#define _THUNK_C_SHORT(ARG)    (*((unsigned short *)_tp)++ = (ARG))
    3030#define _THUNK_C_LONG(ARG)     (*((unsigned long *)_tp)++ = (ARG))
    31 #define _THUNK_C_FLAT(ARG)     _THUNK_C_LONG (_emx_32to16 (ARG))
     31#define _THUNK_C_FLAT(ARG)     _THUNK_C_LONG (_libc_32to16 (ARG))
    3232#define _THUNK_C_FAR16(ARG)    _THUNK_C_LONG (ARG)
    3333#define _THUNK_C_FUNCTION(FUN) _16__##FUN
    34 #define _THUNK_C_CALL(FUN)     _emx_thunk1 (_tb, (void *)(_16__##FUN)); })
    35 #define _THUNK_C_CALLI(FUN)    _emx_thunk1 (_tb, (void *)(FUN)); })
     34#define _THUNK_C_CALL(FUN)     _libc_thunk1 (_tb, (void *)(_16__##FUN)); })
     35#define _THUNK_C_CALLI(FUN)    _libc_thunk1 (_tb, (void *)(FUN)); })
    3636
    3737#define _THUNK_PROLOG(SIZE)  _THUNK_PASCAL_PROLOG (SIZE)
     
    4646
    4747#define MAKE16P(sel,off)   ((_far16ptr)((sel) << 16 | (off)))
    48 #define MAKEP(sel,off)     _emx_16to32 (MAKE16P (sel, off))
     48#define MAKEP(sel,off)     _libc_16to32 (MAKE16P (sel, off))
    4949#define SELECTOROF(farptr) ((SEL)((farptr) >> 16))
    5050#define OFFSETOF(farptr)   ((USHORT)(farptr))
  • trunk/src/emx/include/stdio.h

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    112112#if !defined (_VA_LIST)
    113113#define _VA_LIST
    114 typedef char *va_list;
     114typedef __builtin_va_list va_list;
    115115#endif
    116116
     
    159159int _rmtmp (void);
    160160
    161 int _getc_inline (FILE *);
    162 int _putc_inline (int, FILE *);
    163 
    164161extern __inline__ int feof (FILE *_s)
    165162{
     
    172169}
    173170
    174 /* Do not use this function in application programs! */
    175 
    176 extern __inline__ int _getc_inline (FILE *_s)
    177 {
    178   return (--_s->_rcount >= 0
    179           ? (unsigned char)*_s->_ptr++
    180           : _fill (_s));
    181 }
    182 
    183 /* Do not use this function in application programs! */
    184 
    185 extern __inline__ int _putc_inline (int _c, FILE *_s)
    186 {
    187   return (--_s->_wcount >= 0 && (_c != '\n' || !(_s->_flags & _IOLBF))
    188           ? (unsigned char)(*_s->_ptr++ = (char)_c)
    189           : _flush (_c, _s));
    190 }
    191 
    192 #if defined (__MT__)
    193 
    194171#define getc(s)   fgetc(s)
    195172#define putc(c,s) fputc(c,s)
    196 
    197 #else
    198 
    199 #define getc(s)   _getc_inline(s)
    200 #define putc(c,s) _putc_inline(c,s)
    201 
    202 #endif
    203173
    204174extern __inline__ int getchar (void) { return getc (stdin); }
  • trunk/src/emx/include/stdlib.h

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r235 r236  
    116116#if !defined (_ERRNO)
    117117#define _ERRNO
    118 #if defined (__MT__) || defined (__ST_MT_ERRNO__)
    119118extern int *_errno (void);
    120119#define errno (*_errno ())
    121 #else
    122 extern int errno;
    123 #endif
    124120#endif
    125121
     
    148144extern __const__ int sys_nerr;
    149145
    150 extern __const__ unsigned int _emx_vcmp;
    151 extern __const__ unsigned int _emx_env;
    152 extern __const__ unsigned int _emx_rev;
    153146extern __const__ unsigned char _osminor;
    154147extern __const__ unsigned char _osmajor;
    155 extern __const__ unsigned char _osmode;
    156 extern __const__ char _emx_vprt[5];
    157 
     148
     149/* No DOS support ... */
     150#define _osmode OS2_MODE
    158151
    159152unsigned alarm (unsigned);
     
    263256void _wildcard (int *, char ***);
    264257
    265 #if defined (__MT__)
    266258int _beginthread (void (*)(void *), void *, unsigned, void *);
    267259void _endthread (void);
    268260void **_threadstore (void);
    269 #endif
    270261
    271262#endif
  • trunk/src/emx/include/string.h

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    5858char *strdup (__const__ char *);
    5959int stricmp (__const__ char *, __const__ char *);
     60int strcasecmp (__const__ char *, __const__ char *);
    6061char *strlwr (char *);
    6162int strnicmp (__const__ char *, __const__ char *, size_t);
     63int strncasecmp (__const__ char *, __const__ char *, size_t);
    6264char *strnset (char *, int, size_t);
    6365char *strrev (char *);
  • trunk/src/emx/include/sys/errno.h

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    1010#if !defined (__ASSEMBLER__) && !defined (_ERRNO)
    1111#define _ERRNO
    12 #if defined (__MT__) || defined (__ST_MT_ERRNO__)
    1312extern int *_errno (void);
    1413#define errno (*_errno ())
    15 #else
    16 extern int errno;
    17 #endif
    1814#endif
    1915
  • trunk/src/emx/include/sys/omflib.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    1010#endif
    1111
     12#ifndef _BYTE_WORD_DWORD
     13#define _BYTE_WORD_DWORD
     14typedef unsigned char byte;
     15typedef unsigned short word;
     16typedef unsigned long dword;
     17#endif /* _BYTE_WORD_DWORD */
    1218
    1319#if !defined (THEADR)
    1420
    15 #define THEADR 0x80
    16 #define LHEADR 0x82
    17 #define COMENT 0x88
    18 #define MODEND 0x8a
    19 #define PUBDEF 0x90
    20 #define ALIAS  0xc6
    21 #define LIBHDR 0xf0
    22 #define LIBEND 0xf1
     21/* OMF record types.  To get the 32-bit variant of a record type, add
     22   REC32. */
     23#define THEADR          0x80    /* Translator module header record */
     24#define COMENT          0x88    /* Comment record */
     25#define MODEND          0x8a    /* Module end record */
     26#define EXTDEF          0x8c    /* External names definition record */
     27#define TYPDEF          0x8e    /* Type definition record */
     28#define PUBDEF          0x90    /* Public names definition record */
     29#define LINNUM          0x94    /* Line numbers record */
     30#define LNAMES          0x96    /* List of names record */
     31#define SEGDEF          0x98    /* Segment definition record */
     32#define GRPDEF          0x9a    /* Group definition record */
     33#define FIXUPP          0x9c    /* Fixup record */
     34#define LEDATA          0xa0    /* Logical enumerated data record */
     35#define LIDATA          0xa2    /* Logical iterated data record */
     36#define COMDEF          0xb0    /* Communal names definition record */
     37#define COMDAT          0xc2    /* Common block */
     38#define ALIAS           0xc6    /* Alias definition record */
     39#define LIBHDR          0xf0    /* Library header */
     40#define LIBEND          0xf1    /* Library end */
    2341
    24 #define REC32  0x01
     42/* Add this constant (using the | operator) to get the 32-bit variant
     43   of a record type.  Some fields will contain 32-bit values instead
     44   of 16-bit values. */
     45#define REC32           0x01
    2546
    2647#endif
  • trunk/src/emx/include/sys/uio.h

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    4848/** @name tcpip40 function mappings.
    4949 * @{ */
    50 #define readv         tcpip40_readv
    51 #define writev       tcpip40_writev
     50//@@@ name conflict - a.z. #define readv         tcpip40_readv
     51//@@@ name conflict - a.z. #define writev        tcpip40_writev
    5252/* @} */
    5353
  • trunk/src/emx/mkimplib.smak

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    44
    55include common.smak
     6
     7libs: $(.MODULE)
    68
    79# The rule for building an archive
  • trunk/src/emx/mklib.smak

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r235 r236  
    44
    55include common.smak
     6
     7libs: $(.MODULE)
    68
    79# The rule for building an archive
  • trunk/src/emx/mkomflib.smak

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    2525MODULES += $(.MODULE)@omf
    2626
    27 DO.INSTALL += $(call CP,$.$(.TARG@OMF),$(INS)$(.INSDIR)$(.TARGET))$(NL)
     27INS.FILES += $(INS)$(.INSDIR)$(.TARGET)
     28$(INS)$(.INSDIR)$(.TARGET): $.$(.TARG@OMF)
     29        $(call CP,$<,$@)
    2830
    2931.DIRS@OMF := $(dir $.$(.TARG@OMF))
     
    3537# Add a dependency rule to help make
    3638# (avoids that dumb 'dunno how to make' message)
    37 RULES += $(call FECHO,_@,$.$(.TARG@OMF): $.$(.TARG))$(NL)
     39$.$(.TARG@OMF): $.$(.TARG)
    3840
    3941endif # neq ($(findstring aout,$(.TKIND)),)
  • trunk/src/emx/src/emxbind/cmd.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    6666      my_write (&str_len, sizeof (str_len), &inp_file);
    6767      my_trunc (&inp_file);
    68       a_in_h.sym_size = 0;
     68      a_in_h.a_syms = 0;
    6969      my_seek (&inp_file, a_in_pos);
    7070      my_write (&a_in_h, sizeof (a_in_h), &inp_file);
  • trunk/src/emx/src/emxbind/emxbind.c

    • Property cvs2svn:cvs-rev changed from 1.5 to 1.6
    r235 r236  
    3939/* The banner line of emxbind. */
    4040
    41 static char *title = "emxbind " VERSION INNOTEK_VERSION " -- "
     41static char *title = "emxbind " VERSION " -- "
    4242                     "Copyright (c) 1991-1997 by Eberhard Mattes";
    4343
  • trunk/src/emx/src/emxbind/emxbind.h

    • Property cvs2svn:cvs-rev changed from 1.5 to 1.6
    r235 r236  
    1919Boston, MA 02111-1307, USA.  */
    2020
     21
     22#include "a_out.h"
    2123
    2224#if defined (EXTERN)
     
    3133/* By default, don't implement the -L option (for listing the headers
    3234   of an EXE file). */
    33 
    34 /* This is the version number. */
    35 
    36 #define VERSION "0.9d"
    37 #include "../../../../include/innotekversion.h"
    3835
    3936/* Put this at the end of a function declaration to tell the compiler
     
    277274/* The a.out header read from the source a.out (sub)file. */
    278275
    279 EXTERN struct a_out_header a_in_h;
     276EXTERN struct exec a_in_h;
    280277
    281278/* The fixed part of the LX header. */
     
    335332   respectively, as read from the source a.out file. */
    336333
    337 EXTERN struct reloc *tr_image INIT (NULL);
    338 EXTERN struct reloc *dr_image INIT (NULL);
     334EXTERN struct relocation_info *tr_image INIT (NULL);
     335EXTERN struct relocation_info *dr_image INIT (NULL);
    339336
    340337/* This array contains the symbol table, as read from the source a.out
  • trunk/src/emx/src/emxbind/emxbind.smak

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r235 r236  
    77.TKIND  := $(TOOLFMT)
    88.TSRC   := $(wildcard src/emxbind/*.c)
     9.TCF    := $(CFLAGS.DEF.VERSION)
    910.TLDF   := -lmoddef
    1011.TKEEP  := 1
     
    1213
    1314.TARG := $(TOOLFMT)/os2stub.bin
    14 DO.INSTALL += $(call CP,$.$(.TARG),$(INS)$(.INSDIR))$(NL)
    1515
    1616emxbind: $.$(.TARG)
     
    1919        $(call CP,$< $@)
    2020
     21INS.FILES += $(INS)$(.INSDIR)os2stub.bin
     22
     23$(INS)$(.INSDIR)os2stub.bin: $.$(.TARG)
     24        $(call CP,$^,$@)
     25
    2126include comend.smak
  • trunk/src/emx/src/emxbind/exec.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    2929
    3030
    31 /* Magic number for a.out executable files as used by emx. */
    32 
    33 #define A_OUT_MAGIC         0x010b
    34 
    35 
    3631/* The first DOS EXE header read from emxl.exe or emx.exe. */
    3732
     
    4035/* The a.out header to be written to the output executable. */
    4136
    42 static struct a_out_header a_out_h;
     37static struct exec a_out_h;
    4338
    4439/* The header of the core dump file. */
     
    177172  my_read (&a_in_h, sizeof (a_in_h), &inp_file);
    178173  a_out_h = a_in_h;
    179   if (a_in_h.magic != A_OUT_MAGIC || a_in_h.entry != TEXT_BASE)
     174  if (N_MAGIC (a_in_h) != ZMAGIC || a_in_h.a_entry != TEXT_BASE)
    180175    error ("invalid a.out file (header)");
    181   a_out_h.drsize = 0;
    182   a_out_h.trsize = 0;
     176  a_out_h.a_drsize = 0;
     177  a_out_h.a_trsize = 0;
    183178  my_seek (&inp_file, A_OUT_OFFSET);
    184179  my_read (buf, sizeof (buf), &inp_file);
    185180  a_in_text = A_OUT_OFFSET;
    186   a_in_data = a_in_text + round_page (a_in_h.text_size);
    187   a_in_tr = a_in_data + round_page (a_in_h.data_size);
    188   a_in_dr = a_in_tr + a_in_h.trsize;
    189   a_in_sym = a_in_dr + a_in_h.drsize;
    190   data_base = round_segment (TEXT_BASE + a_in_h.text_size);
     181  a_in_data = a_in_text + round_page (a_in_h.a_text);
     182  a_in_tr = a_in_data + round_page (a_in_h.a_data);
     183  a_in_dr = a_in_tr + a_in_h.a_trsize;
     184  a_in_sym = a_in_dr + a_in_h.a_drsize;
     185  data_base = round_segment (TEXT_BASE + a_in_h.a_text);
    191186  text_off = a_in_pos + a_in_text - TEXT_BASE;
    192187  data_off = a_in_pos + a_in_data - data_base;
    193   syms = (a_in_h.sym_size != 0 &&
    194           a_in_sym + a_in_h.sym_size + sizeof (a_in_str_size) <=
     188  syms = (a_in_h.a_syms != 0 &&
     189          a_in_sym + a_in_h.a_syms + sizeof (a_in_str_size) <=
    195190          my_size (&inp_file));
    196191  if (syms)
    197192    {
    198       a_in_str = a_in_sym + a_in_h.sym_size;
     193      a_in_str = a_in_sym + a_in_h.a_syms;
    199194      my_seek (&inp_file, a_in_str);
    200195      my_read (&a_in_str_size, sizeof (a_in_str_size), &inp_file);
     
    214209      a_out_str = a_in_sym;
    215210      a_out_str_size = 4;
    216       a_out_h.sym_size = 0;
    217     }
    218   a_out_str -= a_in_h.drsize + a_in_h.trsize;
     211      a_out_h.a_syms = 0;
     212    }
     213  a_out_str -= a_in_h.a_drsize + a_in_h.a_trsize;
    219214  a_out_size = a_out_str + a_out_str_size;
    220215}
     
    229224    error ("invalid core file (header)");
    230225  if (core_h.u_data_base != data_base
    231       || core_h.u_data_end != data_base + a_in_h.data_size + a_in_h.bss_size)
     226      || core_h.u_data_end != data_base + a_in_h.a_data + a_in_h.a_bss)
    232227    error ("core file doesn't match a.out file");
    233   a_out_h.data_size = round_page (core_h.u_data_end - core_h.u_data_base);
    234   a_out_h.bss_size = 0;
     228  a_out_h.a_data = round_page (core_h.u_data_end - core_h.u_data_base);
     229  a_out_h.a_bss = 0;
    235230  if (core_h.u_heap_brk > core_h.u_heap_base)
    236231    {
    237232      if (core_h.u_heap_brk - core_h.u_heap_base > heap_size)
    238233        error ("the heap size is too small for the core file's heap");
    239       a_out_h.data_size = round_page (core_h.u_heap_brk - core_h.u_data_base);
     234      a_out_h.a_data = round_page (core_h.u_heap_brk - core_h.u_data_base);
    240235    }
    241236  if (core_h.u_heapobjs_off != 0)
     
    264259    {
    265260      my_seek (&inp_file, a_in_tr);
    266       tr_image = xmalloc (a_in_h.trsize);
    267       my_read (tr_image, a_in_h.trsize, &inp_file);
     261      tr_image = xmalloc (a_in_h.a_trsize);
     262      my_read (tr_image, a_in_h.a_trsize, &inp_file);
    268263    }
    269264  if (dr_image == NULL)
    270265    {
    271266      my_seek (&inp_file, a_in_dr);
    272       dr_image = xmalloc (a_in_h.drsize);
    273       my_read (dr_image, a_in_h.drsize, &inp_file);
     267      dr_image = xmalloc (a_in_h.a_drsize);
     268      my_read (dr_image, a_in_h.a_drsize, &inp_file);
    274269    }
    275270}
     
    284279  if (text_image == NULL)
    285280    {
    286       t_size = round_page (a_in_h.text_size);
     281      t_size = round_page (a_in_h.a_text);
    287282      text_image = xmalloc (t_size);
    288283      my_seek (&inp_file, a_in_text);
     
    291286  if (data_image == NULL)
    292287    {
    293       d_size = round_page (a_in_h.data_size);
     288      d_size = round_page (a_in_h.a_data);
    294289      data_image = xmalloc (d_size);
    295290      my_seek (&inp_file, a_in_data);
     
    305300  if (sym_image == NULL)
    306301    {
    307       sym_image = xmalloc (a_in_h.sym_size);
     302      sym_image = xmalloc (a_in_h.a_syms);
    308303      str_image = xmalloc (a_in_str_size);
    309304      my_seek (&inp_file, a_in_sym);
    310       my_read (sym_image, a_in_h.sym_size, &inp_file);
     305      my_read (sym_image, a_in_h.a_syms, &inp_file);
    311306      my_seek (&inp_file, a_in_str);
    312307      my_read (str_image, a_in_str_size, &inp_file);
    313       sym_count = a_in_h.sym_size / sizeof (struct nlist);
     308      sym_count = a_in_h.a_syms / sizeof (struct nlist);
    314309      build_sym_hash_table ();
    315310    }
     
    387382  out_h2.new_lo = LOWORD (os2_hdr_pos);
    388383  out_h2.new_hi = HIWORD (os2_hdr_pos);
    389   obj_text.virt_size = a_in_h.text_size;
    390   obj_data.virt_size = a_in_h.data_size + a_in_h.bss_size;
     384  obj_text.virt_size = a_in_h.a_text;
     385  obj_data.virt_size = a_in_h.a_data + a_in_h.a_bss;
    391386  obj_stk0.virt_size = stack_size;
    392   obj_data.virt_base = round_segment (obj_text.virt_base + a_in_h.text_size);
     387  obj_data.virt_base = round_segment (obj_text.virt_base + a_in_h.a_text);
    393388  obj_heap.virt_base = round_segment (OBJ_END (obj_data));
    394389  obj_stk0.virt_base = round_segment (OBJ_END (obj_heap));
    395390  os2_h.stack_esp = obj_stk0.virt_size;
    396   text_pages = npages (a_in_h.text_size);
     391  text_pages = npages (a_in_h.a_text);
    397392  heap_pages = 0;  gap_pages = 0;
    398393  if (opt_c != NULL)
    399394    {
    400       data_pages = npages (a_in_h.data_size + a_in_h.bss_size);
     395      data_pages = npages (a_in_h.a_data + a_in_h.a_bss);
    401396      heap_pages = npages (core_h.u_heap_brk - core_h.u_heap_base);
    402397
     
    408403    }
    409404  else
    410     data_pages = npages (a_in_h.data_size);
     405    data_pages = npages (a_in_h.a_data);
    411406
    412407  /* The object page table and the fixup page table don't include the
     
    783778  my_seek (&inp_file, a_in_text);
    784779  if (text_image != NULL)
    785     my_write (text_image, round_page (a_in_h.text_size), &out_file);
     780    my_write (text_image, round_page (a_in_h.a_text), &out_file);
    786781  else
    787     copy (&inp_file, round_page (a_in_h.text_size));
     782    copy (&inp_file, round_page (a_in_h.a_text));
    788783  if (opt_c != NULL)
    789784    {
     
    802797    }
    803798  else if (data_image != NULL)
    804     my_write (data_image, round_page (a_in_h.data_size), &out_file);
     799    my_write (data_image, round_page (a_in_h.a_data), &out_file);
    805800  else
    806801    {
    807802      my_seek (&inp_file, a_in_data);
    808       copy (&inp_file, round_page (a_in_h.data_size));
    809     }
    810   if (a_out_h.sym_size == 0)
     803      copy (&inp_file, round_page (a_in_h.a_data));
     804    }
     805  if (a_out_h.a_syms == 0)
    811806    {
    812807      str_len = 4;
     
    816811    {
    817812      if (sym_image != NULL)
    818         my_write (sym_image, a_out_h.sym_size, &out_file);
     813        my_write (sym_image, a_out_h.a_syms, &out_file);
    819814      else
    820815        {
    821816          my_seek (&inp_file, a_in_sym);
    822           copy (&inp_file, a_out_h.sym_size);
     817          copy (&inp_file, a_out_h.a_syms);
    823818        }
    824819      if (str_image != NULL)
  • trunk/src/emx/src/emxbind/export.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    139139  if (export_len != 0)
    140140    {
    141       if (a_in_h.sym_size == 0 || a_in_str_size == 0)
     141      if (a_in_h.a_syms == 0 || a_in_str_size == 0)
    142142        error ("need symbol table for EXPORTS");
    143143      read_sym ();
     
    151151      if (nl == NULL)
    152152        error ("symbol %s undefined (EXPORTS)", export_data[i].internalname);
    153       switch (nl->type & ~N_EXT)
     153      switch (nl->n_type & ~N_EXT)
    154154        {
    155155        case N_TEXT:
    156           export_data[i].offset = nl->value - obj_text.virt_base;
     156          export_data[i].offset = nl->n_value - obj_text.virt_base;
    157157          export_data[i].object = OBJ_TEXT;
    158158          break;
    159159        case N_BSS:
    160160        case N_DATA:
    161           export_data[i].offset = nl->value - obj_data.virt_base;
     161          export_data[i].offset = nl->n_value - obj_data.virt_base;
    162162          export_data[i].object = OBJ_DATA;
    163163          break;
    164164        default:
    165165          error ("cannot export symbol %s of type %d",
    166                  export_data[i].internalname, nl->type);
     166                 export_data[i].internalname, nl->n_type);
    167167        }
    168168    }
  • trunk/src/emx/src/emxbind/fixup.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r235 r236  
    9090  for (i = 0; i < sym_count; ++i)
    9191    {
    92       name = sym_image[i].string + str_image;
     92      name = sym_image[i].n_un.n_strx + str_image;
    9393      hash = sym_hash (name);
    9494      sym_hash_next[i] = sym_hash_table[hash];
     
    112112       j = sym_hash_next[j])
    113113    {
    114       const char *name2 = sym_image[j].string + str_image;
     114      const char *name2 = sym_image[j].n_un.n_strx + str_image;
    115115
    116116      if (memcmp (name1, name2, len) == 0)
    117117      {
    118         int t = sym_image[j].type & ~N_EXT;
     118        int t = sym_image[j].n_type & ~N_EXT;
    119119        if (t == N_TEXT || t == N_DATA || t == N_BSS)
    120120          return sym_image+j;
     
    342342/* Build fixups for the relocation table TABLE. */
    343343
    344 static void reloc_table (const struct reloc *table, long tab_size, int seg_obj,
     344static void reloc_table (const struct relocation_info *table, long tab_size, int seg_obj,
    345345                         dword seg_base, const byte *image, dword image_size)
    346346{
    347347  int n, obj;
    348   const struct reloc *r;
     348  const struct relocation_info *r;
    349349  dword x, dst_base;
    350350
    351   n = tab_size / sizeof (struct reloc);
     351  n = tab_size / sizeof (struct relocation_info);
    352352  for (r = table; n > 0; --n, ++r)
    353353    {
    354       if (r->length != 2)
    355         error ("relocation of size %d not implemented", 1 << r->length);
    356       switch (r->symbolnum & ~N_EXT)
     354      if (r->r_length != 2)
     355        error ("relocation of size %d not implemented", 1 << r->r_length);
     356      switch (r->r_symbolnum & ~N_EXT)
    357357        {
    358358        case N_TEXT:
     
    370370          break;
    371371        }
    372       if (obj >= 0 && (!r->pcrel || obj != seg_obj))
     372      if (obj >= 0 && (!r->r_pcrel || obj != seg_obj))
    373373        {
    374374          grow_fixup ();
    375           if (r->address+3 >= image_size)
     375          if (r->r_address+3 >= image_size)
    376376            error ("fixup outside image");
    377           x = *(dword *)(image + r->address);
    378           if (r->pcrel)
    379             x += dst_base  + r->address + 4;
    380           fixup_data[fixup_len].type = (r->pcrel ? FIXUP_REL : FIXUP_ABS);
     377          x = *(dword *)(image + r->r_address);
     378          if (r->r_pcrel)
     379            x += dst_base  + r->r_address + 4;
     380          fixup_data[fixup_len].type = (r->r_pcrel ? FIXUP_REL : FIXUP_ABS);
    381381          fixup_data[fixup_len].target = TARGET_ADDR;
    382382          fixup_data[fixup_len].obj = seg_obj;
    383383          fixup_data[fixup_len].mod = obj;
    384           fixup_data[fixup_len].addr = r->address;
     384          fixup_data[fixup_len].addr = r->r_address;
    385385          fixup_data[fixup_len].dst = x - dst_base;
    386386          fixup_data[fixup_len].add = 0;
     
    443443void relocations (void)
    444444{
    445   if (relocatable && (a_in_h.trsize != 0 || a_in_h.drsize != 0))
     445  if (relocatable && (a_in_h.a_trsize != 0 || a_in_h.a_drsize != 0))
    446446    {
    447447      read_segs ();
    448448      read_reloc ();
    449       reloc_table (tr_image, a_in_h.trsize, OBJ_TEXT, TEXT_BASE,
    450                    text_image, a_in_h.text_size);
    451       reloc_table (dr_image, a_in_h.drsize, OBJ_DATA, data_base,
    452                    data_image, a_in_h.data_size);
     449      reloc_table (tr_image, a_in_h.a_trsize, OBJ_TEXT, TEXT_BASE,
     450                   text_image, a_in_h.a_text);
     451      reloc_table (dr_image, a_in_h.a_drsize, OBJ_DATA, data_base,
     452                   data_image, a_in_h.a_data);
    453453    }
    454454}
     
    457457/* Process an import symbol for method (I2). */
    458458
    459 static void import_symbol (int seg_obj, const struct reloc *r,
     459static void import_symbol (int seg_obj, const struct relocation_info *r,
    460460                           const char *name1, int len, dword x,
    461461                           const char *name2)
     
    494494  if (memcmp ("_16_", name1, 4) == 0)
    495495    {
    496       if (r->pcrel)
     496      if (r->r_pcrel)
    497497        error ("pc-relative 16:16 fixup is invalid");
    498498      fixup_type = FIXUP_FAR16;
    499499    }
    500500  else
    501     fixup_type = (r->pcrel ? FIXUP_REL : FIXUP_ABS);
    502   ref_proc (name1, seg_obj, r->address, mod_idx, proc, (int)ord,
     501    fixup_type = (r->r_pcrel ? FIXUP_REL : FIXUP_ABS);
     502  ref_proc (name1, seg_obj, r->r_address, mod_idx, proc, (int)ord,
    503503            fixup_type, x);
    504504}
     
    508508   records. */
    509509
    510 void import_reloc (const struct reloc *table, long tab_size,
     510void import_reloc (const struct relocation_info *table, long tab_size,
    511511                   int seg_obj, dword seg_base, const byte *image,
    512512                   dword image_size)
    513513{
    514514  int reloc_count, i, j, len, ok;
    515   const struct reloc *r;
     515  const struct relocation_info *r;
    516516  const char *name1, *name2;
    517517  dword x;
    518518
    519   reloc_count = tab_size / sizeof (struct reloc);
     519  reloc_count = tab_size / sizeof (struct relocation_info);
    520520  for (i = 0, r = table; i < reloc_count; ++i, ++r)
    521     if (r->ext && r->length == 2)
     521    if (r->r_extern && r->r_length == 2)
    522522      {
    523523        if (sym_image == NULL)
    524524          read_sym ();
    525         if (r->symbolnum >= sym_count)
     525        if (r->r_symbolnum >= sym_count)
    526526          error ("invalid symbol number");
    527         if (sym_image[r->symbolnum].type == (N_IMP1|N_EXT))
     527        if (sym_image[r->r_symbolnum].n_type == (N_IMP1|N_EXT))
    528528          {
    529             if (r->address+3 >= image_size)
     529            if (r->r_address+3 >= image_size)
    530530              error ("fixup outside image");
    531             x = *(dword *)(image + r->address);
    532             if (r->pcrel)
    533               x += seg_base + r->address + 4;
    534             name1 = sym_image[r->symbolnum].string + str_image;
     531            x = *(dword *)(image + r->r_address);
     532            if (r->r_pcrel)
     533              x += seg_base + r->r_address + 4;
     534            name1 = sym_image[r->r_symbolnum].n_un.n_strx + str_image;
    535535            len = strlen (name1);
    536536            ok = FALSE;
    537537            for (j = sym_hash_table[sym_hash (name1)]; j != -1;
    538538                 j = sym_hash_next[j])
    539               if (sym_image[j].type == (N_IMP2|N_EXT))
     539              if (sym_image[j].n_type == (N_IMP2|N_EXT))
    540540                {
    541                   name2 = sym_image[j].string + str_image;
     541                  name2 = sym_image[j].n_un.n_strx + str_image;
    542542                  if (memcmp (name1, name2, len) == 0 && name2[len] == '=')
    543543                    {
     
    625625      free (set_vec);
    626626    }
    627   if (a_in_h.trsize != 0 || a_in_h.drsize != 0)
     627  if (a_in_h.a_trsize != 0 || a_in_h.a_drsize != 0)
    628628    {
    629629      read_segs ();
    630630      read_reloc ();
    631       import_reloc (tr_image, a_in_h.trsize, OBJ_TEXT, TEXT_BASE, text_image,
    632                     a_in_h.text_size);
    633       import_reloc (dr_image, a_in_h.drsize, OBJ_DATA, data_base, data_image,
    634                     a_in_h.data_size);
     631      import_reloc (tr_image, a_in_h.a_trsize, OBJ_TEXT, TEXT_BASE, text_image,
     632                    a_in_h.a_text);
     633      import_reloc (dr_image, a_in_h.a_drsize, OBJ_DATA, data_base, data_image,
     634                    a_in_h.a_data);
    635635    }
    636636}
  • trunk/src/emx/src/emxbind/map.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    6464  seg = 0;
    6565  text_seg = ++seg;
    66   fprintf (map_file, fmt, seg, 0, a_in_h.text_size, "TEXT32", "CODE");
     66  fprintf (map_file, fmt, seg, 0, a_in_h.a_text, "TEXT32", "CODE");
    6767  first_dgroup_seg = data_seg = ++seg;
    68   fprintf (map_file, fmt, seg, 0, a_in_h.data_size, "DATA32", "DATA");
    69   fprintf (map_file, fmt, seg, a_in_h.data_size, a_in_h.bss_size, "BSS32", "BSS");
     68  fprintf (map_file, fmt, seg, 0, a_in_h.a_data, "DATA32", "DATA");
     69  fprintf (map_file, fmt, seg, a_in_h.a_data, a_in_h.a_bss, "BSS32", "BSS");
    7070
    7171  if (obj_heap.virt_size != 0)
     
    200200      for (i = 0; i < sym_count; ++i)
    201201        {
    202           switch (sym_image[i].type)
     202          switch (sym_image[i].n_type)
    203203            {
    204204            case N_TEXT|N_EXT:
    205               seg  = text_seg; addr = sym_image[i].value - obj_text.virt_base;
     205              seg  = text_seg; addr = sym_image[i].n_value - obj_text.virt_base;
    206206              break;
    207207            case N_DATA|N_EXT:
    208208            case N_BSS|N_EXT:
    209               seg = data_seg; addr = sym_image[i].value - obj_data.virt_base;
     209              seg = data_seg; addr = sym_image[i].n_value - obj_data.virt_base;
    210210              break;
    211211            default:
     
    215215            {
    216216              grow_map_sym_table ();
    217               name = sym_image[i].string + str_image;
     217              name = sym_image[i].n_un.n_strx + str_image;
    218218              map_sym_table[map_sym_count].seg = seg;
    219219              map_sym_table[map_sym_count].addr = addr;
  • trunk/src/emx/src/emxcat/emxcat.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    2424#include <string.h>
    2525#include <ctype.h>
    26 
    27 #define VERSION "0.9d"
    28 #include "../../../../include/innotekversion.h"
    2926
    3027#define NORETURN volatile
     
    8582static void NORETURN usage (void)
    8683{
    87   fprintf (stderr, "emxcat " VERSION INNOTEK_VERSION " -- "
     84  fprintf (stderr, "emxcat " VERSION " -- "
    8885           "Copyright (c) 1992-1995 by Eberhard Mattes\n\n");
    8986  fprintf (stderr, "Usage: emxcat [-D<symbol>]... -o <output_file> <input_file>...\n");
     
    9794{
    9895  void *p;
    99 
     96 
    10097  p = malloc (n);
    10198  if (p == NULL)
     
    114111{
    115112  char *p;
    116 
     113 
    117114  p = xmalloc (strlen (s) + 1);
    118115  strcpy (p, s);
     
    306303{
    307304  edge *e;
    308 
     305 
    309306  v->mark = 1;
    310307  v->number = vn++;
  • trunk/src/emx/src/emxdoc/emxdoc.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    3939#include "cond.h"
    4040
    41 #define VERSION "0.9d"
    42 #include "../../../../include/innotekversion.h"
    43 
    4441struct word_table
    4542{
     
    188185static void usage (void)
    189186{
    190   fputs ("emxdoc " VERSION INNOTEK_VERSION " -- "
     187  fputs ("emxdoc " VERSION " -- "
    191188         "Copyright (c) 1993-1999 by Eberhard Mattes\n\n", stderr);
    192189  fputs ("Usage:\n", stderr);
  • trunk/src/emx/src/emxexp/emxexp.c

    • Property cvs2svn:cvs-rev changed from 1.6 to 1.7
    r235 r236  
    2727#include <errno.h>
    2828#include <ar.h>
     29#include <sys/omflib.h>
     30#include <a_out.h>
    2931#include "defs.h"
    30 #include <sys/omflib.h>
    3132#include "demangle.h"
    32 
    33 #define VERSION "0.9d"
    34 #include "../../../../include/innotekversion.h"
    3533
    3634struct bss_list
     
    7573{
    7674  void *p;
    77 
     75 
    7876  p = malloc (n);
    7977  if (p == NULL)
     
    9088{
    9189  void *p;
    92 
     90 
    9391  p = realloc (ptr, n);
    9492  if (p == NULL)
     
    102100static void usage (void)
    103101{
    104   fputs ("emxexp " VERSION INNOTEK_VERSION " -- Copyright (c) 1993-1995 by Eberhard Mattes\n\n"
     102  fputs ("emxexp " VERSION " -- Copyright (c) 1993-1995 by Eberhard Mattes\n\n"
    105103         "Usage: emxexp [-n] [-u] [-o[<ordinal>] <input_file>...\n\n"
    106104         "Options:\n"
     
    170168{
    171169  byte *inp_buf;
    172   const struct a_out_header *a_out_h;
     170  const struct exec *a_out_h;
    173171  const byte *sym;
    174172  const struct nlist *sym_ptr;
     
    183181  size = fread (inp_buf, 1, size, inp_file);
    184182
    185   a_out_h = (struct a_out_header *)inp_buf;
    186   if (size < sizeof (struct a_out_header) || a_out_h->magic != 0407)
     183  a_out_h = (struct exec *)inp_buf;
     184  if (size < sizeof (struct exec) || N_MAGIC (*a_out_h) != OMAGIC)
    187185    error ("Malformed input file `%s'", inp_fname);
    188   sym = (inp_buf + sizeof (struct a_out_header) + a_out_h->text_size
    189          + a_out_h->data_size + a_out_h->trsize + a_out_h->drsize);
    190   if (!a_out_h->sym_size)
     186  sym = (inp_buf + sizeof (struct exec) + a_out_h->a_text
     187         + a_out_h->a_data + a_out_h->a_trsize + a_out_h->a_drsize);
     188  if (!a_out_h->a_syms)
    191189    return;
    192   str_ptr = sym + a_out_h->sym_size;
     190  str_ptr = sym + a_out_h->a_syms;
    193191  if (str_ptr + 4 - inp_buf > size)
    194192    error ("Malformed input file `%s'", inp_fname);
    195193  str_size = *(long *)str_ptr;
    196194  sym_ptr = (const struct nlist *)sym;
    197   sym_count = a_out_h->sym_size / sizeof (struct nlist);
     195  sym_count = a_out_h->a_syms / sizeof (struct nlist);
    198196  if (str_ptr + str_size - inp_buf > size)
    199197    error ("Malformed input file `%s'", inp_fname);
    200198
    201199  for (i = 0; i < sym_count; ++i)
    202     if (sym_ptr[i].type == (N_TEXT|N_EXT) ||
    203         sym_ptr[i].type == (N_DATA|N_EXT) ||
     200    if (sym_ptr[i].n_type == (N_TEXT|N_EXT) ||
     201        sym_ptr[i].n_type == (N_DATA|N_EXT) ||
    204202        (weak_flag &&
    205          (sym_ptr[i].type == N_WEAKT ||
    206           sym_ptr[i].type == N_WEAKD)))
     203         (sym_ptr[i].n_type == N_WEAKT ||
     204          sym_ptr[i].n_type == N_WEAKD)))
    207205      {
    208         name = str_ptr + sym_ptr[i].string;
     206        name = str_ptr + sym_ptr[i].n_un.n_strx;
    209207        export (name);
    210208      }
    211     else if ((sym_ptr[i].type == N_EXT ||
    212               sym_ptr[i].type == (N_BSS|N_EXT) ||
    213               (weak_flag && sym_ptr[i].type == N_WEAKB)) &&
    214              sym_ptr[i].value != 0)
     209    else if ((sym_ptr[i].n_type == N_EXT ||
     210              sym_ptr[i].n_type == (N_BSS|N_EXT) ||
     211              (weak_flag && sym_ptr[i].n_type == N_WEAKB)) &&
     212             sym_ptr[i].n_value != 0)
    215213      {
    216         name = str_ptr + sym_ptr[i].string;
     214        name = str_ptr + sym_ptr[i].n_un.n_strx;
    217215        export_bss (name);
    218216      }
  • trunk/src/emx/src/emxexp/emxexp.smak

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    77.TKIND  := $(TOOLFMT)
    88.TSRC   := $(wildcard src/emxexp/*.c)
     9.TCF    := $(CFLAGS.DEF.VERSION)
    910.TDEP   := @O@omflib$A
    1011.TLDF   := -liberty
  • trunk/src/emx/src/emximp/emximp.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r235 r236  
    3030#include <time.h>
    3131#include <sys/moddef.h>
     32#include <a_out.h>
    3233#include "defs.h"
    3334#include <sys/omflib.h>
    34 
    35 #define VERSION "0.9d"
    36 #include "../../../../include/innotekversion.h"
    3735
    3836#define NORETURN2 __attribute__ ((noreturn))
     
    4139#define MOD_DEF      1
    4240#define MOD_REF      2
    43 
    44 #define N_EXT  0x01
    45 #define N_ABS  0x02
    46 #define N_IMP1 0x68
    47 #define N_IMP2 0x6a
    4841
    4942#define PARMS_REG     (-1)
     
    108101static void usage (void)
    109102{
    110   puts ("emximp " VERSION INNOTEK_VERSION " -- Copyright (c) 1992-1996 by Eberhard Mattes\n");
     103  puts ("emximp " VERSION " -- Copyright (c) 1992-1996 by Eberhard Mattes\n");
    111104  puts ("Usage:");
    112105  puts ("  emximp [-a[<assembler>]] [-b <base_name>|<prefix_length>] "
     
    612605static int aout_text_size;
    613606
    614 static struct reloc aout_treloc_tab[2];
     607static struct relocation_info aout_treloc_tab[2];
    615608static int aout_treloc_count;
    616609
     
    636629  if (aout_sym_count >= sizeof (aout_sym_tab) / sizeof (aout_sym_tab[0]))
    637630    error ("a.out symbol table overflow");
    638   aout_sym_tab[aout_sym_count].string = aout_str_size;
    639   aout_sym_tab[aout_sym_count].type = type;
    640   aout_sym_tab[aout_sym_count].other = other;
    641   aout_sym_tab[aout_sym_count].desc = desc;
    642   aout_sym_tab[aout_sym_count].value = value;
     631  aout_sym_tab[aout_sym_count].n_un.n_strx = aout_str_size;
     632  aout_sym_tab[aout_sym_count].n_type = type;
     633  aout_sym_tab[aout_sym_count].n_other = other;
     634  aout_sym_tab[aout_sym_count].n_desc = desc;
     635  aout_sym_tab[aout_sym_count].n_value = value;
    643636  strcpy (aout_str_tab + aout_str_size, name);
    644637  aout_str_size += len + 1;
     
    667660                         int ext)
    668661{
    669   if (aout_treloc_count >= sizeof (aout_treloc_tab) / sizeof (struct reloc))
     662  if (aout_treloc_count >= sizeof (aout_treloc_tab) / sizeof (struct relocation_info))
    670663    error ("a.out text relocation buffer overflow");
    671   aout_treloc_tab[aout_treloc_count].address = address;
    672   aout_treloc_tab[aout_treloc_count].symbolnum = symbolnum;
    673   aout_treloc_tab[aout_treloc_count].pcrel = pcrel;
    674   aout_treloc_tab[aout_treloc_count].length = length;
    675   aout_treloc_tab[aout_treloc_count].ext = ext;
    676   aout_treloc_tab[aout_treloc_count].unused = 0;
     664  aout_treloc_tab[aout_treloc_count].r_address = address;
     665  aout_treloc_tab[aout_treloc_count].r_symbolnum = symbolnum;
     666  aout_treloc_tab[aout_treloc_count].r_pcrel = pcrel;
     667  aout_treloc_tab[aout_treloc_count].r_length = length;
     668  aout_treloc_tab[aout_treloc_count].r_extern = ext;
     669  aout_treloc_tab[aout_treloc_count].r_pad = 0;
    677670  ++aout_treloc_count;
    678671}
     
    683676  while (aout_text_size & 3)
    684677    aout_text_byte (0x90);
    685   aout_size = (sizeof (struct a_out_header) + aout_text_size
    686                + aout_treloc_count * sizeof (struct reloc)
     678  aout_size = (sizeof (struct exec) + aout_text_size
     679               + aout_treloc_count * sizeof (struct relocation_info)
    687680               + aout_sym_count * sizeof (aout_sym_tab[0])
    688681               + aout_str_size);
     
    692685static void aout_write (void)
    693686{
    694   struct a_out_header ao;
    695 
    696   ao.magic = 0407;
    697   ao.machtype = 0;
    698   ao.flags = 0;
    699   ao.text_size = aout_text_size;
    700   ao.data_size = 0;
    701   ao.bss_size = 0;
    702   ao.sym_size = aout_sym_count * sizeof (aout_sym_tab[0]);
    703   ao.entry = 0;
    704   ao.trsize = aout_treloc_count * sizeof (struct reloc);
    705   ao.drsize = 0;
     687  struct exec ao;
     688
     689  N_SET_MAGIC (ao, OMAGIC);
     690  N_SET_MACHTYPE (ao, 0);
     691  N_SET_FLAGS (ao, 0);
     692  ao.a_text = aout_text_size;
     693  ao.a_data = 0;
     694  ao.a_bss = 0;
     695  ao.a_syms = aout_sym_count * sizeof (aout_sym_tab[0]);
     696  ao.a_entry = 0;
     697  ao.a_trsize = aout_treloc_count * sizeof (struct relocation_info);
     698  ao.a_drsize = 0;
    706699  fwrite (&ao, 1, sizeof (ao), out_file);
    707700  fwrite (aout_text, 1, aout_text_size, out_file);
    708   fwrite (aout_treloc_tab, aout_treloc_count, sizeof (struct reloc), out_file);
     701  fwrite (aout_treloc_tab, aout_treloc_count, sizeof (struct relocation_info), out_file);
    709702  fwrite (aout_sym_tab, aout_sym_count, sizeof (aout_sym_tab[0]), out_file);
    710703  *(dword *)aout_str_tab = aout_str_size;
  • trunk/src/emx/src/emximp/emximp.smak

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    77.TKIND  := $(TOOLFMT)
    88.TSRC   := $(wildcard src/emximp/*.c)
     9.TCF    := $(CFLAGS.DEF.VERSION)
    910.TDEP   := @O@omflib$A @O@moddef$A
    1011include mkexe.smak
  • trunk/src/emx/src/emxload/emxload.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r235 r236  
    3636#define INCL_DOSERRORS
    3737#include <os2.h>
    38 
    39 #define VERSION "0.9d"
    40 #include "../../../../include/innotekversion.h"
    4138
    4239/* ------------------------------ SERVER ------------------------------ */
     
    320317  int i;
    321318  time_t now, stop;
    322 
     319 
    323320  stop = 0;
    324321
     
    751748static void usage (void)
    752749{
    753   fputs ("emxload " VERSION INNOTEK_VERSION " -- "
     750  fputs ("emxload " VERSION " -- "
    754751         "Copyright (c) 1993-1996 by Eberhard Mattes\n\n"
    755752         "Usage: emxload [-m <limit>] [-s <limit>] [-e] [-u[w]]\n"
  • trunk/src/emx/src/emxload/emxload.smak

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    66.TKIND  := $(TOOLFMT)
    77.TSRC   := $(wildcard src/emxload/*.c)
     8.TCF    := $(CFLAGS.DEF.VERSION)
    89include mkexe.smak
  • trunk/src/emx/src/emxomf/emxaout.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    2828#include <sys/param.h>
    2929#include <sys/emxload.h>
     30#include <sys/omflib.h>
    3031#include <ar.h>
     32#include <a_out.h>
    3133
    3234#define GROW_DEF_STATIC(NAME,TYPE) \
     
    4244  (grow_by (&NAME##_grow, 1), NAME##_grow.count++)
    4345
    44 /* The version number of this program.  This is printed with the usage
    45    message. */
    46 
    47 #define VERSION "0.9d"
    48 #include "../../../../include/innotekversion.h"
    49 
    5046/* Insert private header files. */
    5147
     
    150146GROW_DEF_STATIC (extdefs, struct extdef);
    151147GROW_DEF_STATIC (symbols, struct symbol);
    152 GROW_DEF_STATIC (trelocs, struct reloc);
    153 GROW_DEF_STATIC (drelocs, struct reloc);
     148GROW_DEF_STATIC (trelocs, struct relocation_info);
     149GROW_DEF_STATIC (drelocs, struct relocation_info);
    154150
    155151
     
    212208{
    213209  void *p;
    214 
     210 
    215211  p = malloc (n);
    216212  if (p == NULL && n != 0)
     
    227223{
    228224  void *p;
    229 
     225 
    230226  p = realloc (ptr, n);
    231227  if (p == NULL)
     
    242238{
    243239  char *p;
    244 
     240 
    245241  p = xmalloc (strlen (s) + 1);
    246242  strcpy (p, s);
     
    268264static void usage (void)
    269265{
    270   puts ("emxaout " VERSION INNOTEK_VERSION " -- Copyright (c) 1994-1996 by Eberhard Mattes\n");
     266  puts ("emxaout " VERSION " -- Copyright (c) 1994-1996 by Eberhard Mattes\n");
    271267  puts ("Usage:");
    272268  puts ("  emxaout [-u] [-o <output_file>] <input_file>");
     
    706702   ³n   External name
    707703   ³1-2 Type index
    708    À
     704   À 
    709705
    710706   Symbol indices are assigned sequentially by EXTDEF and COMDEF. */
     
    936932    F (bit 7)           1=frame thread, 0=methods F0 through F5
    937933    Frame (bits 4-6)    frame thread number (F=1) or frame method (F=0)
    938     T (bit 3)           1=target thread, 1=methods
     934    T (bit 3)           1=target thread, 1=methods 
    939935    P (bit 2)           Bit 2 of target method
    940936    Targt (bits 0-1)    target thread number (T=1) or target method (T=0) */
     
    945941  int frame_method, frame_index, target_method, target_index;
    946942  dword disp;
    947   struct reloc r;
     943  struct relocation_info r;
    948944  struct thread th;
    949945
     
    958954          fix_data = get_byte ();
    959955          if (first & 0x40)
    960             r.pcrel = 0;
     956            r.r_pcrel = 0;
    961957          else
    962             r.pcrel = 1;
    963           r.address = offset + cur_off;
    964           r.unused = 0;
     958            r.r_pcrel = 1;
     959          r.r_address = offset + cur_off;
     960          r.r_pad = 0;
    965961          locat = (first >> 2) & 0x0f;
    966962          if (fix_data & 0x80)
     
    10151011                  error2 ("FIXUPP: OFFSET-16(LR) fixup not supported");
    10161012                case 9:
    1017                   r.length = 2;
     1013                  r.r_length = 2;
    10181014                  break;
    10191015                case 11:
     
    10281024                {
    10291025                case 0:         /* T0: SEGDEF */
    1030                   r.ext = 0;
     1026                  r.r_extern = 0;
    10311027                  if (target_index == seg_code + 1)
    1032                     r.symbolnum = N_TEXT;
     1028                    r.r_symbolnum = N_TEXT;
    10331029                  else if (target_index == seg_data + 1)
    10341030                    {
    1035                       r.symbolnum = N_DATA;
     1031                      r.r_symbolnum = N_DATA;
    10361032                      disp += (seg_code >= 0 ? segments[seg_code].size : 0);
    10371033                    }
    10381034                  else if (target_index == seg_bss + 1)
    10391035                    {
    1040                       r.symbolnum = N_BSS;
     1036                      r.r_symbolnum = N_BSS;
    10411037                      disp += (seg_code >= 0 ? segments[seg_code].size : 0);
    10421038                      disp += (seg_data >= 0 ? segments[seg_data].size : 0);
     
    10501046                  break;
    10511047                case 2:         /* T2: EXTDEF */
    1052                   r.ext = 1;
     1048                  r.r_extern = 1;
    10531049                  if (target_index < 1 || target_index > GROW_COUNT (extdefs))
    10541050                    error2 ("FIXUPP: EXTDEF index out of range");
    1055                   r.symbolnum = target_index - 1;
     1051                  r.r_symbolnum = target_index - 1;
    10561052                  break;
    10571053                default:
     
    10851081                abort ();
    10861082
    1087               if (r.address + 4 > segments[cur_seg].size)
     1083              if (r.r_address + 4 > segments[cur_seg].size)
    10881084                error2 ("FIXUPP: fixup beyond end of segment");
    1089               *((dword *)(segments[cur_seg].data + r.address))
    1090                 += r.pcrel ? disp - (r.address + 4) : disp;
     1085              *((dword *)(segments[cur_seg].data + r.r_address))
     1086                += r.r_pcrel ? disp - (r.r_address + 4) : disp;
    10911087            }
    10921088        }
     
    11271123  for (i = 0; i < GROW_COUNT (extdefs); ++i)
    11281124    {
    1129       n.type = N_EXT;
    1130       n.string = 0;
    1131       n.value = extdefs[i].size;
    1132       n.other = 0;
    1133       n.desc = 0;
     1125      n.n_type = N_EXT;
     1126      n.n_un.n_strx = 0;
     1127      n.n_value = extdefs[i].size;
     1128      n.n_other = 0;
     1129      n.n_desc = 0;
    11341130      j = GROW_ADD (symbols);
    11351131      symbols[j].name = xstrdup (extdefs[i].name);
     
    11431139        skip = TRUE;
    11441140      else if (pubdefs[i].seg == seg_code + 1)
    1145         n.type = N_TEXT | N_EXT;
     1141        n.n_type = N_TEXT | N_EXT;
    11461142      else if (pubdefs[i].seg == seg_data + 1)
    1147         n.type = N_DATA | N_EXT;
     1143        n.n_type = N_DATA | N_EXT;
    11481144      else
    11491145        skip = TRUE;
    11501146      if (!skip)
    11511147        {
    1152           n.string = 0;
    1153           n.value = pubdefs[i].offset;
    1154           n.other = 0;
    1155           n.desc = 0;
     1148          n.n_un.n_strx = 0;
     1149          n.n_value = pubdefs[i].offset;
     1150          n.n_other = 0;
     1151          n.n_desc = 0;
    11561152          j = GROW_ADD (symbols);
    11571153          symbols[j].name = xstrdup (pubdefs[i].name);
     
    11731169    {
    11741170      if (symbols[i].name == NULL)
    1175         symbols[i].n.string = 0;
     1171        symbols[i].n.n_un.n_strx = 0;
    11761172      else
    11771173        {
    1178           symbols[i].n.string = str_size;
     1174          symbols[i].n.n_un.n_strx = str_size;
    11791175          str_size += strlen (symbols[i].name) + 1;
    11801176        }
     
    11921188static void conv_modend (void)
    11931189{
    1194   struct a_out_header h;
     1190  struct exec h;
    11951191  int i;
    11961192
    11971193  make_symtab ();
    1198   h.magic = 0407;
    1199   h.machtype = 0;
    1200   h.flags = 0;
    1201   h.text_size = (seg_code >= 0 ? segments[seg_code].size : 0);
    1202   h.data_size = (seg_data >= 0 ? segments[seg_data].size : 0);
    1203   h.bss_size =  (seg_bss  >= 0 ? segments[seg_bss ].size : 0);
    1204   h.sym_size = GROW_COUNT (symbols) * sizeof (struct nlist);
    1205   h.entry = 0;
    1206   h.trsize = GROW_COUNT (trelocs) * sizeof (struct reloc);
    1207   h.drsize = GROW_COUNT (drelocs) * sizeof (struct reloc);
     1194  N_SET_MAGIC (h, OMAGIC);
     1195  N_SET_MACHTYPE (h, 0);
     1196  N_SET_FLAGS (h, 0);
     1197  h.a_text = (seg_code >= 0 ? segments[seg_code].size : 0);
     1198  h.a_data = (seg_data >= 0 ? segments[seg_data].size : 0);
     1199  h.a_bss =  (seg_bss  >= 0 ? segments[seg_bss ].size : 0);
     1200  h.a_syms = GROW_COUNT (symbols) * sizeof (struct nlist);
     1201  h.a_entry = 0;
     1202  h.a_trsize = GROW_COUNT (trelocs) * sizeof (struct relocation_info);
     1203  h.a_drsize = GROW_COUNT (drelocs) * sizeof (struct relocation_info);
    12081204  fwrite (&h, sizeof (h), 1, out_file);
    12091205  if (seg_code >= 0)
     
    12121208    fwrite (segments[seg_data].data, segments[seg_data].size, 1, out_file);
    12131209  for (i = 0; i < GROW_COUNT (trelocs); ++i)
    1214     fwrite (&trelocs[i], sizeof (struct reloc), 1, out_file);
     1210    fwrite (&trelocs[i], sizeof (struct relocation_info), 1, out_file);
    12151211  for (i = 0; i < GROW_COUNT (drelocs); ++i)
    1216     fwrite (&drelocs[i], sizeof (struct reloc), 1, out_file);
     1212    fwrite (&drelocs[i], sizeof (struct relocation_info), 1, out_file);
    12171213  write_symtab ();
    12181214}
  • trunk/src/emx/src/emxomf/emxomf.c

    • Property cvs2svn:cvs-rev changed from 1.6 to 1.7
    r235 r236  
    3333#include <ar.h>
    3434
    35 /* The version number of this program.  This is printed with the usage
    36    message. */
    37 
    38 #define VERSION "0.9d"
    39 #include "../../../../include/innotekversion.h"
    40 
    4135/* Insert private header files. */
    4236
     
    168162/* These varibles point to the text and data relocation tables. */
    169163
    170 static const struct reloc *text_rel;
    171 static const struct reloc *data_rel;
     164static const struct relocation_info *text_rel;
     165static const struct relocation_info *data_rel;
    172166
    173167/* Public variables for communication with stabshll.c. */
     
    345339
    346340/* This variable points to the a.out header of the input module. */
    347 static const struct a_out_header *a_out_h;
     341static const struct exec *a_out_h;
    348342
    349343/* This table contains additional information for the a.out symbols.
     
    493487{
    494488  void *p;
    495 
     489 
    496490  p = malloc (n);
    497491  if (p == NULL)
     
    508502{
    509503  void *p;
    510 
     504 
    511505  p = realloc (ptr, n);
    512506  if (p == NULL)
     
    523517{
    524518  char *p;
    525 
     519 
    526520  p = xmalloc (strlen (s) + 1);
    527521  strcpy (p, s);
     
    544538   array pointed to by sym_ptr) is returned.  If the symbol is not
    545539   found, NULL is returned. */
    546 
    547540const struct nlist *find_symbol (const char *name)
    548541{
    549542  int i, j, n, len, t;
    550543  const byte *s;
    551 
     544 
    552545  i = 4; len = strlen (name);
    553546
    554547  /* Search the string table for a matching string. */
    555 
    556548  while (i < str_size)
    557549    {
     
    562554      if (memcmp (name, str_ptr+i, len+1) == 0)
    563555        {
    564 
    565556          /* Search the symbol table for an appropriate entry
    566557             referencing the string. */
    567 
    568558          n = sym_count;
    569559          for (j = 0; j < n; ++j)
    570             if (sym_ptr[j].string == sym_ofs)
     560            if (sym_ptr[j].n_un.n_strx == sym_ofs)
    571561              {
    572                 t = sym_ptr[j].type & ~N_EXT;
     562                t = sym_ptr[j].n_type & ~N_EXT;
    573563                if (t == N_TEXT || t == N_DATA || t == N_BSS
    574                     || (t == 0 && sym_ptr[j].value != 0))
     564                    || (t == 0 && sym_ptr[j].n_value != 0))
    575565                  return sym_ptr+j;
    576566              }
     
    10781068  started = FALSE;
    10791069  for (i = 0; i < sym_count; ++i)
    1080     if (sym_ptr[i].type == (N_INDR|N_EXT))
     1070    if (sym_ptr[i].n_type == (N_INDR|N_EXT))
    10811071      ++i;                      /* Skip immediately following entry */
    1082     else if (sym_ptr[i].type == N_EXT && sym_ptr[i].value == 0)
     1072    else if (sym_ptr[i].n_type == N_EXT && sym_ptr[i].n_value == 0)
    10831073      {
    1084         name = str_ptr + sym_ptr[i].string;
     1074        name = str_ptr + sym_ptr[i].n_un.n_strx;
    10851075        sym_more[i].index = sym_index++;
    10861076        if (memcmp (name, "_16_", 4) == 0)
     
    10881078        add_extdef (&started, name);
    10891079      }
    1090     else if (sym_ptr[i].type == N_WEAKU)
     1080    else if (sym_ptr[i].n_type == N_WEAKU)
    10911081      {
    10921082        if (weak_zero_index == 0)
     
    10961086          }
    10971087        sym_more[i].index = sym_index++;
    1098         add_extdef (&started, str_ptr + sym_ptr[i].string);
     1088        add_extdef (&started, str_ptr + sym_ptr[i].n_un.n_strx);
    10991089      }
    11001090  if (started)
     
    11181108
    11191109  for (i = 0; i < sym_count; ++i)
    1120     if (sym_ptr[i].type == (N_INDR|N_EXT))
     1110    if (sym_ptr[i].n_type == (N_INDR|N_EXT))
    11211111      ++i;                      /* Skip immediately following entry */
    1122     else if (sym_ptr[i].type == N_WEAKU)
     1112    else if (sym_ptr[i].n_type == N_WEAKU)
    11231113      {
    11241114        init_rec (COMENT);
     
    11411131  int i;
    11421132
    1143 #define SETTYPE(t) ((struct nlist *)sym_ptr)[i].type = t
     1133#define SETTYPE(t) ((struct nlist *)sym_ptr)[i].n_type = t
    11441134
    11451135  for (i = 0; i < sym_count; ++i)
    1146     if ((sym_ptr[i].type >= N_WEAKA) && (sym_ptr[i].type <= N_WEAKB))
     1136    if ((sym_ptr[i].n_type >= N_WEAKA) && (sym_ptr[i].n_type <= N_WEAKB))
    11471137      {
    1148         const char *name = str_ptr + sym_ptr[i].string;
     1138        const char *name = str_ptr + sym_ptr[i].n_un.n_strx;
    11491139
    11501140        int public = N_EXT;
     
    11611151
    11621152        /* Now convert it to a normal public symbol */
    1163         switch (sym_ptr[i].type)
     1153        switch (sym_ptr[i].n_type)
    11641154          {
    11651155            case N_WEAKA: SETTYPE (N_ABS  | public); break;
     
    11691159          }
    11701160      }
    1171     else if ((sym_ptr[i].type & N_EXT) && is_weak (str_ptr + sym_ptr[i].string))
     1161    else if ((sym_ptr[i].n_type & N_EXT) && is_weak (str_ptr + sym_ptr[i].n_un.n_strx))
    11721162      {
    11731163         /* Convert a external reference to N_WEAKU */
     
    11921182
    11931183  for (i = 0; i < sym_count - 1; ++i)
    1194     if (sym_ptr[i].type == (N_INDR|N_EXT) && sym_ptr[i+1].type == N_EXT)
     1184    if (sym_ptr[i].n_type == (N_INDR|N_EXT) && sym_ptr[i+1].n_type == N_EXT)
    11951185      {
    11961186        init_rec (ALIAS);
    1197         put_sym (str_ptr + sym_ptr[i].string);
    1198         put_sym (str_ptr + sym_ptr[i+1].string);
     1187        put_sym (str_ptr + sym_ptr[i].n_un.n_strx);
     1188        put_sym (str_ptr + sym_ptr[i+1].n_un.n_strx);
    11991189        write_rec ();
    12001190
    12011191        if (out_lib != NULL)
    12021192          {
    1203             pub_name = str_ptr + sym_ptr[i].string;
     1193            pub_name = str_ptr + sym_ptr[i].n_un.n_strx;
    12041194            if (strip_underscore (pub_name))
    12051195              ++pub_name;
     
    12401230  started = FALSE;
    12411231  for (i = 0; i < sym_count; ++i)
    1242     if ((sym_ptr[i].type & ~N_EXT) == type)
     1232    if ((sym_ptr[i].n_type & ~N_EXT) == type)
    12431233      {
    1244         address = sym_ptr[i].value - start;
     1234        address = sym_ptr[i].n_value - start;
    12451235        if ((address >= 0x10000 || force_big) == big)
    12461236          {
    1247             name = str_ptr + sym_ptr[i].string;
    1248             if ((sym_ptr[i].type & N_EXT)
     1237            name = str_ptr + sym_ptr[i].n_un.n_strx;
     1238            if ((sym_ptr[i].n_type & N_EXT)
    12491239                || (type == N_TEXT && strncmp (name, "___POST$", 8) == 0))
    12501240              {
    1251                 if ((sym_ptr[i].type & N_EXT) && out_lib != NULL)
     1241                if ((sym_ptr[i].n_type & N_EXT) && out_lib != NULL)
    12521242                  {
    12531243                    pub_name = name;
     
    13291319  started = FALSE;
    13301320  for (i = 0; i < sym_count; ++i)
    1331     if (sym_ptr[i].type == (N_INDR|N_EXT))
     1321    if (sym_ptr[i].n_type == (N_INDR|N_EXT))
    13321322      ++i;                      /* Skip immediately following entry */
    1333     else if (sym_ptr[i].type == N_EXT && sym_ptr[i].value != 0)
     1323    else if (sym_ptr[i].n_type == N_EXT && sym_ptr[i].n_value != 0)
    13341324      {
    1335         name = str_ptr + sym_ptr[i].string;
     1325        name = str_ptr + sym_ptr[i].n_un.n_strx;
    13361326        sym_more[i].index = sym_index++;
    13371327        if (memcmp (name, "_16_", 4) == 0)
    13381328          sym_more[i].flags |= SF_FAR16;
    1339         size = sym_ptr[i].value;
     1329        size = sym_ptr[i].n_value;
    13401330        if (started && !fits (strlen (name) + 12))
    13411331          {
     
    13971387    P (bit 0)           USE32 */
    13981388
    1399 static int seg_def (int name_index, int class_index, long size, int stack, int fAlign4B)
     1389static int seg_def (int name_index, int class_index, long size, int stack)
    14001390{
    14011391  byte seg_attr;
    14021392
    1403   seg_attr =  (fAlign4B ? (stack ? 0xb5 : 0xa9) : (stack ? 0x75 : 0x69) );
     1393  seg_attr = (stack ? 0x75 : 0x69);
    14041394  if (size > 0x10000 || force_big)
    14051395    {
     
    14361426  dword a1, a2;
    14371427
    1438   a1 = ((struct reloc *)x1)->address;
    1439   a2 = ((struct reloc *)x2)->address;
     1428  a1 = ((struct relocation_info *)x1)->r_address;
     1429  a2 = ((struct relocation_info *)x2)->r_address;
    14401430  if (a1 < a2)
    14411431    return -1;
     
    14521442   SRC points to the data to be written (will be modified for
    14531443   fixups!), SEG_SIZE is the number of bytes to be written.  REL
    1454    points to the relocation table (an array of struct reloc), REL_SIZE
     1444   points to the relocation table (an array of struct relocation_info), REL_SIZE
    14551445   is the size of the relocation table, in bytes(!).  SST_FLAG is TRUE
    14561446   when writing the symbol segment $$SYMBOLS.  BOUNDARY points to an
     
    15091499    F (bit 7)           1=frame thread, 0=methods F0 through F5
    15101500    Frame (bits 4-6)    frame thread number (F=1) or frame method (F=0)
    1511     T (bit 3)           1=target thread, 1=methods
     1501    T (bit 3)           1=target thread, 1=methods 
    15121502    P (bit 2)           Bit 2 of target method
    15131503    Targt (bits 0-1)    target thread number (T=1) or target method (T=0)  */
    15141504
    15151505static void write_seg (int index, int seg_name, byte *src, long seg_size,
    1516                        const struct reloc *rel, long rel_size, int sst_flag,
     1506                       const struct relocation_info *rel, long rel_size, int sst_flag,
    15171507                       const int *boundary, int boundary_count, int seg_type)
    15181508{
     
    15201510  int i, reloc_count, reloc_idx, target_index, ok, data_off, far16;
    15211511  int boundary_idx, started, *threadp;
    1522   struct reloc *reloc_tab;
    1523   const struct reloc *r;
     1512  struct relocation_info *reloc_tab;
     1513  const struct relocation_info *r;
    15241514  byte locat;
    15251515  dword start_data, start_bss;
     
    15291519  /* Copy and sort the relocation table. */
    15301520
    1531   reloc_count = rel_size / sizeof (struct reloc);
    1532   reloc_tab = xmalloc (reloc_count * sizeof (struct reloc));
    1533   memcpy (reloc_tab, rel, reloc_count * sizeof (struct reloc));
    1534   qsort (reloc_tab, reloc_count, sizeof (struct reloc), reloc_compare);
     1521  reloc_count = rel_size / sizeof (struct relocation_info);
     1522  reloc_tab = xmalloc (reloc_count * sizeof (struct relocation_info));
     1523  memcpy (reloc_tab, rel, reloc_count * sizeof (struct relocation_info));
     1524  qsort (reloc_tab, reloc_count, sizeof (struct relocation_info), reloc_compare);
    15351525
    15361526  /* First pass: apply fixups to data.  Adjust fixup frames for OMF
     
    15451535
    15461536  for (i = 0, r = reloc_tab; i < reloc_count; ++i, ++r)
    1547     if (r->length == 2)
     1537    if (r->r_length == 2)
    15481538      {
    15491539
    15501540        /* Here we have a 32-bit relocation. */
    15511541
    1552         if (r->ext)
     1542        if (r->r_extern)
    15531543          {
    15541544
     
    15571547               address. */
    15581548
    1559             switch (sym_ptr[r->symbolnum].type)
     1549            switch (sym_ptr[r->r_symbolnum].n_type)
    15601550              {
    15611551              case N_EXT:
    15621552              case N_WEAKU:
    1563                 if (r->pcrel)
    1564                   *(dword *)(src + r->address) = 0;
     1553                if (r->r_pcrel)
     1554                  *(dword *)(src + r->r_address) = 0;
    15651555                break;
    15661556              case N_TEXT:
    15671557                break;
    15681558              case N_TEXT|N_EXT:
    1569                 *(dword *)(src + r->address) = 0;
     1559                *(dword *)(src + r->r_address) = 0;
    15701560                break;
    15711561              case N_DATA:
    15721562              case N_DATA|N_EXT:
    1573                 *(dword *)(src + r->address) -= start_data;
     1563                *(dword *)(src + r->r_address) -= start_data;
    15741564                break;
    15751565              case N_BSS:
    15761566              case N_BSS|N_EXT:
    1577                 *(dword *)(src + r->address) -= start_bss;
     1567                *(dword *)(src + r->r_address) -= start_bss;
    15781568                break;
    15791569              default:
    15801570                error ("write_seg: Invalid symbol type (0x%.2x)",
    1581                        sym_ptr[r->symbolnum].type);
     1571                       sym_ptr[r->r_symbolnum].n_type);
    15821572              }
    15831573          }
    1584         else if (!(r->pcrel && (r->symbolnum & ~N_EXT) == seg_type))
     1574        else if (!(r->r_pcrel && (r->r_symbolnum & ~N_EXT) == seg_type))
    15851575          {
    15861576
     
    15891579               relocation table. */
    15901580
    1591             switch (r->symbolnum & ~N_EXT)
     1581            switch (r->r_symbolnum & ~N_EXT)
    15921582              {
    15931583              case N_TEXT:
    15941584                break;
    15951585              case N_DATA:
    1596                 *(dword *)(src + r->address) -= start_data;
     1586                *(dword *)(src + r->r_address) -= start_data;
    15971587                break;
    15981588              case N_BSS:
    1599                 *(dword *)(src + r->address) -= start_bss;
     1589                *(dword *)(src + r->r_address) -= start_bss;
    16001590                break;
    16011591              default:
     
    16281618
    16291619      i = reloc_idx; end = off + n;
    1630       while (i < reloc_count && reloc_tab[i].address < end)
     1620      while (i < reloc_count && reloc_tab[i].r_address < end)
    16311621        ++i;
    16321622      if (i > reloc_idx)
    16331623        {
    16341624          --i;
    1635           tmp = reloc_tab[i].address + (1 << reloc_tab[i].length) - off;
     1625          tmp = reloc_tab[i].r_address + (1 << reloc_tab[i].r_length) - off;
    16361626          if (tmp > n)
    1637             n = reloc_tab[i].address - off;
     1627            n = reloc_tab[i].r_address - off;
    16381628        }
    16391629
     
    16801670         current LEDATA chunk. */
    16811671
    1682       while (reloc_idx < reloc_count && r->address < end)
     1672      while (reloc_idx < reloc_count && r->r_address < end)
    16831673        {
    16841674
     
    16891679             16:16 fixups. */
    16901680
    1691           ok = (r->length == 2 || (sst_flag && r->length == 1));
     1681          ok = (r->r_length == 2 || (sst_flag && r->r_length == 1));
    16921682          far16 = FALSE;
    16931683
    1694           if (r->ext)
     1684          if (r->r_extern)
    16951685            {
    16961686
     
    17001690
    17011691              threadp = NULL;
    1702               if (sym_more[r->symbolnum].flags & SF_FAR16)
     1692              if (sym_more[r->r_symbolnum].flags & SF_FAR16)
    17031693                far16 = TRUE;
    17041694            }
    1705           else if (r->pcrel && (r->symbolnum & ~N_EXT) == seg_type)
     1695          else if (r->r_pcrel && (r->r_symbolnum & ~N_EXT) == seg_type)
    17061696            {
    17071697              ok = FALSE;
     
    17171707                 target_index is the OMF segment index. */
    17181708
    1719               switch (r->symbolnum & ~N_EXT)
     1709              switch (r->r_symbolnum & ~N_EXT)
    17201710                {
    17211711                case N_TEXT:
     
    17821772              /* Compute and write the locat word. */
    17831773
    1784               data_off = r->address - off;
     1774              data_off = r->r_address - off;
    17851775              if (far16)
    17861776                locat = 0x8c;   /* Method 3: 16:16 far pointer */
    1787               else if (sst_flag && r->length == 1)
     1777              else if (sst_flag && r->r_length == 1)
    17881778                locat = 0x88;   /* Method 2: selector */
    17891779              else
    17901780                locat = 0xa4;   /* Method 9: 32-bit offset */
    17911781              locat |= ((data_off >> 8) & 0x03);
    1792               if (!r->pcrel)
     1782              if (!r->r_pcrel)
    17931783                locat |= 0x40;
    17941784              put_8 (locat);
     
    18011791                  /* F=0, FRAME=F2, T=0, P=1, TARGT=T2 */
    18021792                  put_8 (0x26);
    1803                   put_idx (sym_more[r->symbolnum].index);
    1804                   put_idx (sym_more[r->symbolnum].index);
     1793                  put_idx (sym_more[r->r_symbolnum].index);
     1794                  put_idx (sym_more[r->r_symbolnum].index);
    18051795                }
    1806               else if (r->ext)
     1796              else if (r->r_extern)
    18071797                {
    18081798                  /* F=1, FRAME=F1, T=0, P=1, TARGT=T2 */
    18091799                  put_8 (0x86 | (flat_thread << 4));
    1810                   put_idx (sym_more[r->symbolnum].index);
     1800                  put_idx (sym_more[r->r_symbolnum].index);
    18111801                }
    18121802              else
     
    19101900  for (i = 0; i < sym_count; ++i)
    19111901    {
    1912       type = sym_ptr[i].type & ~N_EXT;
    1913       if ((type == N_SETA && sym_ptr[i].value == 0xffffffff)
     1902      type = sym_ptr[i].n_type & ~N_EXT;
     1903      if ((type == N_SETA && sym_ptr[i].n_value == 0xffffffff)
    19141904          || type == N_SETT || type == N_SETD)
    19151905        {
     
    19201910             this set is already known. */
    19211911
    1922           name = str_ptr + sym_ptr[i].string;
     1912          name = str_ptr + sym_ptr[i].n_un.n_strx;
    19231913          for (set_ptr = sets; set_ptr != NULL; set_ptr = set_ptr->next)
    19241914            if (strcmp (set_ptr->name, name) == 0)
     
    19591949              set_ptr->data = xrealloc (set_ptr->data, set_ptr->count * 4);
    19601950              set_ptr->seg = xrealloc (set_ptr->seg, set_ptr->count);
    1961               set_ptr->data[set_ptr->count-1] = sym_ptr[i].value;
     1951              set_ptr->data[set_ptr->count-1] = sym_ptr[i].n_value;
    19621952              set_ptr->seg[set_ptr->count-1]
    19631953                = (type == N_SETT ? N_TEXT : N_DATA);
     
    20102000      set_ptr->seg_index[j] =
    20112001        seg_def (set_ptr->seg_name[j], code_class_name,
    2012                  4 * (j == 1 ? set_ptr->count : set_ptr->def), FALSE, TRUE);
     2002                 4 * (j == 1 ? set_ptr->count : set_ptr->def), FALSE);
    20132003}
    20142004
     
    20942084  int i, max_count;
    20952085  dword *buf;
    2096   struct reloc *reloc_tab;
     2086  struct relocation_info *reloc_tab;
    20972087
    20982088  max_count = 0; buf = NULL; reloc_tab = NULL;
     
    21262116              memset (buf, 0, 4 * max_count);
    21272117              reloc_tab = xrealloc (reloc_tab,
    2128                                     max_count * sizeof (struct reloc));
     2118                                    max_count * sizeof (struct relocation_info));
    21292119            }
    21302120
     
    21352125            {
    21362126              buf[i] = set_ptr->data[i];
    2137               reloc_tab[i].address = i * 4;
    2138               reloc_tab[i].symbolnum = set_ptr->seg[i];
    2139               reloc_tab[i].pcrel = 0;
    2140               reloc_tab[i].length = 2;
    2141               reloc_tab[i].ext = 0;
    2142               reloc_tab[i].unused = 0;
     2127              reloc_tab[i].r_address = i * 4;
     2128              reloc_tab[i].r_symbolnum = set_ptr->seg[i];
     2129              reloc_tab[i].r_pcrel = 0;
     2130              reloc_tab[i].r_length = 2;
     2131              reloc_tab[i].r_extern = 0;
     2132              reloc_tab[i].r_pad = 0;
    21432133            }
    21442134
     
    21472137          write_seg (set_ptr->seg_index[1], set_ptr->seg_name[1],
    21482138                     (byte *)buf, set_ptr->count * 4, reloc_tab,
    2149                      set_ptr->count * sizeof (struct reloc), FALSE, NULL, 0,
     2139                     set_ptr->count * sizeof (struct relocation_info), FALSE, NULL, 0,
    21502140                     -1);
    21512141        }
     
    21682158/* Find a relocation table entry by fixup address. */
    21692159
    2170 static const struct reloc *find_reloc_fixup (const struct reloc *rel,
     2160static const struct relocation_info *find_reloc_fixup (const struct relocation_info *rel,
    21712161                                             long rel_size, dword addr)
    21722162{
    21732163  int i, count;
    21742164
    2175   count = rel_size / sizeof (struct reloc);
     2165  count = rel_size / sizeof (struct relocation_info);
    21762166  for (i = 0; i < count; ++i)
    2177     if (rel[i].address == addr)
     2167    if (rel[i].r_address == addr)
    21782168      return &rel[i];
    21792169  return NULL;
     
    22012191   successful, FALSE on failure. */
    22022192
    2203 static int fetch_modstr (const struct reloc *rel, dword addr,
     2193static int fetch_modstr (const struct relocation_info *rel, dword addr,
    22042194                         char *dst, size_t dst_size)
    22052195{
     
    22082198
    22092199  if (rel == NULL) return FALSE;
    2210   if (rel->ext)
     2200  if (rel->r_extern)
    22112201    {
    22122202      struct modstr *p;
     
    22142204      const char *sym_name;
    22152205      const struct nlist *m_sym = NULL;
    2216       const struct a_out_header *m_ao = NULL;
     2206      const struct exec *m_ao = NULL;
    22172207
    22182208      /* We have to take the string from another module.  First try to
    22192209         get the string from the cache. */
    22202210
    2221       sym_name = str_ptr + sym_ptr[rel->symbolnum].string;
     2211      sym_name = str_ptr + sym_ptr[rel->r_symbolnum].n_un.n_strx;
    22222212      for (p = modstr_cache; p != NULL; p = p->next)
    22232213        if (strcmp (p->symbol, sym_name) == 0)
     
    22532243              if (ferror (inp_file))
    22542244                error ("Cannot read `%s'", inp_fname);
    2255               m_ao = (const struct a_out_header *)buf;
    2256               if (size < sizeof (struct a_out_header) || m_ao->magic != 0407)
     2245              m_ao = (const struct exec *)buf;
     2246              if (size < sizeof (struct exec) || N_MAGIC(*m_ao) != OMAGIC)
    22572247                break;
    2258               t = buf + sizeof (struct a_out_header);
    2259               t += m_ao->text_size; t += m_ao->data_size;
    2260               t += m_ao->trsize; t += m_ao->drsize;
    2261               m_sym = (const struct nlist *)t; t += m_ao->sym_size;
     2248              t = buf + sizeof (struct exec);
     2249              t += m_ao->a_text; t += m_ao->a_data;
     2250              t += m_ao->a_trsize; t += m_ao->a_drsize;
     2251              m_sym = (const struct nlist *)t; t += m_ao->a_syms;
    22622252              m_str = t;
    22632253              if (m_str + 4 - buf > size)
    22642254                break;
    22652255              m_str_size = *(long *)m_str;
    2266               m_sym_count = m_ao->sym_size / sizeof (struct nlist);
     2256              m_sym_count = m_ao->a_syms / sizeof (struct nlist);
    22672257              if (m_str + m_str_size - buf > size)
    22682258                break;
    22692259              for (i = 0; i < m_sym_count; ++i)
    2270                 switch (m_sym[i].type)
     2260                switch (m_sym[i].n_type)
    22712261                  {
    22722262                  case N_TEXT|N_EXT:
    22732263                  case N_DATA|N_EXT:
    2274                     if (strcmp (m_str + m_sym[i].string, sym_name) == 0)
     2264                    if (strcmp (m_str + m_sym[i].n_un.n_strx, sym_name) == 0)
    22752265                      {
    22762266                        m_sym += i; found = TRUE; break;
     
    22832273            error ("Symbol `%s' not found", sym_name);
    22842274
    2285           addr = m_sym->value;
    2286           switch (m_sym->type)
     2275          addr = m_sym->n_value;
     2276          switch (m_sym->n_type)
    22872277            {
    22882278            case N_TEXT|N_EXT:
    2289               seg_ptr = buf + sizeof (struct a_out_header);
    2290               seg_size = m_ao->text_size;
     2279              seg_ptr = buf + sizeof (struct exec);
     2280              seg_size = m_ao->a_text;
    22912281              break;
    22922282            case N_DATA|N_EXT:
    2293               seg_ptr = buf + sizeof (struct a_out_header) + m_ao->text_size;
    2294               seg_size = m_ao->data_size;
     2283              seg_ptr = buf + sizeof (struct exec) + m_ao->a_text;
     2284              seg_size = m_ao->a_data;
    22952285              break;
    22962286            default:
     
    23252315      dword si;
    23262316
    2327       switch (rel->symbolnum)
     2317      switch (rel->r_symbolnum)
    23282318        {
    23292319        case N_TEXT:
     
    24022392  name1 = NULL; name2 = NULL;
    24032393  for (i = 0; i < sym_count; ++i)
    2404     switch (sym_ptr[i].type)
     2394    switch (sym_ptr[i].n_type)
    24052395      {
    24062396      case N_IMP1|N_EXT:
    2407         name1 = str_ptr + sym_ptr[i].string;
     2397        name1 = str_ptr + sym_ptr[i].n_un.n_strx;
    24082398        break;
    24092399      case N_IMP2|N_EXT:
    2410         name2 = str_ptr + sym_ptr[i].string;
     2400        name2 = str_ptr + sym_ptr[i].n_un.n_strx;
    24112401        break;
    24122402      default:
     
    24732463  long table_off, ord, off;
    24742464  long *table;
    2475   const struct reloc *rel;
     2465  const struct relocation_info *rel;
    24762466
    24772467  /* There must be exactly one public symbol (which must defined for
     
    24812471  pub_name = NULL; table_off = -1;
    24822472  for (i = 0; i < sym_count; ++i)
    2483     switch (sym_ptr[i].type)
     2473    switch (sym_ptr[i].n_type)
    24842474      {
    24852475      case N_TEXT|N_EXT:
    24862476        if (pub_name != NULL) return FALSE;
    2487         pub_name = str_ptr + sym_ptr[i].string;
     2477        pub_name = str_ptr + sym_ptr[i].n_un.n_strx;
    24882478        break;
    24892479
     
    24932483
    24942484      case N_SETT|N_EXT:
    2495         if (strcmp (str_ptr + sym_ptr[i].string, "__os2dll") != 0)
     2485        if (strcmp (str_ptr + sym_ptr[i].n_un.n_strx, "__os2dll") != 0)
    24962486          return FALSE;
    2497         table_off = sym_ptr[i].value;
     2487        table_off = sym_ptr[i].n_value;
    24982488        break;
    24992489      }
     
    25162506      /* Check and fetch the procedure name. */
    25172507
    2518       rel = find_reloc_fixup (text_rel, a_out_h->trsize, table_off + 3 * 4);
     2508      rel = find_reloc_fixup (text_rel, a_out_h->a_trsize, table_off + 3 * 4);
    25192509      if (!fetch_modstr (rel, table[3], proc_name, sizeof (proc_name)))
    25202510        error ("Invalid import table: invalid pointer to procedure name");
     
    25392529  /* Check and fetch the module name. */
    25402530
    2541   rel = find_reloc_fixup (text_rel, a_out_h->trsize, table_off + 2 * 4);
     2531  rel = find_reloc_fixup (text_rel, a_out_h->a_trsize, table_off + 2 * 4);
    25422532  if (!fetch_modstr (rel, table[2], dll_name, sizeof (dll_name)))
    25432533    error ("Invalid import table: invalid pointer to module name");
     
    25742564  ok = FALSE;
    25752565  for (i = 0; i < sym_count; ++i)
    2576     if (sym_ptr[i].type == N_SO)
     2566    if (sym_ptr[i].n_type == N_SO)
    25772567      {
    2578         p1 = str_ptr + sym_ptr[i].string;
     2568        p1 = str_ptr + sym_ptr[i].n_un.n_strx;
    25792569        len = strlen (p1);
    25802570        if (len > 0 && p1[len-1] != '/')
     
    27102700
    27112701  for (i = 0; i < sym_count; ++i)
    2712     switch (sym_ptr[i].type)
     2702    switch (sym_ptr[i].n_type)
    27132703      {
    27142704      case N_SOL:
    2715         file_index = file_find (str_ptr + sym_ptr[i].string);
     2705        file_index = file_find (str_ptr + sym_ptr[i].n_un.n_strx);
    27162706        break;
    27172707      case N_SLINE:
    27182708        grow_by (&line_grow, 1);
    27192709        line_list[line_grow.count].file_index = file_index;
    2720         line_list[line_grow.count].line = sym_ptr[i].desc;
    2721         line_list[line_grow.count].addr = sym_ptr[i].value;
     2710        line_list[line_grow.count].line = sym_ptr[i].n_desc;
     2711        line_list[line_grow.count].addr = sym_ptr[i].n_value;
    27222712        ++line_grow.count;
    27232713      }
     
    28412831
    28422832  for (i = 0; i < sym_count; ++i)
    2843     switch (sym_ptr[i].type)
     2833    switch (sym_ptr[i].n_type)
    28442834      {
    28452835      case 0:       case 0     |N_EXT:
     
    28742864      default:
    28752865        fprintf (stderr, "Unknown symbol table entry: 0x%.2x \"%s\"\n",
    2876                  sym_ptr[i].type, str_ptr + sym_ptr[i].string);
     2866                 sym_ptr[i].n_type, str_ptr + sym_ptr[i].n_un.n_strx);
    28772867        break;
    28782868      }
     
    28992889     memory. */
    29002890
    2901   a_out_h = (struct a_out_header *)inp_buf;
    2902   if (size < sizeof (struct a_out_header) || a_out_h->magic != 0407)
     2891  a_out_h = (struct exec *)inp_buf;
     2892  if (size < sizeof (struct exec) || N_MAGIC(*a_out_h) != OMAGIC)
    29032893    error ("Input file `%s' is not an a.out file", error_fname);
    2904   text_size = a_out_h->text_size;
    2905   data_size = a_out_h->data_size;
    2906   t = inp_buf + sizeof (struct a_out_header);
     2894  text_size = a_out_h->a_text;
     2895  data_size = a_out_h->a_data;
     2896  t = inp_buf + sizeof (struct exec);
    29072897  text_ptr = t; t += text_size;
    29082898  data_ptr = t; t += data_size;
    2909   text_rel = (const struct reloc *)t; t += a_out_h->trsize;
    2910   data_rel = (const struct reloc *)t; t += a_out_h->drsize;
    2911   sym_ptr = (const struct nlist *)t; t += a_out_h->sym_size;
     2899  text_rel = (const struct relocation_info *)t; t += a_out_h->a_trsize;
     2900  data_rel = (const struct relocation_info *)t; t += a_out_h->a_drsize;
     2901  sym_ptr = (const struct nlist *)t; t += a_out_h->a_syms;
    29122902  str_ptr = t;
    2913   if (a_out_h->sym_size == 0)
     2903  if (a_out_h->a_syms == 0)
    29142904    str_size = 0;
    29152905  else
     
    29192909      str_size = *(long *)str_ptr;
    29202910    }
    2921   sym_count = a_out_h->sym_size / sizeof (struct nlist);
     2911  sym_count = a_out_h->a_syms / sizeof (struct nlist);
    29222912  if (str_ptr + str_size - inp_buf > size)
    29232913    goto invalid;
     
    29442934      if (entry_symbol == NULL)
    29452935        error ("Entry symbol not found");
    2946       if ((entry_symbol->type & ~N_EXT) != N_TEXT)
     2936      if ((entry_symbol->n_type & ~N_EXT) != N_TEXT)
    29472937        error ("Entry symbol not in text segment");
    29482938    }
     
    30283018
    30293019  text_index = seg_def (text_seg_name, code_class_name, text_size,
    3030                         FALSE, FALSE);
     3020                        FALSE);
    30313021  write_set_segs ();
    30323022
    30333023  if (udat_seg_string != NULL)
    30343024    udat_index = seg_def (udat_seg_name, data_class_name, data_size,
    3035                           FALSE, FALSE);
     3025                          FALSE);
    30363026  data_index = seg_def (data_seg_name, data_class_name,
    30373027                        (udat_seg_string == NULL ? data_size : 0),
    3038                         FALSE, FALSE);
     3028                        FALSE);
    30393029  if (udat_seg_string == NULL)
    30403030    udat_index = data_index;
    30413031
    3042   bss_index = seg_def (bss_seg_name, bss_class_name, a_out_h->bss_size,
    3043                        FALSE, FALSE);
     3032  bss_index = seg_def (bss_seg_name, bss_class_name, a_out_h->a_bss,
     3033                       FALSE);
    30443034
    30453035  if (mod_type == MT_MAIN)
    3046     stack_index = seg_def (stack_seg_name, stack_class_name, 0x8000, TRUE, FALSE);
     3036    stack_index = seg_def (stack_seg_name, stack_class_name, 0x8000, TRUE);
    30473037
    30483038  if (!strip_symbols)
     
    30503040      convert_debug ();         /* After seg_def of text, data & bss */
    30513041      symbols_index = seg_def (symbols_seg_name, debsym_class_name,
    3052                                sst.size, FALSE, FALSE);
     3042                               sst.size, FALSE);
    30533043      types_index = seg_def (types_seg_name, debtyp_class_name,
    3054                              tt.size, FALSE, FALSE);
     3044                             tt.size, FALSE);
    30553045    }
    30563046
     
    30953085
    30963086  write_seg (text_index, text_seg_name, text_ptr, text_size,
    3097              text_rel, a_out_h->trsize, FALSE, NULL, 0, N_TEXT);
     3087             text_rel, a_out_h->a_trsize, FALSE, NULL, 0, N_TEXT);
    30983088  write_seg (udat_index, udat_seg_name, data_ptr, data_size,
    3099              data_rel, a_out_h->drsize, FALSE, NULL, 0, N_DATA);
     3089             data_rel, a_out_h->a_drsize, FALSE, NULL, 0, N_DATA);
    31003090
    31013091  write_set_data ();
     
    31063096                 tt_boundary, tt_boundary_grow.count, -1);
    31073097      write_seg (symbols_index, symbols_seg_name, sst.buf, sst.size,
    3108                  (const struct reloc *)sst_reloc.buf, sst_reloc.size, TRUE,
     3098                 (const struct relocation_info *)sst_reloc.buf, sst_reloc.size, TRUE,
    31093099                 sst_boundary, sst_boundary_grow.count, -1);
    31103100      write_linnum ();
     
    31193109      put_8 (0x50);             /* ENDDAT: F5, T0 */
    31203110      put_idx (text_index);
    3121       put_32 (entry_symbol->value);
     3111      put_32 (entry_symbol->n_value);
    31223112    }
    31233113  else
     
    31493139static void usage (void)
    31503140{
    3151   puts ("emxomf " VERSION INNOTEK_VERSION " -- Copyright (c) 1992-1995 by Eberhard Mattes\n");
     3141  puts ("emxomf " VERSION " -- Copyright (c) 1992-1995 by Eberhard Mattes\n");
    31523142  puts ("Usage:");
    31533143  puts ("  emxomf [-dgqs] [-l[<symbol>]] [-m <symbol>] [-p <page_size>]");
     
    33993389                }
    34003390            }
    3401 
     3391         
    34023392          /* Ignore the __.SYMDEF and __.IMPORT members.  Ignore
    34033393             import modules unless creating a library file. */
  • trunk/src/emx/src/emxomf/emxomf.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    1919Boston, MA 02111-1307, USA.  */
    2020
     21
     22#include "a_out.h"
     23#include "a_out_stab.h"
    2124
    2225/* These functions are defined in emxomf.c. */
  • trunk/src/emx/src/emxomf/emxomf.smak

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r235 r236  
    77.TKIND  := $(TOOLFMT)
    88.TSRC   := $(addprefix src/emxomf/,emxomf.c stabshll.c grow.c)
     9.TCF    := $(CFLAGS.DEF.VERSION)
    910.TDEP   := @O@omflib$A
    1011include mkexe.smak
     
    1314.TKIND  := $(TOOLFMT)
    1415.TSRC   := src/emxomf/emxomfar.c
     16.TCF    := $(CFLAGS.DEF.VERSION)
    1517.TDEP   := @O@omflib$A
    1618include mkexe.smak
     
    1921.TKIND  := $(TOOLFMT)
    2022.TSRC   := src/emxomf/emxomfld.c
    21 .TDEP   := @O@moddef$A
     23.TCF    := $(CFLAGS.DEF.VERSION)
     24.TDEP   := @O@moddef$A @O@os2$A
    2225include mkexe.smak
    2326
     
    2528.TKIND  := $(TOOLFMT)
    2629.TSRC   := $(addprefix src/emxomf/,emxaout.c grow.c)
     30.TCF    := $(CFLAGS.DEF.VERSION)
    2731include mkexe.smak
    2832
     
    3034.TKIND  := $(TOOLFMT)
    3135.TSRC   := src/emxomf/listomf.c
     36.TCF    := $(CFLAGS.DEF.VERSION)
    3237include mkexe.smak
  • trunk/src/emx/src/emxomf/emxomfar.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    2424#include <string.h>
    2525#include <io.h>
    26 
    27 #define VERSION "0.9d"
    28 #include "../../../../include/innotekversion.h"
    29 
    30 typedef unsigned char byte;
    31 typedef unsigned short word;
    32 
    3326#include <sys/omflib.h>
    3427
     
    6255static void usage (void)
    6356{
    64   fprintf (stderr, "emxomfar " VERSION INNOTEK_VERSION " -- "
     57  fprintf (stderr, "emxomfar " VERSION " -- "
    6558           "Copyright (c) 1992-1996 by Eberhard Mattes\n\n");
    6659  fprintf (stderr, "Usage: emxomfar [-p#] <command> <library_file> [<module>]...\n");
  • trunk/src/emx/src/emxomf/emxomfld.c

    • Property cvs2svn:cvs-rev changed from 1.7 to 1.8
    r235 r236  
    3636#include "defs.h"
    3737
    38 #define VERSION "0.9d"
    39 #include "../../../../include/innotekversion.h"
    40 
    4138#define FALSE 0
    4239#define TRUE  1
     
    158155static void usage (void)
    159156{
    160   fprintf (stderr, "emxomfld " VERSION INNOTEK_VERSION " -- "
     157  fprintf (stderr, "emxomfld " VERSION " -- "
    161158           "Copyright (c) 1992-1996 by Eberhard Mattes\n\n");
    162159  fprintf (stderr,
  • trunk/src/emx/src/emxomf/listomf.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    2727#endif /* __EMX__ */
    2828#include <getopt.h>
     29#include <sys/omflib.h>
    2930#include "defs.h"
    30 
    31 #define VERSION "0.9d"
    32 #include "../../../../include/innotekversion.h"
    3331
    3432#pragma pack(1)
     
    23392337static void usage (void)
    23402338{
    2341   fputs ("listomf " VERSION INNOTEK_VERSION " -- "
     2339  fputs ("listomf " VERSION " -- "
    23422340         "Copyright (c) 1993-1996 by Eberhard Mattes\n\n"
    23432341         "Usage: listomf [-a] [-d] <input_file>\n\n"
  • trunk/src/emx/src/emxomf/stabshll.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    515515                        int sym_seg, int ext)
    516516{
    517   struct reloc r;
     517  struct relocation_info r;
    518518
    519519  sst_start (SST_static);
    520   r.address = sst.size;
     520  r.r_address = sst.size;
    521521  buffer_dword (&sst, addr);      /* Segment offset */
    522522  buffer_word (&sst, 0);          /* Segment address */
     
    524524  buffer_nstr (&sst, name);       /* Symbol name */
    525525  sst_end ();
    526   r.ext = ext;
    527   r.length = 2;
    528   r.symbolnum = sym_seg;
    529   r.pcrel = 0;
    530   r.unused = 0;
     526  r.r_extern = ext;
     527  r.r_length = 2;
     528  r.r_symbolnum = sym_seg;
     529  r.r_pcrel = 0;
     530  r.r_pad = 0;
    531531  buffer_mem (&sst_reloc, &r, sizeof (r));
    532   r.address += 4;
    533   r.length = 1;
     532  r.r_address += 4;
     533  r.r_length = 1;
    534534  buffer_mem (&sst_reloc, &r, sizeof (r));
    535535}
     
    772772
    773773
    774 #if defined (DEBUG)
     774#if defined (HLL_DEBUG)
    775775
    776776/* This function is used to print an internal type for debugging. */
     
    819819      printf ("(");
    820820      show_type (tp->d.array.etype);
    821       printf ("[%d]", tp->d.array.last + 1 - tp->d.array.first);
     821      printf ("[%ld]", tp->d.array.last + 1 - tp->d.array.first);
    822822      break;
    823823    case ty_bits:
     
    23392339  for (i = *index; i < sym_count; ++i)
    23402340    {
    2341       p = str_ptr + sym_ptr[i].string;
     2341      p = str_ptr + sym_ptr[i].n_un.n_strx;
    23422342      n = strlen (p);
    23432343      if (n > 0 && p[n-1] == '\\')
     
    23512351  if (i == *index)
    23522352    {
    2353       *str = str_ptr + sym_ptr[i].string;
     2353      *str = str_ptr + sym_ptr[i].n_un.n_strx;
    23542354      return FALSE;
    23552355    }
     
    23602360      for (i = *index; i < sym_count; ++i)
    23612361        {
    2362           p = str_ptr + sym_ptr[i].string;
     2362          p = str_ptr + sym_ptr[i].n_un.n_strx;
    23632363          n = strlen (p);
    23642364          if (n > 0 && p[n-1] == '\\')
     
    24012401      memcpy (name, str, n);
    24022402      name[n] = 0;
    2403 #if defined (DEBUG)
     2403#if defined (HLL_DEBUG)
    24042404      printf ("LSYM/LCSYM/GSYM/PSYM/RSYM/STSYM/FUN %s\n", str);
    24052405#endif
     
    24212421            ++parse_ptr;        /* synonymous type */
    24222422          t = parse_complete_type (name);
    2423 #if defined (DEBUG)
     2423#if defined (HLL_DEBUG)
    24242424          printf ("  type: ");
    24252425          show_type (t);
     
    24352435          ++parse_ptr;
    24362436          t = parse_complete_type (name);
    2437 #if defined (DEBUG)
     2437#if defined (HLL_DEBUG)
    24382438          printf ("  type: ");
    24392439          show_type (t);
     
    24452445        case '5': case '6': case '7': case '8': case '9':
    24462446          t = parse_complete_type (name);
    2447 #if defined (DEBUG)
     2447#if defined (HLL_DEBUG)
    24482448          printf ("  type: ");
    24492449          show_type (t);
     
    24642464{
    24652465  size_t ptr;
    2466   struct reloc r;
     2466  struct relocation_info r;
    24672467
    24682468  sst_start (SST_begin);
    2469   r.address = sst.size;
     2469  r.r_address = sst.size;
    24702470  ptr = sst.size;
    24712471  buffer_dword (&sst, addr);    /* Segment offset */
     
    24762476  sst_end ();
    24772477
    2478   r.ext = 0;
    2479   r.length = 2;
    2480   r.symbolnum = N_TEXT;
    2481   r.pcrel = 0;
    2482   r.unused = 0;
     2478  r.r_extern = 0;
     2479  r.r_length = 2;
     2480  r.r_symbolnum = N_TEXT;
     2481  r.r_pcrel = 0;
     2482  r.r_pad = 0;
    24832483  buffer_mem (&sst_reloc, &r, sizeof (r));
    24842484  return ptr;
     
    25222522  const char *p;
    25232523
    2524   if (s->type != N_FUN)
     2524  if (s->n_type != N_FUN)
    25252525    return FALSE;
    2526   p = strchr (str_ptr + s->string, ':');
     2526  p = strchr (str_ptr + s->n_un.n_strx, ':');
    25272527  if (p == NULL)
    25282528    return FALSE;
     
    25672567      if (is_fun (&sym_ptr[i]))
    25682568        {
    2569           addr = sym_ptr[i].value;
     2569          addr = sym_ptr[i].n_value;
    25702570          break;
    25712571        }
     
    25972597      --block_grow.count;
    25982598      hll_end (block_stack[block_grow.count].patch_ptr, 0,
    2599                sym_ptr[i].value - block_stack[block_grow.count].addr);
     2599               sym_ptr[i].n_value - block_stack[block_grow.count].addr);
    26002600      if (block_grow.count == 0 && proc_patch_base != 0)
    26012601        fun_end (i);
     
    26132613{
    26142614  struct type t, *t1, *t2;
    2615   struct reloc r;
     2615  struct relocation_info r;
    26162616  const char *str, *p;
    26172617  char *name;
    26182618  int n, ti;
    26192619
    2620   str = str_ptr + symbol->string;
     2620  str = str_ptr + symbol->n_un.n_strx;
    26212621  p = strchr (str, ':');
    26222622  if (p == NULL)
     
    26272627  name[n] = 0;
    26282628
    2629   proc_start_addr = symbol->value;
     2629  proc_start_addr = symbol->n_value;
    26302630
    26312631  if (args_grow.count == 0)
     
    26462646  make_type (t2, &ti);
    26472647  sst_start (cplusplus_flag ? SST_CPPproc : SST_proc);
    2648   r.address = sst.size;
    2649   buffer_dword (&sst, symbol->value); /* Segment offset */
     2648  r.r_address = sst.size;
     2649  buffer_dword (&sst, symbol->n_value); /* Segment offset */
    26502650  buffer_word (&sst, ti);       /* Type index */
    26512651  proc_patch_base = sst.size;
     
    26602660    buffer_nstr (&sst, name);   /* Proc name */
    26612661  sst_end ();
    2662   r.ext = 0;
    2663   r.length = 2;
    2664   r.symbolnum = N_TEXT;
    2665   r.pcrel = 0;
    2666   r.unused = 0;
     2662  r.r_extern = 0;
     2663  r.r_length = 2;
     2664  r.r_symbolnum = N_TEXT;
     2665  r.r_pcrel = 0;
     2666  r.r_pad = 0;
    26672667  buffer_mem (&sst_reloc, &r, sizeof (r));
    26682668}
     
    26772677  lbrac_index = -1;
    26782678  for (; i < sym_count; ++i)
    2679     if (sym_ptr[i].type == N_RBRAC || is_fun (&sym_ptr[i]))
     2679    if (sym_ptr[i].n_type == N_RBRAC || is_fun (&sym_ptr[i]))
    26802680      return;
    2681     else if (sym_ptr[i].type == N_LBRAC)
     2681    else if (sym_ptr[i].n_type == N_LBRAC)
    26822682      {
    26832683        lbrac_index = i;
    2684         block_begin (sym_ptr[i].value);
     2684        block_begin (sym_ptr[i].n_value);
    26852685        return;
    26862686      }
     
    27152715      memcpy (name, str, n);
    27162716      name[n] = 0;
    2717 #if defined (DEBUG)
     2717#if defined (HLL_DEBUG)
    27182718      printf ("%s %s\n", msg, str);
    27192719#endif
     
    27272727          ++parse_ptr;
    27282728          ti = hll_type ();
    2729 #if defined (DEBUG)
     2729#if defined (HLL_DEBUG)
    27302730          printf ("  type=%#x\n", ti);
    27312731#endif
     
    27362736              return;
    27372737            }
    2738           if (sym2->type == N_EXT)
     2738          if (sym2->n_type == N_EXT)
    27392739            sst_static (name, 0, ti, sym2 - sym_ptr, 1);
    27402740          else
    2741             sst_static (name, sym2->value, ti, sym2->type, 0);
     2741            sst_static (name, sym2->n_value, ti, sym2->n_type, 0);
    27422742          break;
    27432743
     
    27552755          ++parse_ptr;
    27562756          ti = hll_type ();
    2757 #if defined (DEBUG)
     2757#if defined (HLL_DEBUG)
    27582758          printf ("  type=%#x\n", ti);
    27592759#endif
    2760           sst_static (name, symbol->value, ti, where, 0);
     2760          sst_static (name, symbol->n_value, ti, where, 0);
    27612761          break;
    27622762
     
    27742774            {
    27752775              ti = hll_type ();
    2776 #if defined (DEBUG)
     2776#if defined (HLL_DEBUG)
    27772777              printf ("  type=%#x\n", ti);
    27782778#endif
    27792779              sst_start (SST_auto);
    2780               buffer_dword (&sst, symbol->value);  /* Offset into stk frame */
     2780              buffer_dword (&sst, symbol->n_value);/* Offset into stk frame */
    27812781              buffer_word (&sst, ti);              /* Type index */
    27822782              buffer_nstr (&sst, name);            /* Symbol name */
     
    28022802          ++parse_ptr;
    28032803          ti = hll_type ();
    2804           switch (symbol->value)
     2804          switch (symbol->n_value)
    28052805            {
    28062806            case 0:             /* EAX */
     
    28532853              break;
    28542854            default:
    2855               warning ("unknown register %lu", symbol->value);
     2855              warning ("unknown register %lu", symbol->n_value);
    28562856              return;
    28572857            }
     
    28742874            }
    28752875          ti = hll_type ();
    2876 #if defined (DEBUG)
     2876#if defined (HLL_DEBUG)
    28772877          printf ("  type=%#x\n", ti);
    28782878#endif
    28792879          sst_start (SST_auto);
    2880           buffer_dword (&sst, symbol->value);    /* Offset into stk frame */
     2880          buffer_dword (&sst, symbol->n_value);  /* Offset into stk frame */
    28812881          buffer_word (&sst, ti);                /* Type index */
    28822882          buffer_nstr (&sst, name);              /* Symbol name */
     
    29062906          last_fun_valid = TRUE;
    29072907          args_grow.count = 0;
    2908           last_fun_addr = symbol->value;
     2908          last_fun_addr = symbol->n_value;
    29092909          prologue_length = -1;
    29102910
    2911           for (i = *index + 1; i < sym_count && sym_ptr[i].type == N_PSYM; ++i)
     2911          for (i = *index + 1; i < sym_count && sym_ptr[i].n_type == N_PSYM; ++i)
    29122912            parse_symbol (&i, -1, "PSYM", FALSE);
    29132913
     
    29202920            {
    29212921              if (prologue_length == -1)
    2922                 prologue_length = sym_ptr[lbrac_index].value - last_fun_addr;
     2922                prologue_length = sym_ptr[lbrac_index].n_value - last_fun_addr;
    29232923            }
    29242924
    29252925          /* Parameters */
    29262926
    2927           while (*index + 1 < sym_count && sym_ptr[*index+1].type == N_PSYM)
     2927          while (*index + 1 < sym_count && sym_ptr[*index+1].n_type == N_PSYM)
    29282928            {
    29292929              ++(*index);
     
    29992999static void write_changseg (void)
    30003000{
    3001   struct reloc r;
     3001  struct relocation_info r;
    30023002
    30033003  sst_start (SST_changseg);
    3004   r.address = sst.size;
     3004  r.r_address = sst.size;
    30053005  buffer_word (&sst, 0);        /* Segment number */
    30063006  buffer_word (&sst, 0);        /* Reserved */
    30073007  sst_end ();
    3008   r.ext = 0;
    3009   r.length = 1;
    3010   r.symbolnum = N_TEXT;
    3011   r.pcrel = 0;
    3012   r.unused = 0;
     3008  r.r_extern = 0;
     3009  r.r_length = 1;
     3010  r.r_symbolnum = N_TEXT;
     3011  r.r_pcrel = 0;
     3012  r.r_pad = 0;
    30133013  buffer_mem (&sst_reloc, &r, sizeof (r));
    30143014}
     
    30393039
    30403040  for (i = 0; i < sym_count; ++i)
    3041     switch (sym_ptr[i].type)
     3041    switch (sym_ptr[i].n_type)
    30423042      {
    30433043      case N_LSYM:
     
    30643064  lbrac_index = -1; block_grow.count = 0; proc_patch_base = 0;
    30653065  for (i = 0; i < sym_count; ++i)
    3066     switch (sym_ptr[i].type)
     3066    switch (sym_ptr[i].n_type)
    30673067      {
    30683068      case N_LSYM:
     
    30883088      case N_LBRAC:
    30893089        if (lbrac_index == -1)  /* N_LBRAC without local symbols */
    3090           block_begin (sym_ptr[i].value);
     3090          block_begin (sym_ptr[i].n_value);
    30913091        else if (i != lbrac_index)
    30923092          warning ("Invalid N_LBRAC");
  • trunk/src/emx/src/emxstack/emxstack.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    2828#include "defs.h"
    2929
    30 #define VERSION "0.9d"
    31 #include "../../../../include/innotekversion.h"
    32 
    3330/* How to open a file.  This type is used for my_open(). */
    3431
     
    222219static void usage (void)
    223220{
    224   fputs ("emxstack " VERSION INNOTEK_VERSION " -- "
     221  fputs ("emxstack " VERSION " -- "
    225222         "Copyright (c) 1994-1995 by Eberhard Mattes\n\n", stderr);
    226223  fputs ("Usage: emxstack <command> [<options>] <file>...\n", stderr);
     
    553550  new_stack_size = ROUND_PAGE (n * 1024);
    554551}
    555 
     552 
    556553
    557554/* The main function of emxstack. */
  • trunk/src/emx/src/emxstack/emxstack.smak

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    66.TKIND  := $(TOOLFMT)
    77.TSRC   := $(wildcard src/emxstack/*.c)
     8.TCF    := $(CFLAGS.DEF.VERSION)
    89include mkexe.smak
  • trunk/src/emx/src/emxtsf/emxtsf.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    2626#include <sys/moddef.h>
    2727
    28 /* The version number of this program.  This is printed with the usage
    29    message. */
    30 
    31 #define VERSION "0.9d"
    32 #include "../../../../include/innotekversion.h"
    33 
    3428
    3529struct sym
     
    6256static void usage (void)
    6357{
    64   fputs ("emxtsf " VERSION INNOTEK_VERSION " -- Copyright (c) 1996 by Eberhard Mattes\n\n"
     58  fputs ("emxtsf " VERSION " -- Copyright (c) 1996 by Eberhard Mattes\n\n"
    6559         "Usage: emxtsf [-d <dll_name>] [-w <level>] <tss_file> <map_file> <def_file>\n",
    6660         stderr);
  • trunk/src/emx/src/emxtsf/emxtsf.smak

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    77.TKIND  := $(TOOLFMT)
    88.TSRC   := $(wildcard src/emxtsf/*.c)
     9.TCF    := $(CFLAGS.DEF.VERSION)
    910.TLDF   := -lmoddef
    1011include mkexe.smak
  • trunk/src/emx/src/include/defs.h

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    3535#define DATASEG_MAGIC   0xba0bab
    3636
    37 
    38 /* Stabs constants. */
    39 
    40 #define N_EXT           0x01    /* Symbol is external */
    41 #define N_ABS           0x02    /* Absolute address */
    42 #define N_TEXT          0x04    /* In .text segment */
    43 #define N_DATA          0x06    /* In .data segment */
    44 #define N_BSS           0x08    /* In .bss segment */
    45 
    46 #define N_INDR          0x0a
    47 
    48 /* Copied from aout64.h of BFD */
    49 #define N_WEAKU         0x0d    /* Weak undefined symbol.  */
    50 #define N_WEAKA         0x0e    /* Weak absolute symbol.  */
    51 #define N_WEAKT         0x0f    /* Weak text symbol.  */
    52 #define N_WEAKD         0x10    /* Weak data symbol.  */
    53 #define N_WEAKB         0x11    /* Weak bss symbol.  */
    54 
    55 #define N_SETA          0x14
    56 #define N_SETT          0x16
    57 #define N_SETD          0x18
    58 
    59 #define N_GSYM          0x20
    60 #define N_FUN           0x24
    61 #define N_STSYM         0x26
    62 #define N_LCSYM         0x28
    63 #define N_RSYM          0x40
    64 #define N_SLINE         0x44
    65 #define N_SO            0x64
    66 #define N_LSYM          0x80
    67 #define N_SOL           0x84
    68 #define N_PSYM          0xa0
    69 #define N_LBRAC         0xc0
    70 #define N_RBRAC         0xe0
    71 
    72 #define N_IMP1          0x68    /* Import reference (emx specific) */
    73 #define N_IMP2          0x6a    /* Import definition (emx specific) */
    74 
    7537/* The maximum OMF record size supported by OMF linkers.  This value
    7638   includes the record type, length and checksum fields. */
    77 
    7839#define MAX_REC_SIZE    1024
    7940
    80 /* OMF record types.  To get the 32-bit variant of a record type, add
    81    REC32. */
    82 
    83 #define THEADR          0x80    /* Translator module header record */
    84 #define COMENT          0x88    /* Comment record */
    85 #define MODEND          0x8a    /* Module end record */
    86 #define EXTDEF          0x8c    /* External names definition record */
    87 #define TYPDEF          0x8e    /* Type definition record */
    88 #define PUBDEF          0x90    /* Public names definition record */
    89 #define LINNUM          0x94    /* Line numbers record */
    90 #define LNAMES          0x96    /* List of names record */
    91 #define SEGDEF          0x98    /* Segment definition record */
    92 #define GRPDEF          0x9a    /* Group definition record */
    93 #define FIXUPP          0x9c    /* Fixup record */
    94 #define LEDATA          0xa0    /* Logical enumerated data record */
    95 #define LIDATA          0xa2    /* Logical iterated data record */
    96 #define COMDEF          0xb0    /* Communal names definition record */
    97 #define COMDAT          0xc2    /* Common block */
    98 #define ALIAS           0xc6    /* Alias definition record */
    99 #define LIBHDR          0xf0    /* Library header */
    100 #define LIBEND          0xf1    /* Library end */
    101 
    102 /* Add this constant (using the | operator) to get the 32-bit variant
    103    of a record type.  Some fields will contain 32-bit values instead
    104    of 16-bit values. */
    105 
    106 #define REC32           0x01
    107 
    108 /* BIND_OFFSET is the offset from the beginning of the emxbind patch
    109    area to the data fields of that area.  The first BIND_OFFSET bytes
    110    of the emxbind patch area are used for storing the emx version
    111    number. */
    112 
    113 #define BIND_OFFSET         16
    114 
    115 
     41#ifndef _BYTE_WORD_DWORD
     42#define _BYTE_WORD_DWORD
    11643typedef unsigned char byte;
    11744typedef unsigned short word;
    11845typedef unsigned long dword;
    119 
    120 /* The header of an a.out file. */
    121 
    122 struct a_out_header
    123 {
    124   word magic;                   /* Magic word, must be 0407 */
    125   byte machtype;                /* Machine type */
    126   byte flags;                   /* Flags */
    127   long text_size;               /* Length of text, in bytes */
    128   long data_size;               /* Length of initialized data, in bytes */
    129   long bss_size;                /* Length of uninitialized data, in bytes */
    130   long sym_size;                /* Length of symbol table, in bytes */
    131   long entry;                   /* Start address (entry point) */
    132   long trsize;                  /* Length of relocation info for text, bytes */
    133   long drsize;                  /* Length of relocation info for data, bytes */
    134 };
    135 
    136 /* This is the layout of a relocation table entry. */
    137 
    138 struct reloc
    139 {
    140   dword address;                /* Fixup location */
    141   dword symbolnum:24;           /* Symbol number or segment */
    142   dword pcrel:1;                /* Self-relative fixup if non-zero */
    143   dword length:2;               /* Fixup size (0: 1 byte, 1: 2, 2: 4 bytes) */
    144   dword ext:1;                  /* Reference to symbol or segment */
    145   dword unused:4;               /* Not used */
    146 };
    147 
    148 /* This is the layout of a symbol table entry. */
    149 
    150 struct nlist
    151 {
    152   dword string;                 /* Offset in string table */
    153   byte type;                    /* Type of the symbol */
    154   byte other;                   /* Other information */
    155   word desc;                    /* More information */
    156   dword value;                  /* Value (address) */
    157 };
     46#endif /* _BYTE_WORD_DWORD */
    15847
    15948/* This is the header of a DOS executable file. */
    160 
    16149struct exe1_header
    16250{
     
    17765/* This is an additional header of a DOS executable file.  It contains
    17866   a pointer to the new EXE header. */
    179 
    18067struct exe2_header
    18168{
     
    18673
    18774/* This is the layout of the OS/2 LX header. */
    188 
    18975struct os2_header
    19076{
     
    240126
    241127/* This is the layout of an object table entry. */
    242 
    243128struct object
    244129{
  • trunk/src/emx/src/include/libc-alias.h

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    1919    the function is declared (not used) which will mark the function as
    2020    'aliased'.
    21 */
    2221
    23 #define CONCAT(x,y) x ## y
    24 
    25 /*
    2622    The following macro means exactly the following:
    2723    The function is a standard (POSIX) function that should
     
    3026    In fact, such functions can be referenced by three different names:
    3127    say, if you use _STD(xxx) you can reference later std_xxx, xxx
    32     or _xxx - all names will have one value.
     28    or _xxx - all names will point to the same function (of course,
     29    if you don't have a function with one of those three names).
    3330*/
    34 #define _STD(x) CONCAT(_std_,x)
     31#define _STD(x) _std_ ## x
     32
     33/* The libc-std.h file is auto-generated from all libc .c files
     34   and contains lines like ``#define malloc _STD(malloc)'' */
     35#include "libc-std.h"
    3536
    3637#endif /* __LIBC_ALIAS_H__ */
  • trunk/src/emx/src/ld/ld.c

    • Property cvs2svn:cvs-rev changed from 1.7 to 1.8
    r235 r236  
    2424#include <ar.h>
    2525#include <stdio.h>
    26 #ifdef __EMX__
    2726#include <stdlib.h>
    2827#include <io.h>
    29 #include <process.h>        /* for running emxbind */
     28#include <process.h>
    3029#include <errno.h>
    3130#include <utime.h>
    32 #endif /* __EMX__ */
    3331#include <ctype.h>
    3432#include <sys/types.h>
     
    3937#include <sys/resource.h>
    4038#endif
    41 #ifndef sony_news
    42 #include <fcntl.h>
    43 #endif
    44 
    45 #if !defined(A_OUT) && !defined(MACH_O)
     39
     40#if !defined(A_OUT)
    4641#define A_OUT
    4742#endif
    4843
    4944#ifdef A_OUT
    50 #ifdef COFF_ENCAPSULATE
    51 #include "a.out.encap.h"
    52 #else
    53 #ifdef __EMX__
    5445#include <a_out.h>
    55 #else /* !__EMX__ */
    56 #include <a.out.h>
    57 #endif /* !__EMX__ */
    5846#endif
    59 #endif
    60 
    61 #ifdef MACH_O
    62 #ifndef A_OUT
    63 #include <nlist.h>
    64 #include <reloc.h>
    65 #endif
    66 #ifndef N_TEXT
    67 #define N_TEXT 0x04
    68 #define N_DATA 0x06
    69 #define N_BSS 0x08
    70 #endif
    71 #include <sys/loader.h>
    72 #endif
    73 
    74 #ifdef EMX /* fix bugs */
    75 
    76 /* Fix two bugs in processing of set vectors:
    77 
    78    o  The size of the set vector section is not correctly computed
    79 
    80    o  References to set vectors can be wrong by up to sizeof (double) - 1
    81       bytes because padding occurs at the wrong place */
    82 
    83 #define FIXSETBUG
    84 /* gcc will warn on __attribute__((system)) but still will compile */
     47
     48/* old gcc will warn on __attribute__((system)) but still will compile */
    8549extern int __attribute__((system)) DosCopy (char *, char *, int);
    86 #endif /* EMX */
    8750
    8851/* We need .data of every module aligned to at least 16 bound
     
    9154#define SECTION_ALIGN_MASK      (SECTION_ALIGN-1)
    9255
    93 #ifndef N_SET_MAGIC
    94 #define N_SET_MAGIC(exec, val)  ((exec).a_magic = val)
    95 #endif
    96 
    9756/* If compiled with GNU C, use the built-in alloca */
    9857#ifdef __GNUC__
    9958# define alloca __builtin_alloca
    10059#else
    101 # if defined(sun) && defined(sparc)
    102 #  include "alloca.h"
    103 # else
    104 char *alloca ();
    105 # endif
     60# include "alloca.h"
    10661#endif
    10762
     
    11469#include "symseg.h"
    11570
    116 #ifdef USG
    117 #include <string.h>
    118 #else
    11971#include <strings.h>
    120 #endif
    12172
    12273/* Determine whether we should attempt to handle (minimally)
     
    149100   whose native format is different.  */
    150101/* #define NON_NATIVE */
    151 
    152 /* Define this to specify the default executable format.  */
    153 
    154 #ifdef hpux
    155 #define DEFAULT_OUTPUT_STYLE OUTPUT_READONLY_TEXT
    156 #endif
    157 
    158 /* Ordinary 4.3bsd lacks these macros in a.out.h.  */
    159 
    160 #ifndef N_TXTADDR
    161 #if defined(vax) || defined(sony_news) || defined(hp300) || defined(pyr)
    162 #define N_TXTADDR(X) 0
    163 #endif
    164 #ifdef is68k
    165 #define N_TXTADDR(x)  (sizeof (struct exec))
    166 #endif
    167 #ifdef sequent
    168 #define N_TXTADDR(x) (N_ADDRADJ(x))
    169 #endif
    170 #ifdef NeXT
    171 #define N_TXTADDR(X) ((X).a_magic == ZMAGIC ? page_size : 0)
    172 #endif
    173 #endif
    174 
    175 #ifndef N_DATADDR
    176 #if defined(vax) || defined(sony_news) || defined(hp300) || defined(pyr)
    177 #define N_DATADDR(x) \
    178         (((x).a_magic==OMAGIC)? (N_TXTADDR(x)+(x).a_text) \
    179         : (page_size+((N_TXTADDR(x)+(x).a_text-1) & ~(page_size-1))))
    180 #endif
    181 #ifdef is68k
    182 #define SEGMENT_SIZE 0x20000
    183 #define N_DATADDR(x) \
    184     (((x).a_magic==Omagic)? (N_TXTADDR(x)+(x).a_text) \
    185      : (SEGMENT_SIZE + ((N_TXTADDR(x)+(x).a_text-1) & ~(SEGMENT_SIZE-1))))
    186 #endif
    187 #ifdef sequent
    188 #define N_DATADDR(x) \
    189         (((x).a_magic==OMAGIC)? (N_TXTADDR(x)+(x).a_text) \
    190         : (page_size+(((x).a_text-1) & ~(page_size-1))))
    191 #endif
    192 #ifdef NeXT
    193 #define N_DATADDR(X) \
    194         (((X).a_magic==ZMAGIC)?(N_TXTADDR(X)+(X).a_text+0xFFFF)&~0xFFFF \
    195          :N_TXTADDR(X)+(X).a_text)
    196 #endif
    197 #endif
    198102
    199103/* The "address" of the data segment in a relocatable file.
     
    203107   N_TXTADDR from N_DATADDR to get the "address" for the input file.  */
    204108#define DATA_ADDR_DOT_O(hdr) (N_DATADDR(hdr) - N_TXTADDR(hdr))
    205 
    206 /* Define how to initialize system-dependent header fields.  */
    207 #ifdef sun
    208 #ifdef sparc
    209 #define INITIALIZE_HEADER \
    210   {outheader.a_machtype = M_SPARC; outheader.a_toolversion = 1;}
    211 #endif /* sparc.  */
    212 #if defined(mc68000)
    213 /* Set the machine type according to the machine type of the .o files.
    214    If they are all sun2 (68010), then the type of the executable is sun2.
    215    If any is sun3 (68020), then the type of the executable is sun3.
    216    This is consistent with the Sun loader and more useful than having
    217    it depend on which machine you are on when you run ld.  */
    218 static int sun_machtype = M_68010;
    219 #define INITIALIZE_HEADER outheader.a_machtype = sun_machtype
    220 #define READ_HEADER_HOOK(machtype) \
    221   if (machtype == M_68020)           \
    222     {                                \
    223       sun_machtype = M_68020;        \
    224     }
    225 #endif /* mc68000.  */
    226 #endif /* Sun.  */
    227 
    228 #ifdef ALTOS
    229 #define INITIALIZE_HEADER N_SET_MACHTYPE (outheader, M_68020)
    230 #endif
    231 #ifdef is68k
    232 #ifdef M_68020
    233 /* ISI rel 4.0D doesn't use it, and rel 3.05 doesn't have an
    234    a_machtype field and so won't recognize the magic number.  To keep
    235    binary compatibility for now, just ignore it */
    236 #define INITIALIZE_HEADER outheader.a_machtype = 0;
    237 #endif
    238 #endif
    239 #ifdef hpux
    240 #define INITIALIZE_HEADER N_SET_MACHTYPE (outheader, HP9000S200_ID)
    241 #endif
    242 #if defined(i386) && !defined(sequent)
    243 #define INITIALIZE_HEADER N_SET_MACHTYPE (outheader, M_386)
    244 #endif /* Sequent symmetry.  */
    245 #if defined(hp300)
    246 #define INITIALIZE_HEADER outheader.a_mid = MID_HP300
    247 #endif /* hp300.  */
    248 #ifdef pyr
    249 #define INITIALIZE_HEADER outheader.a_machid = PYR90X
    250 #endif /* Pyramid.  */
    251 
    252 #ifdef is68k
    253 /* This enables code to take care of an ugly hack in the ISI OS.
    254    If a symbol beings with _$, then the object file is included only
    255    if the rest of the symbol name has been referenced. */
    256 #define DOLLAR_KLUDGE
    257 #endif
    258109
    259110/* Values for 3rd argument to lseek().  */
     
    344195 */
    345196
    346 #if defined(sun) && defined(sparc)
    347 /* Sparc (Sun 4) macros */
    348 #undef relocation_info
    349 #define relocation_info                 reloc_info_sparc
    350 #define RELOC_ADDRESS(r)                ((r)->r_address)
    351 #define RELOC_EXTERN_P(r)               ((r)->r_extern)
    352 #define RELOC_TYPE(r)                   ((r)->r_index)
    353 #define RELOC_SYMBOL(r)                 ((r)->r_index)
    354 #define RELOC_MEMORY_SUB_P(r)           0
    355 #define RELOC_MEMORY_ADD_P(r)           0
    356 #define RELOC_ADD_EXTRA(r)              ((r)->r_addend)
    357 #define RELOC_PCREL_P(r)             \
    358         ((r)->r_type >= RELOC_DISP8 && (r)->r_type <= RELOC_WDISP22)
    359 #define RELOC_VALUE_RIGHTSHIFT(r)       (reloc_target_rightshift[(r)->r_type])
    360 #define RELOC_TARGET_SIZE(r)            (reloc_target_size[(r)->r_type])
    361 #define RELOC_TARGET_BITPOS(r)          0
    362 #define RELOC_TARGET_BITSIZE(r)         (reloc_target_bitsize[(r)->r_type])
    363 
    364 /* Note that these are very dependent on the order of the enums in
    365    enum reloc_type (in a.out.h); if they change the following must be
    366    changed */
    367 /* Also note that the last few may be incorrect; I have no information */
    368 static int reloc_target_rightshift[] = {
    369   0, 0, 0, 0, 0, 0, 2, 2, 10, 0, 0, 0, 0, 0, 0,
    370 };
    371 static int reloc_target_size[] = {
    372   0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
    373 };
    374 static int reloc_target_bitsize[] = {
    375   8, 16, 32, 8, 16, 32, 30, 22, 22, 22, 13, 10, 32, 32, 16,
    376 };
    377 
    378 #define MAX_ALIGNMENT   (sizeof (double))
    379 #endif
    380 
    381 #ifdef sequent
    382 #define RELOC_ADDRESS(r)                ((r)->r_address)
    383 #define RELOC_EXTERN_P(r)               ((r)->r_extern)
    384 #define RELOC_TYPE(r)           ((r)->r_symbolnum)
    385 #define RELOC_SYMBOL(r)         ((r)->r_symbolnum)
    386 #define RELOC_MEMORY_SUB_P(r)   ((r)->r_bsr)
    387 #define RELOC_MEMORY_ADD_P(r)   1
    388 #undef RELOC_ADD_EXTRA
    389 #define RELOC_PCREL_P(r)                ((r)->r_pcrel || (r)->r_bsr)
    390 #define RELOC_VALUE_RIGHTSHIFT(r)       0
    391 #define RELOC_TARGET_SIZE(r)            ((r)->r_length)
    392 #define RELOC_TARGET_BITPOS(r)  0
    393 #define RELOC_TARGET_BITSIZE(r) 32
    394 #endif
    395 
    396197/* Default macros */
    397198#ifndef RELOC_ADDRESS
     
    623424      /* Nonzero means print a message at all refs or defs of this symbol */
    624425      char trace;
    625 #ifdef EMX /* WEAKU */
    626426      /* One of N_WEAKX values */
    627427      char weak;
    628 #endif /* EMX */
    629428    }
    630429  symbol;
     
    632431/* Demangler for C++.  */
    633432extern char *cplus_demangle ();
    634 #ifdef EMX /* demangling */
    635433#include "demangle.h"
    636434static char *my_cplus_demangle ();
    637435int demangle_options;
    638 #endif /* EMX */
    639436
    640437/* Demangler function to use.  We unconditionally enable the C++ demangler
     
    642439   by the C++ compiler.  Enabling it only if -lg++ was specified seems too
    643440   much of a kludge.  */
    644 #ifdef EMX /* demangling */
    645441char *(*demangler)() = my_cplus_demangle;
    646 #else /* !EMX */
    647 char *(*demangler)() = cplus_demangle;
    648 #endif /* !EMX */
    649442
    650443/* Number of buckets in symbol hash table */
     
    801594  unsigned long int symseg_size;
    802595  long int symseg_offset;
    803 
    804 #ifdef MACH_O
    805   /* Section ordinals from the Mach-O load commands.  These
    806      are compared with the n_sect fields of symbols.  */
    807   int text_ordinal;
    808   int data_ordinal;
    809   int bss_ordinal;
    810 #endif
    811596
    812597  /* Describe data from the file loaded into core */
     
    891676
    892677char *output_filename;
    893 #ifdef EMX /* emxbind, relocatable */
    894678char *exe_filename;
    895679char *def_filename = NULL;
     
    907691  EMX_DEFAULT, RSXNT_WIN32, RSXNT_RSX, RSXNT_EMX
    908692} rsxnt_linked = EMX_DEFAULT;
    909 #endif /* EMX */
    910693
    911694/* What kind of output file to write.  */
     
    914697
    915698#ifndef DEFAULT_OUTPUT_FILE_TYPE
    916 #ifdef MACH_O
    917 #define DEFAULT_OUTPUT_FILE_TYPE IS_MACH_O
    918 #else
    919699#define DEFAULT_OUTPUT_FILE_TYPE IS_A_OUT
    920 #endif
    921700#endif
    922701
     
    983762unsigned long *set_vectors;
    984763
    985 #ifdef EMX /* relocatable */
    986764int *set_reloc;
    987 #endif /* EMX */
    988765
    989766/* Amount of cleared space to leave at the end of the text segment.  */
     
    991768int text_pad;
    992769
    993 #ifdef FIXSETBUG
    994770/* Amount of padding between data segment and set vectors. */
    995771int set_sect_pad;
    996 #endif /* FIXSETBUG */
    997772
    998773/* Amount of padding at end of data segment.  This has two parts:
     
    1055830
    1056831/* Standard directories to search for files specified by -l.  */
    1057 char *standard_search_dirs[] =
    1058 #ifdef STANDARD_SEARCH_DIRS
    1059   {STANDARD_SEARCH_DIRS};
    1060 #else
    1061 #ifdef NON_NATIVE
    1062   {"/usr/local/lib/gnu"};
    1063 #else
    1064 #ifdef __EMX__
    1065   {"/emx/lib"};
    1066 #else /* !__EMX__ */
    1067   {"/lib", "/usr/lib", "/usr/local/lib"};
    1068 #endif /* !__EMX__ */
    1069 #endif
    1070 #endif
     832char *standard_search_dirs[] = { "/usr/lib" };
    1071833
    1072834/* If set STANDARD_SEARCH_DIRS is not searched.  */
     
    1093855struct glosym **cmdline_references;
    1094856int cl_refs_allocated;
    1095 
    1096 #ifndef bcopy
    1097 void bcopy (), bzero ();
    1098 #endif
    1099 #ifndef __EMX__
    1100 char *malloc (), *realloc ();
    1101 void free ();
    1102 #endif /* !__EMX__ */
    1103857
    1104858char *xmalloc ();
     
    1135889symbol *getsym (), *getsym_soft ();
    1136890void do_warnings ();
    1137 #ifdef EMX /* emxbind */
    1138891void check_exe (void);
    1139 #endif /* EMX */
    1140892
    1141893
     
    1145897     int argc;
    1146898{
    1147 #ifdef __EMX__
    1148899  _response (&argc, &argv);
    1149900  _wildcard (&argc, &argv);
    1150 #endif /* __EMX__ */
    1151901  page_size = getpagesize ();
    1152902  progname = argv[0];
     
    1171921  data_reloc_size = 0;
    1172922
    1173 #ifdef FIXSETBUG
    1174923  set_sect_pad = 0;
    1175 #endif /* FIXSETBUG */
    1176924  data_pad = 0;
    1177925  text_pad = 0;
     
    1217965  decode_command (argc, argv);
    1218966
    1219 #ifdef EMX /* emxbind */
    1220967  check_exe ();
    1221 #endif /* EMX */
    1222968
    1223969  /* Load symbols of all input files.
     
    12781024  {"M", 0, 0, 'M'},
    12791025  {"N", 0, 0, 'N'},
    1280 #ifdef EMX /* emxbind, relocatable, demangling */
    12811026  {"R", 0, 0, 'R'},             /* Create relocatable executable */
    12821027  {"Zexe", 0, 0, 135},          /* Create .exe file, touch `output file' */
     
    12881033  {"Zrsx32", 0, 0, 141},        /* Create Win32/DOS win32 base */
    12891034  {"Zemx32", 0, 0, 142},        /* Create Win32/DOS emx base */
    1290 #endif /* EMX */
    12911035  {"S", 0, 0, 'S'},
    12921036  {"T", 1, 0, 'T'},
     
    14481192          break;
    14491193
    1450 #ifdef EMX /* emxbind, relocatable, demangling */
    14511194        case 135:               /* -Zexe */
    14521195          exe_flag = 1;
     
    14851228          reloc_flag = 1;
    14861229          break;
    1487 #endif /* EMX */
    14881230
    14891231        case 'S':
     
    15401282        case 1:
    15411283          /* Non-option argument. */
    1542 #ifdef EMX /* emxbind */
    15431284          {
    15441285            char *ext = _getext (optarg);
     
    15581299              }
    15591300          }
    1560 #endif /* EMX */
    15611301          p->filename = optarg;
    15621302          p->local_sym_name = optarg;
     
    15741314
    15751315        case 'l':
    1576 #ifdef __EMX__
    15771316          p->filename = concat ("", optarg, ".a");
    1578 #else /* !__EMX__ */
    1579           p->filename = concat ("lib", optarg, ".a");
    1580 #endif /* !__EMX__ */
    15811317          p->local_sym_name = concat ("-l", optarg, "");
    15821318          p->search_dirs_flag = 1;
     
    17851521          register char *string
    17861522            = concat (search_dirs[i], "/", entry->filename);
    1787 #ifdef EMX /* host */
    17881523          desc = open (string, O_RDONLY|O_BINARY, 0);
    17891524
    17901525          if (desc < 0)
    17911526          {
    1792            char *tmp = _getext (entry->filename);
    1793            if (tmp && (tolower(tmp[1]) == 'a') && (tmp[2] == 0))
    1794            {
    1795             /* Try libxxx */
    1796             free (string);
    1797             string = concat (search_dirs[i], "/lib", entry->filename);
    1798             desc = open (string, O_RDONLY|O_BINARY, 0);
    1799            }
     1527            char *tmp = _getext (entry->filename);
     1528            if (tmp && (tolower(tmp[1]) == 'a') && (tmp[2] == 0))
     1529            {
     1530              /* Try libxxx */
     1531              free (string);
     1532              string = concat (search_dirs[i], "/lib", entry->filename);
     1533              desc = open (string, O_RDONLY|O_BINARY, 0);
     1534            }
    18001535          }
    1801 #else /* !EMX */
    1802           desc = open (string, O_RDONLY, 0);
    1803 #endif /* !EMX */
    18041536          if (desc > 0)
    18051537            {
     
    18121544    }
    18131545  else
    1814 #ifdef __EMX__
    18151546    desc = open (entry->filename, O_RDONLY|O_BINARY, 0);
    1816 #else /* !__EMX__ */
    1817     desc = open (entry->filename, O_RDONLY, 0);
    1818 #endif /* !__EMX__ */
    18191547
    18201548  if (desc > 0)
     
    19111639
    19121640    lseek (desc, entry->starting_offset, 0);
    1913 #ifdef COFF_ENCAPSULATE
    1914     if (entry->just_syms_flag)
    1915       /* Since a file given with -A will have a coff header, unlike normal
    1916         input files, we need to skip over it.  */
    1917       lseek (desc, sizeof (coffheader), SEEK_CUR);
    1918 #endif
    19191641    len = read (desc, (char *) &hdr, sizeof (struct exec));
    19201642    if (len == sizeof (struct exec) && !N_BADMAG (hdr))
     
    19261648#endif
    19271649
    1928 #ifdef MACH_O
    1929   {
    1930     struct mach_header hdr;
    1931 
    1932     lseek (desc, entry->starting_offset, 0);
    1933     len = read (desc, (char *) &hdr, sizeof (struct mach_header));
    1934     if (len == sizeof (struct mach_header) && hdr.magic == MH_MAGIC)
    1935       {
    1936         entry->file_type = IS_MACH_O;
    1937         return;
    1938       }
    1939   }
    1940 #endif
    1941 
    19421650  fatal_with_file ("malformed input file (not rel or archive) ", entry);
    19431651}
     
    19561664
    19571665  lseek (desc, entry->starting_offset, 0);
    1958 
    1959 #ifdef COFF_ENCAPSULATE
    1960   if (entry->just_syms_flag)
    1961     /* Since a file given with -A will have a coff header, unlike normal
    1962        input files, we need to skip over it.  */
    1963     lseek (desc, sizeof (coffheader), SEEK_CUR);
    1964 #endif
    1965 
    19661666  read (desc, (char *) &hdr, sizeof (struct exec));
    19671667
     
    20411741#endif
    20421742
    2043 #ifdef MACH_O
    2044 /* Read a Mach-O file's header.  DESC is the descriptor on which the
    2045    file is open, and ENTRY is the file's entry.  */
    2046 void
    2047 read_mach_o_header (desc, entry)
    2048      int desc;
    2049      struct file_entry *entry;
    2050 {
    2051   struct mach_header mach_header;
    2052   char *hdrbuf;
    2053   struct load_command *load_command;
    2054   struct segment_command *segment_command;
    2055   struct section *section;
    2056   struct symtab_command *symtab_command;
    2057 #ifdef LC_SYMSEG
    2058   struct symseg_command *symseg_command;
    2059 #endif
    2060   int ordinal;
    2061   int symtab_seen, symseg_seen;
    2062   int len, cmd, seg;
    2063 
    2064   entry->text_ordinal = entry->data_ordinal = entry->bss_ordinal = 0;
    2065   symtab_seen = symseg_seen = 0;
    2066   ordinal = 1;
    2067 
    2068   lseek (desc, entry->starting_offset, 0);
    2069   len = read (desc, (char *) &mach_header, sizeof (struct mach_header));
    2070   if (len != sizeof (struct mach_header))
    2071     fatal_with_file ("failure reading Mach-O header of ", entry);
    2072   if (mach_header.filetype != MH_OBJECT && mach_header.filetype != MH_EXECUTE)
    2073     fatal_with_file ("unsupported Mach-O file type (not MH_OBJECT or MH_EXECUTE) in ", entry);
    2074   hdrbuf = xmalloc (mach_header.sizeofcmds);
    2075   len = read (desc, hdrbuf, mach_header.sizeofcmds);
    2076   if (len != mach_header.sizeofcmds)
    2077     fatal_with_file ("failure reading Mach-O load commands of ", entry);
    2078   load_command = (struct load_command *) hdrbuf;
    2079   for (cmd = 0; cmd < mach_header.ncmds; ++cmd)
    2080     {
    2081       switch (load_command->cmd)
    2082         {
    2083         case LC_SEGMENT:
    2084           segment_command = (struct segment_command *) load_command;
    2085           section = (struct section *) ((char *) (segment_command + 1));
    2086           for (seg = 0; seg < segment_command->nsects; ++seg, ++section, ++ordinal)
    2087             {
    2088               if (!strncmp(SECT_TEXT, section->sectname, sizeof section->sectname))
    2089                 if (entry->text_ordinal)
    2090                   fatal_with_file ("more than one __text section in ", entry);
    2091                 else
    2092                   {
    2093                     entry->text_ordinal = ordinal;
    2094                     entry->orig_text_address = section->addr;
    2095                     entry->text_size = section->size;
    2096                     entry->text_offset = section->offset;
    2097                     entry->text_reloc_size = section->nreloc * sizeof (struct relocation_info);
    2098                     entry->text_reloc_offset = section->reloff;
    2099                   }
    2100               else if (!strncmp(SECT_DATA, section->sectname, sizeof section->sectname))
    2101                 if (entry->data_ordinal)
    2102                   fatal_with_file ("more than one __data section in ", entry);
    2103                 else
    2104                   {
    2105                     entry->data_ordinal = ordinal;
    2106                     entry->orig_data_address = section->addr;
    2107                     entry->data_size = section->size;
    2108                     entry->data_offset = section->offset;
    2109                     entry->data_reloc_size = section->nreloc * sizeof (struct relocation_info);
    2110                     entry->data_reloc_offset = section->reloff;
    2111                   }
    2112               else if (!strncmp(SECT_BSS, section->sectname, sizeof section->sectname))
    2113                 if (entry->bss_ordinal)
    2114                   fatal_with_file ("more than one __bss section in ", entry);
    2115                 else
    2116                   {
    2117                     entry->bss_ordinal = ordinal;
    2118                     entry->orig_bss_address = section->addr;
    2119                     entry->bss_size = section->size;
    2120                   }
    2121               else
    2122                 if (section->size != 0)
    2123                   fprintf (stderr, "%s: warning: unknown section `%.*s' in %s\n",
    2124                            progname, sizeof section->sectname, section->sectname,
    2125                            entry->filename);
    2126             }
    2127           break;
    2128         case LC_SYMTAB:
    2129           if (symtab_seen)
    2130               fatal_with_file ("more than one LC_SYMTAB in ", entry);
    2131           else
    2132             {
    2133               symtab_seen = 1;
    2134               symtab_command = (struct symtab_command *) load_command;
    2135               entry->syms_size = symtab_command->nsyms * sizeof (struct nlist);
    2136               entry->syms_offset = symtab_command->symoff;
    2137               entry->strs_size = symtab_command->strsize;
    2138               entry->strs_offset = symtab_command->stroff;
    2139             }
    2140           break;
    2141 #ifdef LC_SYMSEG
    2142         case LC_SYMSEG:
    2143           if (symseg_seen)
    2144             fatal_with_file ("more than one LC_SYMSEG in ", entry);
    2145           else
    2146             {
    2147               symseg_seen = 1;
    2148               symseg_command = (struct symseg_command *) load_command;
    2149               entry->symseg_size = symseg_command->size;
    2150               entry->symseg_offset = symseg_command->offset;
    2151             }
    2152           break;
    2153 #endif
    2154         }
    2155       load_command = (struct load_command *)
    2156         ((char *) load_command + load_command->cmdsize);
    2157     }
    2158 
    2159   free (hdrbuf);
    2160 
    2161   if (!symtab_seen)
    2162     fprintf (stderr, "%s: no symbol table in %s\n", progname, entry->filename);
    2163 }
    2164 #endif
    2165 
    21661743/* Read a file's header info into the proper place in the file_entry.
    21671744   DESC is the descriptor on which the file is open.
     
    21901767      break;
    21911768#endif
    2192 
    2193 #ifdef MACH_O
    2194     case IS_MACH_O:
    2195       read_mach_o_header (desc, entry);
    2196       break;
    2197 #endif
    21981769    }
    21991770
    22001771  entry->header_read_flag = 1;
    22011772}
    2202 
    2203 #ifdef MACH_O
    2204 void translate_mach_o_symbols ();
    2205 #endif
    22061773
    22071774/* Read the symbols of file ENTRY into core.
     
    22211788  if (entry->syms_size != read (desc, entry->symbols, entry->syms_size))
    22221789    fatal_with_file ("premature end of file in symbols of ", entry);
    2223 
    2224 #ifdef MACH_O
    2225   if (entry->file_type == IS_MACH_O)
    2226     translate_mach_o_symbols (entry);
    2227 #endif
    22281790}
    22291791
     
    23141876    {
    23151877      if (p->n_type == (N_SETV | N_EXT)) continue;
    2316 #ifdef EMX /* import, relocatable */
    23171878      if (p->n_type == (N_IMP1 | N_EXT))
    23181879        reloc_flag = 1;
    2319 #endif /* EMX */
    23201880      if (set_element_prefixes
    23211881          && set_element_prefixed_p (p->n_un.n_strx + entry->strings))
     
    23531913            }
    23541914        }
    2355 #ifdef __EMX__
    23561915      else if (WEAK_SYMBOL (p->n_type))
    23571916        {
     
    23621921            enter_global_ref (p, p->n_un.n_strx + entry->strings, entry);
    23631922        }
    2364 #endif
    23651923      else if (p->n_type & N_EXT)
    23661924        enter_global_ref (p, p->n_un.n_strx + entry->strings, entry);
     
    24091967  sp->referenced = 1;
    24101968
    2411 #ifdef EMX /* WEAK symbol support */
    24121969  if (WEAK_SYMBOL (type))
    24131970    {
     
    24211978        /*(type == N_WEAKB)*/ N_BSS | N_EXT;
    24221979    }
    2423 #endif /* EMX */
    24241980
    24251981  if (type != (N_UNDF | N_EXT) || nlist_p->n_value)
     
    24672023             a symbol being equivalenced to. */
    24682024          nlist_p->n_value
    2469 #ifndef NeXT
    24702025            = (unsigned int) getsym ((nlist_p + 1)->n_un.n_strx
    24712026                                     + entry->strings);
    2472 #else
    2473             /* NeXT also has indirection but they do it weirdly. */
    2474             = (unsigned int) getsym (nlist_p->n_value + entry->strings);
    2475 #endif
    24762027          if ((symbol *) nlist_p->n_value == sp)
    24772028            {
     
    24922043  else
    24932044    if (!oldref)
    2494 #ifndef DOLLAR_KLUDGE
    24952045      undefined_global_sym_count++;
    2496 #else
    2497       {
    2498         if (entry->superfile && type == (N_UNDF | N_EXT) && name[1] == '$')
    2499           {
    2500             /* This is an (ISI?) $-conditional; skip it */
    2501             sp->referenced = 0;
    2502             if (sp->trace)
    2503               {
    2504                 fprintf (stderr, "symbol %s is a $-conditional ignored in ", sp->name);
    2505                 print_file_name (entry, stderr);
    2506                 fprintf (stderr, "\n");
    2507               }
    2508             return;
    2509           }
    2510         else
    2511           undefined_global_sym_count++;
    2512       }
    2513 #endif
    25142046
    25152047  if (sp == end_symbol && entry->just_syms_flag && !T_flag_specified)
     
    25692101          break;
    25702102
    2571 #ifdef sequent
    2572         case N_SHUNDF:
    2573           reftype = "shared undf";
    2574           break;
    2575 
    2576 /* These conflict with cases above.
    2577         case N_SHDATA:
    2578           reftype = "shared data";
    2579           break;
    2580 
    2581         case N_SHBSS:
    2582           reftype = "shared BSS";
    2583           break;
    2584 */
    2585 #endif
    2586 
    2587 #ifdef EMX /* import & WEAK */
    25882103        case N_IMP1:
    25892104          reftype = "imported";
    25902105          break;
     2106
    25912107        case N_WEAKU & ~N_EXT:
    25922108          reftype = "weak";
    25932109          break;
     2110
    25942111        case N_WEAKT & ~N_EXT:
    25952112          reftype = "weak text";
    25962113          break;
     2114
    25972115        case N_WEAKD & ~N_EXT:
    25982116          reftype = "weak data";
    25992117          break;
    2600 #endif /* EMX */
    26012118
    26022119        default:
     
    29492466  register struct nlist *end
    29502467    = entry->symbols + entry->syms_size / sizeof (struct nlist);
    2951 #ifdef DOLLAR_KLUDGE
    2952   register int dollar_cond = 0;
    2953 #endif
    29542468
    29552469  for (p = entry->symbols; p < end; p++)
     
    29602474      /* If the symbol has an interesting definition, we could
    29612475         potentially want it.  */
    2962       if (((type & N_EXT)
    2963 #ifdef __EMX__
    2964            || WEAK_SYMBOL (type)
    2965 #endif
    2966           )
    2967           && (type != (N_UNDF | N_EXT) || p->n_value
    2968 #ifdef DOLLAR_KLUDGE
    2969                || name[1] == '$'
    2970 #endif
    2971               )
     2476      if (((type & N_EXT) || WEAK_SYMBOL (type))
     2477          && (type != (N_UNDF | N_EXT) || p->n_value)
    29722478          && !SET_ELEMENT_P (type)
    29732479          && !set_element_prefixed_p (name))
     
    29752481          register symbol *sp = getsym_soft (name);
    29762482
    2977 #ifdef DOLLAR_KLUDGE
    2978           if (name[1] == '$')
    2979             {
    2980               sp = getsym_soft (&name[2]);
    2981               dollar_cond = 1;
    2982               if (!sp) continue;
    2983               if (sp->referenced)
    2984                 {
    2985                   if (write_map)
    2986                     {
    2987                       print_file_name (entry, stdout);
    2988                       fprintf (stdout, " needed due to $-conditional %s\n", name);
    2989                     }
    2990                   return 1;
    2991                 }
    2992               continue;
    2993             }
    2994 #endif
    2995 
    29962483          /* If this symbol has not been hashed, we can't be looking for it. */
    29972484
     
    30022489                 pipe() from the library.  But the bug fix kingdon made was wrong.  */
    30032490              || (sp->defined && sp->max_common_size
    3004 #ifdef EMX
    3005                   && type != (N_INDR | N_EXT)
    3006 #endif /* EMX */
    3007               ))
     2491                  && type != (N_INDR | N_EXT)))
    30082492            {
    30092493              /* This is a symbol we are looking for.  It is either
    30102494                 not yet defined or defined as a common.  */
    3011 #ifdef DOLLAR_KLUDGE
    3012               if (dollar_cond) continue;
    3013 #endif
    30142495              if (type == (N_UNDF | N_EXT))
    30152496                {
     
    30862567  initialize_data_start ();
    30872568
    3088 #ifdef FIXSETBUG
    30892569  /* Make sure the set vectors are aligned properly. */
    30902570  {
     
    30952575    data_size = new_data_size;
    30962576  }
    3097 #else /* !FIXSETBUG */
    3098   /* Make sure bss starts out aligned as much as anyone can want.  */
    3099   {
    3100     int new_data_size = (data_size + SECTION_ALIGN_MASK) & ~SECTION_ALIGN_MASK;
    3101 
    3102     data_pad += new_data_size - data_size;
    3103     data_size = new_data_size;
    3104   }
    3105 #endif /* !FIXSETBUG */
    31062577
    31072578  /* Set up the set element vector */
     
    31132584         vector, plus a word for each symbol for a zero at the end of
    31142585         the vector (for incremental linking).  */
    3115 #ifdef FIXSETBUG
    31162586      set_sect_size
    31172587        = (set_symbol_count + 2 * set_vector_count) * sizeof (unsigned long);
    3118 #else /* !FIXSETBUG */
    3119       set_sect_size
    3120         = (2 * set_symbol_count + set_vector_count) * sizeof (unsigned long);
    3121 #endif /* !FIXSETBUG */
    31222588      set_sect_start = data_start + data_size;
    31232589      data_size += set_sect_size;
    31242590      set_vectors = (unsigned long *) xmalloc (set_sect_size);
    3125 #ifdef EMX /* relocatable */
    31262591      set_reloc = (int *) xmalloc (set_sect_size / sizeof (unsigned long)
    31272592                                   * sizeof (int));
    3128 #endif /* EMX */
    31292593      setv_fill_count = 0;
    31302594    }
    31312595
    3132 #ifdef FIXSETBUG
    31332596  /* Make sure bss starts out aligned as much as anyone can want.  */
    31342597  {
     
    31382601    data_size = new_data_size;
    31392602  }
    3140 #endif /* FIXSETBUG */
    31412603
    31422604  /* Compute start addresses of each file's sections and symbols.  */
     
    31842646                      multiple_def_count++;
    31852647                    }
    3186 #ifdef EMX /* relocatable */
    31872648                  set_reloc[setv_fill_count] = TYPE_OF_SET_ELEMENT (type);
    31882649                  if ((type & ~N_EXT) != N_SETA)
    31892650                    data_reloc_size += sizeof (struct relocation_info);
    3190 #endif /* EMX */
    31912651                  set_vectors[setv_fill_count++] = p->n_value;
    31922652                }
    3193 #ifdef EMX /* import */
    31942653              else if ((type & N_EXT) && type != (N_UNDF | N_EXT)
    31952654                       && type != (N_IMP1 | N_EXT))
    3196 #else /* !EMX */
    3197               else if ((type & N_EXT) && type != (N_UNDF | N_EXT))
    3198 #endif /* !EMX */
    31992655                {
    32002656                  /* non-common definition */
     
    32582714              unsigned long i, tmp;
    32592715
    3260 #ifdef EMX /* relocatable */
    32612716              set_reloc[length_word_index] = N_ABS;
    3262 #endif /* EMX */
    32632717              set_vectors[length_word_index]
    32642718                = setv_fill_count - 1 - length_word_index;
     
    32692723                   i++)
    32702724                {
    3271 #ifdef EMX /* relocatable */
    32722725                  tmp = set_reloc[length_word_index + i];
    32732726                  set_reloc[length_word_index + i]
    32742727                    = set_reloc[setv_fill_count - i];
    32752728                  set_reloc[setv_fill_count - i] = (int)tmp;
    3276 #endif /* EMX */
     2729
    32772730                  tmp = set_vectors[length_word_index + i];
    32782731                  set_vectors[length_word_index + i]
     
    32812734                }
    32822735
    3283 #ifdef EMX /* relocatable */
    32842736              set_reloc[setv_fill_count] = N_ABS;
    3285 #endif /* EMX */
    32862737              set_vectors[setv_fill_count++] = 0;
    32872738            }
    3288 #ifdef EMX /* Unresolved weak symbols should be zero */
    32892739          if (!sp->defined && WEAK_SYMBOL (sp->weak))
    32902740            {
     
    32932743              undefined_global_sym_count--;
    32942744            }
    3295 #endif /* EMX */
    32962745          if (sp->defined)
    32972746            defined_global_sym_count++;
     
    34952944    /* If this is a definition,
    34962945       update it if necessary by this file's start address.  */
    3497     if (!(p->n_type & (N_STAB | N_EXT)) &&
    3498         !SET_ELEMENT_P (p->n_type))
     2946    if (((output_style == OUTPUT_RELOCATABLE) && SET_ELEMENT_P (p->n_type))
     2947     || (!(p->n_type & (N_STAB | N_EXT)) && !SET_ELEMENT_P (p->n_type)))
    34992948      fprintf (outfile, "  %s: 0x%lx\n",
    35002949               entry->strings + p->n_un.n_strx, p->n_value);
     
    40383487struct exec outheader;
    40393488
    4040 #ifdef COFF_ENCAPSULATE
    4041 int need_coff_header;
    4042 struct coffheader coffheader;
    4043 #endif
    4044 
    40453489/* Compute text_start and text_header_size for an a.out file.  */
    40463490
     
    40733517     This depends on the kind of system and on the output format selected.  */
    40743518  N_SET_MAGIC (outheader, magic);
     3519  N_SET_MACHTYPE (outheader, M_386);
    40753520#ifdef INITIALIZE_HEADER
    40763521  INITIALIZE_HEADER;
     
    40783523
    40793524  text_header_size = sizeof (struct exec);
    4080 #ifdef COFF_ENCAPSULATE
    4081   /* Don't write the coff header for the output of ld -A (since
    4082      it is not executable by the kernel anyway).  */
    4083   if (output_style != OUTPUT_RELOCATABLE && !file_table[0].just_syms_flag)
    4084     {
    4085       need_coff_header = 1;
    4086       /* set this flag now, since it will change the values of N_TXTOFF, etc */
    4087       N_SET_FLAGS (outheader, N_FLAGS_COFF_ENCAPSULATE);
    4088       text_header_size += sizeof (struct coffheader);
    4089     }
    4090 #endif
    40913525  if (text_header_size <= N_TXTOFF (outheader))
    40923526    text_header_size = 0;
     
    41093543{
    41103544  outheader.a_text = text_size;
    4111 #ifdef sequent
    4112   outheader.a_text += N_ADDRADJ (outheader);
    4113   if (entry_symbol == 0)
    4114     entry_symbol = getsym ("start");
    4115 #endif
    41163545  if (! Tdata_flag_specified)
    41173546    data_start = N_DATADDR (outheader) + text_start - N_TXTADDR (outheader);
     
    41273556  outheader.a_entry = (entry_symbol ? entry_symbol->value
    41283557                       : text_start + text_header_size);
    4129 
    4130 #ifdef COFF_ENCAPSULATE
    4131   if (need_coff_header)
    4132     {
    4133       /* We are encapsulating BSD format within COFF format.  */
    4134       struct coffscn *tp, *dp, *bp;
    4135 
    4136       tp = &coffheader.scns[0];
    4137       dp = &coffheader.scns[1];
    4138       bp = &coffheader.scns[2];
    4139 
    4140       strcpy (tp->s_name, ".text");
    4141       tp->s_paddr = text_start;
    4142       tp->s_vaddr = text_start;
    4143       tp->s_size = text_size;
    4144       tp->s_scnptr = sizeof (struct coffheader) + sizeof (struct exec);
    4145       tp->s_relptr = 0;
    4146       tp->s_lnnoptr = 0;
    4147       tp->s_nreloc = 0;
    4148       tp->s_nlnno = 0;
    4149       tp->s_flags = 0x20;
    4150       strcpy (dp->s_name, ".data");
    4151       dp->s_paddr = data_start;
    4152       dp->s_vaddr = data_start;
    4153       dp->s_size = data_size;
    4154       dp->s_scnptr = tp->s_scnptr + tp->s_size;
    4155       dp->s_relptr = 0;
    4156       dp->s_lnnoptr = 0;
    4157       dp->s_nreloc = 0;
    4158       dp->s_nlnno = 0;
    4159       dp->s_flags = 0x40;
    4160       strcpy (bp->s_name, ".bss");
    4161       bp->s_paddr = dp->s_vaddr + dp->s_size;
    4162       bp->s_vaddr = bp->s_paddr;
    4163       bp->s_size = bss_size;
    4164       bp->s_scnptr = 0;
    4165       bp->s_relptr = 0;
    4166       bp->s_lnnoptr = 0;
    4167       bp->s_nreloc = 0;
    4168       bp->s_nlnno = 0;
    4169       bp->s_flags = 0x80;
    4170 
    4171       coffheader.f_magic = COFF_MAGIC;
    4172       coffheader.f_nscns = 3;
    4173       /* store an unlikely time so programs can
    4174        * tell that there is a bsd header
    4175        */
    4176       coffheader.f_timdat = 1;
    4177       coffheader.f_symptr = 0;
    4178       coffheader.f_nsyms = 0;
    4179       coffheader.f_opthdr = 28;
    4180       coffheader.f_flags = 0x103;
    4181       /* aouthdr */
    4182       coffheader.magic = ZMAGIC;
    4183       coffheader.vstamp = 0;
    4184       coffheader.tsize = tp->s_size;
    4185       coffheader.dsize = dp->s_size;
    4186       coffheader.bsize = bp->s_size;
    4187       coffheader.entry = outheader.a_entry;
    4188       coffheader.text_start = tp->s_vaddr;
    4189       coffheader.data_start = dp->s_vaddr;
    4190     }
    4191 #endif
    41923558
    41933559  if (strip_symbols == STRIP_ALL)
     
    42033569      /* One extra for following reference on indirects */
    42043570      if (output_style == OUTPUT_RELOCATABLE)
    4205 #ifndef NeXT
    42063571        nsyms += set_symbol_count + global_indirect_count;
    4207 #else
    4208         nsyms += set_symbol_count;
    4209 #endif
    42103572    }
    42113573
     
    42153577  outheader.a_syms = nsyms * sizeof (struct nlist);
    42163578
    4217 #ifdef EMX /* relocatable */
    42183579  if (output_style == OUTPUT_RELOCATABLE || reloc_flag)
    4219 #else /* !EMX */
    4220   if (output_style == OUTPUT_RELOCATABLE)
    4221 #endif /* !EMX */
    42223580    {
    42233581      outheader.a_trsize = text_reloc_size;
     
    42663624{
    42673625  lseek (outdesc, 0L, 0);
    4268 
    4269 #ifdef COFF_ENCAPSULATE
    4270   if (need_coff_header)
    4271     mywrite (&coffheader, sizeof coffheader, 1, outdesc);
    4272 #endif
    4273 
    42743626  mywrite (&outheader, sizeof (struct exec), 1, outdesc);
    4275 
    4276   /* Output whatever padding is required in the executable file
    4277      between the header and the start of the text.  */
    4278 
    4279 #ifndef COFF_ENCAPSULATE
    4280   padfile (N_TXTOFF (outheader) - sizeof outheader, outdesc);
    4281 #endif
    4282 }
    4283 
    4284 #endif
    4285 
    4286 
    4287 #ifdef MACH_O
    4288 
    4289 /* Stuff pertaining to creating Mach-O files. */
    4290 
    4291 /* Convert the Mach-O style n_sect references into something the rest
    4292    of the loader can understand.  */
    4293 
    4294 void
    4295 translate_mach_o_symbols (entry)
    4296      struct file_entry *entry;
    4297 {
    4298   int i, n, g;
    4299   struct nlist *sym;
    4300 
    4301   n = entry->syms_size / sizeof (struct nlist);
    4302   for (i = 0; i < n; ++i)
    4303     if (((sym = &entry->symbols[i])->n_type & ~N_EXT) == N_SECT)
    4304       {
    4305         if (sym->n_sect == entry->text_ordinal)
    4306           sym->n_type = (sym->n_type & N_EXT) | N_TEXT;
    4307         else if (sym->n_sect == entry->data_ordinal)
    4308           sym->n_type = (sym->n_type & N_EXT) | N_DATA;
    4309         else if (sym->n_sect == entry->bss_ordinal)
    4310           sym->n_type = (sym->n_type & N_EXT) | N_BSS;
    4311         else
    4312           fatal_with_file ("unknown section referenced in symbols of ", entry);
    4313         sym->n_sect = 0;
    4314       }
    4315     else if ((sym = &entry->symbols[i])->n_type == N_SLINE)
    4316       {
    4317         if (sym->n_sect == entry->text_ordinal)
    4318           sym->n_type = N_SLINE;
    4319         else if (sym->n_sect == entry->data_ordinal)
    4320           sym->n_type = N_DSLINE;
    4321         else if (sym->n_sect == entry->bss_ordinal)
    4322           sym->n_type = N_BSLINE;
    4323         else
    4324           fatal_with_file ("unknown section referenced in debugging symbols of ", entry);
    4325       }
    4326 }
    4327 
    4328 /* Convert Mach-O style relocation info into a.out style relocation
    4329    info internally.  */
    4330 void
    4331 translate_mach_o_relocation (entry, reloc, count)
    4332      struct file_entry *entry;
    4333      struct relocation_info *reloc;
    4334      int count;
    4335 {
    4336   int i;
    4337 
    4338   for (i = 0; i < count; ++i)
    4339     if (!RELOC_EXTERN_P(&reloc[i]))
    4340       if (RELOC_TYPE(&reloc[i]) == R_ABS)
    4341         RELOC_TYPE(&reloc[i]) = N_ABS;
    4342       else if (RELOC_TYPE(&reloc[i]) == entry->text_ordinal)
    4343         RELOC_TYPE(&reloc[i]) = N_TEXT;
    4344       else if (RELOC_TYPE(&reloc[i]) == entry->data_ordinal)
    4345         RELOC_TYPE(&reloc[i]) = N_DATA;
    4346       else if (RELOC_TYPE(&reloc[i]) == entry->bss_ordinal)
    4347         RELOC_TYPE(&reloc[i]) = N_BSS;
    4348       else
    4349         fatal_with_file ("unknown section ordinal in relocation info of ", entry);
    4350 }
    4351 
    4352 /* Header structure for OUTPUT_RELOCATABLE.  */
    4353 
    4354 struct
    4355 {
    4356   struct mach_header header;
    4357   struct segment_command segment;
    4358   struct section text;
    4359   struct section data;
    4360   struct section bss;
    4361   struct symtab_command symtab;
    4362 #ifdef LC_SYMSEG
    4363   struct symseg_command symseg;
    4364 #endif
    4365 } m_object;
    4366 
    4367 #ifdef NeXT
    4368 #define CPU_TYPE CPU_TYPE_MC68030
    4369 #define CPU_SUBTYPE CPU_SUBTYPE_NeXT
    4370 #define THREAD_FLAVOR NeXT_THREAD_STATE_REGS
    4371 #define THREAD_COUNT NeXT_THREAD_STATE_REGS_COUNT
    4372 typedef struct NeXT_thread_state_regs thread_state;
    4373 #define thread_state_entry_field pc
    4374 #endif
    4375 
    4376 /* Header structure for all executable output forms.  */
    4377 
    4378 struct
    4379 {
    4380   struct mach_header header;
    4381   struct segment_command pagezero;
    4382   struct segment_command text_segment;
    4383   struct section text;
    4384   struct segment_command data_segment;
    4385   struct section data;
    4386   struct section bss;
    4387   struct thread_command unixthread;
    4388   unsigned long int flavor;
    4389   unsigned long int count;
    4390   thread_state state;
    4391   struct symtab_command symtab;
    4392 #ifdef LC_SYMSEG
    4393   struct symseg_command symseg;
    4394 #endif
    4395 } m_exec;
    4396 
    4397 /* Compute text_start and text_header_size for an a.out file.  */
    4398 
    4399 void
    4400 initialize_mach_o_text_start ()
    4401 {
    4402   if (output_style != OUTPUT_RELOCATABLE)
    4403     {
    4404       text_header_size = sizeof m_exec;
    4405       if (!T_flag_specified && output_style != OUTPUT_RELOCATABLE)
    4406         /* We reserve the first page of an executable to trap NULL dereferences.  */
    4407         text_start = page_size;
    4408     }
    4409 }
    4410 
    4411 /* Compute data_start once text_size is known.  */
    4412 
    4413 void
    4414 initialize_mach_o_data_start ()
    4415 {
    4416   if (! Tdata_flag_specified)
    4417     data_start = text_start + text_size;
    4418 }
    4419 
    4420 /* Compute offsets of various pieces of the Mach-O output file.  */
    4421 void
    4422 compute_mach_o_section_offsets ()
    4423 {
    4424   int header_size, trsize, drsize;
    4425 
    4426   switch (output_style)
    4427     {
    4428     case OUTPUT_RELOCATABLE:
    4429       header_size = sizeof m_object;
    4430       break;
    4431     default:
    4432       header_size = sizeof m_exec;
    4433       break;
    4434     }
    4435 
    4436   if (strip_symbols == STRIP_ALL)
    4437     nsyms = 0;
    4438   else
    4439     {
    4440       nsyms = (defined_global_sym_count
    4441                + undefined_global_sym_count);
    4442       if (discard_locals == DISCARD_L)
    4443         nsyms += non_L_local_sym_count;
    4444       else if (discard_locals == DISCARD_NONE)
    4445         nsyms += local_sym_count;
    4446       /* One extra for following reference on indirects */
    4447       if (output_style == OUTPUT_RELOCATABLE)
    4448 #ifndef NeXT
    4449         nsyms += set_symbol_count + global_indirect_count;
    4450 #else
    4451         nsyms += set_symbol_count;
    4452 #endif
    4453     }
    4454 
    4455   if (strip_symbols == STRIP_NONE)
    4456     nsyms += debugger_sym_count;
    4457 
    4458   output_text_offset = header_size;
    4459   output_data_offset = output_text_offset + text_size;
    4460   output_trel_offset = output_data_offset + data_size;
    4461   if (output_style == OUTPUT_RELOCATABLE)
    4462     trsize = text_reloc_size, drsize = data_reloc_size;
    4463   else
    4464     trsize = drsize = 0;
    4465   output_drel_offset = output_trel_offset + trsize;
    4466   output_syms_offset = output_drel_offset + drsize;
    4467   output_strs_offset = output_syms_offset + nsyms * sizeof (struct nlist);
    4468 }
    4469 
    4470 /* Compute more section offsets once the size of the string table is known.  */
    4471 void
    4472 compute_more_mach_o_section_offsets ()
    4473 {
    4474   output_symseg_offset = output_strs_offset + output_strs_size;
    4475 }
    4476 
    4477 /* Write the Mach-O header once everything else is known.  */
    4478 
    4479 void
    4480 write_mach_o_header ()
    4481 {
    4482   struct mach_header header;
    4483   struct section text, data, bss;
    4484   struct symtab_command symtab;
    4485 #ifdef LC_SYMSEG
    4486   struct symseg_command symseg;
    4487 #endif
    4488   thread_state state;
    4489 
    4490   lseek (outdesc, 0L, 0);
    4491 
    4492 
    4493   header.magic = MH_MAGIC;
    4494   header.cputype = CPU_TYPE;
    4495   header.cpusubtype = CPU_SUBTYPE;
    4496   header.filetype = output_style == OUTPUT_RELOCATABLE ? MH_OBJECT : MH_EXECUTE;
    4497 #ifdef LC_SYMSEG
    4498   switch (output_style)
    4499     {
    4500     case OUTPUT_RELOCATABLE:
    4501       header.ncmds = 3;
    4502       header.sizeofcmds = sizeof m_object - sizeof header;
    4503       break;
    4504     default:
    4505       header.ncmds = 6;
    4506       header.sizeofcmds = sizeof m_exec - sizeof header;
    4507       break;
    4508     }
    4509 #else
    4510   switch (output_style)
    4511     {
    4512     case OUTPUT_RELOCATABLE:
    4513       header.ncmds = 2;
    4514       header.sizeofcmds = sizeof m_object - sizeof header;
    4515       break;
    4516     default:
    4517       header.ncmds = 5;
    4518       header.sizeofcmds = sizeof m_exec - sizeof header;
    4519       break;
    4520     }
    4521 #endif
    4522   header.flags = undefined_global_sym_count ? 0 : MH_NOUNDEFS;
    4523 
    4524   bzero((char *) &text, sizeof text);
    4525   strncpy(text.sectname, SECT_TEXT, sizeof text.sectname);
    4526   strncpy(text.segname, SEG_TEXT, sizeof text.segname);
    4527   text.addr = text_start;
    4528   text.size = text_size;
    4529   text.offset = output_text_offset;
    4530   text.align = text.addr % sizeof (double) ? sizeof (int) : sizeof (double);
    4531   text.reloff = output_trel_offset;
    4532   text.nreloc = output_style == OUTPUT_RELOCATABLE
    4533     ? text_reloc_size / sizeof (struct relocation_info) : 0;
    4534   text.flags = 0;
    4535 
    4536   bzero((char *) &data, sizeof data);
    4537   strncpy(data.sectname, SECT_DATA, sizeof data.sectname);
    4538   strncpy(data.segname, output_style == OUTPUT_WRITABLE_TEXT ? SEG_TEXT : SEG_DATA,
    4539           sizeof data.segname);
    4540   data.addr = data_start;
    4541   data.size = data_size;
    4542   data.offset = output_data_offset;
    4543   data.align = data.addr % sizeof (double) ? sizeof (int) : sizeof (double);
    4544   data.reloff = output_drel_offset;
    4545   data.nreloc = output_style == OUTPUT_RELOCATABLE
    4546     ? data_reloc_size / sizeof (struct relocation_info) : 0;
    4547   data.flags = 0;
    4548 
    4549   bzero((char *) &bss, sizeof bss);
    4550   strncpy(bss.sectname, SECT_BSS, sizeof data.sectname);
    4551   strncpy(bss.segname, output_style == OUTPUT_WRITABLE_TEXT ? SEG_TEXT : SEG_DATA,
    4552           sizeof bss.segname);
    4553   bss.addr = data_start + data_size;
    4554   bss.size = bss_size;
    4555   bss.align = bss.addr % sizeof (double) ? sizeof (int) : sizeof (double);
    4556   bss.reloff = 0;
    4557   bss.nreloc = 0;
    4558   bss.flags = S_ZEROFILL;
    4559 
    4560   symtab.cmd = LC_SYMTAB;
    4561   symtab.cmdsize = sizeof symtab;
    4562   symtab.symoff = output_syms_offset;
    4563   symtab.nsyms = output_syms_size / sizeof (struct nlist);
    4564   symtab.stroff = output_strs_offset;
    4565   symtab.strsize = output_strs_size;
    4566 
    4567 #ifdef LC_SYMSEG
    4568   symseg.cmd = LC_SYMSEG;
    4569   symseg.cmdsize = sizeof symseg;
    4570   symseg.offset = output_symseg_offset;
    4571   symseg.size = output_symseg_size;
    4572 #endif
    4573 
    4574   switch (output_style)
    4575     {
    4576     case OUTPUT_RELOCATABLE:
    4577       m_object.header = header;
    4578       m_object.segment.cmd = LC_SEGMENT;
    4579       m_object.segment.cmdsize = sizeof (struct segment_command) + 3 * sizeof (struct section);
    4580       strncpy(m_object.segment.segname, SEG_TEXT, sizeof m_object.segment.segname);
    4581       m_object.segment.vmaddr = 0;
    4582       m_object.segment.vmsize = text.size + data.size + bss.size;
    4583       m_object.segment.fileoff = text.offset;
    4584       m_object.segment.filesize = text.size + data.size;
    4585       m_object.segment.maxprot = VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE;
    4586       m_object.segment.initprot = VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE;
    4587       m_object.segment.nsects = 3;
    4588       m_object.segment.flags = 0;
    4589       m_object.text = text;
    4590       m_object.data = data;
    4591       m_object.bss = bss;
    4592       m_object.symtab = symtab;
    4593 #ifdef LC_SYMSEG
    4594       m_object.symseg = symseg;
    4595 #endif
    4596       mywrite((char *) &m_object, 1, sizeof m_object, outdesc);
    4597       break;
    4598 
    4599     default:
    4600       m_exec.header = header;
    4601       m_exec.pagezero.cmd = LC_SEGMENT;
    4602       m_exec.pagezero.cmdsize = sizeof (struct segment_command);
    4603       strncpy(m_exec.pagezero.segname, SEG_PAGEZERO, sizeof m_exec.pagezero.segname);
    4604       m_exec.pagezero.vmaddr = 0;
    4605       m_exec.pagezero.vmsize = page_size;
    4606       m_exec.pagezero.fileoff = 0;
    4607       m_exec.pagezero.filesize = 0;
    4608       m_exec.pagezero.maxprot = VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE;
    4609       m_exec.pagezero.initprot = 0;
    4610       m_exec.pagezero.nsects = 0;
    4611       m_exec.pagezero.flags = 0;
    4612       m_exec.text_segment.cmd = LC_SEGMENT;
    4613       m_exec.text_segment.cmdsize = sizeof (struct segment_command) + sizeof (struct section);
    4614       strncpy(m_exec.text_segment.segname, SEG_TEXT, sizeof m_exec.text_segment.segname);
    4615       m_exec.text_segment.vmaddr = text_start;
    4616       m_exec.text_segment.vmsize = text_size;
    4617       m_exec.text_segment.fileoff = output_text_offset;
    4618       m_exec.text_segment.filesize = text_size;
    4619       m_exec.text_segment.maxprot = VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE;
    4620       m_exec.text_segment.initprot = VM_PROT_READ | VM_PROT_EXECUTE;
    4621       if (output_style == OUTPUT_WRITABLE_TEXT)
    4622         m_exec.text_segment.initprot |= VM_PROT_WRITE;
    4623       m_exec.text_segment.nsects = 1;
    4624       m_exec.text_segment.flags = 0;
    4625       m_exec.text = text;
    4626       m_exec.data_segment.cmd = LC_SEGMENT;
    4627       m_exec.data_segment.cmdsize = sizeof (struct segment_command) + 2 * sizeof (struct section);
    4628       strncpy(m_exec.data_segment.segname, SEG_DATA, sizeof m_exec.data_segment.segname);
    4629       m_exec.data_segment.vmaddr = data_start;
    4630       m_exec.data_segment.vmsize = data_size + bss_size;
    4631       m_exec.data_segment.fileoff = output_data_offset;
    4632       m_exec.data_segment.filesize = data_size;
    4633       m_exec.data_segment.maxprot = VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE;
    4634       m_exec.data_segment.initprot = VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE;
    4635       m_exec.data_segment.nsects = 2;
    4636       m_exec.data_segment.flags = 0;
    4637       m_exec.data = data;
    4638       m_exec.bss = bss;
    4639       m_exec.unixthread.cmd = LC_UNIXTHREAD;
    4640       m_exec.unixthread.cmdsize
    4641         = sizeof (struct thread_command) + 2 * sizeof (long int) + sizeof (thread_state);
    4642       m_exec.flavor = THREAD_FLAVOR;
    4643       m_exec.count = THREAD_COUNT;
    4644       m_exec.state.thread_state_entry_field = entry_symbol
    4645         ? entry_symbol->value : text_start + text_header_size;
    4646       m_exec.symtab = symtab;
    4647 #ifdef LC_SYMSEG
    4648       m_exec.symseg = symseg;
    4649 #endif
    4650       mywrite((char *) &m_exec, 1, sizeof m_exec, outdesc);
    4651       break;
    4652     }
    4653 }
    4654 
    4655 /* Translate a.out style symbols into Mach-O style symbols.  */
    4656 
    4657 void
    4658 generate_mach_o_symbols (syms, nsyms)
    4659      struct nlist *syms;
    4660      int nsyms;
    4661 {
    4662   int i;
    4663 
    4664   for (i = 0; i < nsyms; ++i)
    4665     switch (syms[i].n_type)
    4666       {
    4667       case N_TEXT:
    4668       case N_TEXT | N_EXT:
    4669         syms[i].n_type = syms[i].n_type & N_EXT | N_SECT;
    4670         syms[i].n_sect = 1;     /* text section ordinal */
    4671         break;
    4672       case N_DATA:
    4673       case N_DATA | N_EXT:
    4674         syms[i].n_type = syms[i].n_type & N_EXT | N_SECT;
    4675         syms[i].n_sect = 2;     /* data section ordinal */
    4676         break;
    4677       case N_BSS:
    4678       case N_BSS | N_EXT:
    4679         syms[i].n_type = syms[i].n_type & N_EXT | N_BSS;
    4680         syms[i].n_sect = 3;     /* bss section ordinal */
    4681         break;
    4682       case N_SLINE:
    4683         syms[i].n_type = N_SLINE;
    4684         syms[i].n_sect = 1;     /* text section ordinal */
    4685         break;
    4686       case N_DSLINE:
    4687         syms[i].n_type = N_SLINE;
    4688         syms[i].n_sect = 2;     /* data section ordinal */
    4689         break;
    4690       case N_BSLINE:
    4691         syms[i].n_type = N_SLINE;
    4692         syms[i].n_sect = 3;     /* bss section ordinal */
    4693         break;
    4694       }
    4695 }
    4696 
    4697 /* Translate a.out style relocation info into Mach-O style relocation
    4698    info.  */
    4699 
    4700 void
    4701 generate_mach_o_relocations (reloc, nreloc)
    4702      struct relocation_info *reloc;
    4703      int nreloc;
    4704 {
    4705   int i;
    4706 
    4707   for (i = 0; i < nreloc; ++i)
    4708     if (!RELOC_EXTERN_P (&reloc[i]))
    4709       switch (RELOC_TYPE (&reloc[i]))
    4710         {
    4711         case N_ABS:
    4712         case N_ABS | N_EXT:
    4713           RELOC_TYPE (&reloc[i]) = R_ABS;
    4714           break;
    4715         case N_TEXT:
    4716         case N_TEXT | N_EXT:
    4717           RELOC_TYPE (&reloc[i]) = 1; /* output text section ordinal */
    4718           break;
    4719         case N_DATA:
    4720         case N_DATA | N_EXT:
    4721           RELOC_TYPE (&reloc[i]) = 2; /* output data section ordinal */
    4722           break;
    4723         case N_BSS:
    4724         case N_BSS | N_EXT:
    4725           RELOC_TYPE (&reloc[i]) = 3; /* output bss section ordinal */
    4726           break;
    4727         }
    47283627}
    47293628
     
    47473646    }
    47483647#endif
    4749 #ifdef MACH_O
    4750   if (output_file_type == IS_MACH_O)
    4751     {
    4752       initialize_mach_o_text_start ();
     3648  fatal ("unknown output file type (enum file_type)", (char *) 0);
     3649}
     3650
     3651/* Initialize data_start as appropriate to the output format, once text_size
     3652   is known.  */
     3653
     3654void
     3655initialize_data_start ()
     3656{
     3657#ifdef A_OUT
     3658  if (output_file_type == IS_A_OUT)
     3659    {
     3660      initialize_a_out_data_start ();
    47533661      return;
    47543662    }
     
    47573665}
    47583666
    4759 /* Initialize data_start as appropriate to the output format, once text_size
    4760    is known.  */
    4761 
    4762 void
    4763 initialize_data_start ()
     3667/* Compute offsets of the various sections within the output file.  */
     3668
     3669void
     3670compute_section_offsets ()
    47643671{
    47653672#ifdef A_OUT
    47663673  if (output_file_type == IS_A_OUT)
    47673674    {
    4768       initialize_a_out_data_start ();
    4769       return;
    4770     }
    4771 #endif
    4772 #ifdef MACH_O
    4773   if (output_file_type == IS_MACH_O)
    4774     {
    4775       initialize_mach_o_data_start ();
     3675      compute_a_out_section_offsets ();
    47763676      return;
    47773677    }
     
    47803680}
    47813681
    4782 /* Compute offsets of the various sections within the output file.  */
    4783 
    4784 void
    4785 compute_section_offsets ()
     3682/* Compute more section offsets, once the size of the string table
     3683   is finalized.  */
     3684void
     3685compute_more_section_offsets ()
    47863686{
    47873687#ifdef A_OUT
    47883688  if (output_file_type == IS_A_OUT)
    47893689    {
    4790       compute_a_out_section_offsets ();
    4791       return;
    4792     }
    4793 #endif
    4794 #ifdef MACH_O
    4795   if (output_file_type == IS_MACH_O)
    4796     {
    4797       compute_mach_o_section_offsets ();
     3690      compute_more_a_out_section_offsets ();
    47983691      return;
    47993692    }
     
    48023695}
    48033696
    4804 /* Compute more section offsets, once the size of the string table
    4805    is finalized.  */
    4806 void
    4807 compute_more_section_offsets ()
     3697/* Write the output file header, once everything is known.  */
     3698void
     3699write_header ()
    48083700{
    48093701#ifdef A_OUT
    48103702  if (output_file_type == IS_A_OUT)
    48113703    {
    4812       compute_more_a_out_section_offsets ();
    4813       return;
    4814     }
    4815 #endif
    4816 #ifdef MACH_O
    4817   if (output_file_type == IS_MACH_O)
    4818     {
    4819       compute_more_mach_o_section_offsets ();
     3704      write_a_out_header ();
    48203705      return;
    48213706    }
     
    48243709}
    48253710
    4826 /* Write the output file header, once everything is known.  */
    4827 void
    4828 write_header ()
    4829 {
    4830 #ifdef A_OUT
    4831   if (output_file_type == IS_A_OUT)
    4832     {
    4833       write_a_out_header ();
    4834       return;
    4835     }
    4836 #endif
    4837 #ifdef MACH_O
    4838   if (output_file_type == IS_MACH_O)
    4839     {
    4840       write_mach_o_header ();
    4841       return;
    4842     }
    4843 #endif
    4844   fatal ("unknown output file type (enum file_type)", (char *) 0);
    4845 }
    4846 
    4847 
    4848 #ifdef EMX /* emxbind */
     3711
    48493712/* Parse output_filename and decide whether to create an exe file or not */
    48503713
     
    49113774    unlink (touch_filename);
    49123775}
    4913 #endif /* EMX */
    49143776
    49153777/* Write the output file */
     
    49313793  (void) unlink (output_filename);
    49323794
    4933 #ifdef __EMX__
    49343795  outdesc = open (output_filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666);
    4935 #else /* !__EMX__ */
    4936   outdesc = open (output_filename, O_WRONLY | O_CREAT | O_TRUNC, 0666);
    4937 #endif /* !__EMX__ */
    49383796  if (outdesc < 0) perror_name (output_filename);
    49393797
     
    49433801  filemode = statbuf.st_mode;
    49443802
    4945 #ifndef __EMX__
    49463803  chmod (output_filename, filemode & ~0111);
    4947 #endif /* !__EMX__ */
    4948 
    4949 #ifdef EMX /* relocatable */
     3804
    49503805  if (reloc_flag)
    49513806    global_indirect_count = 0;
    4952 #endif /* EMX */
    49533807
    49543808  /* Calculate the offsets of the various pieces of the output file.  */
     
    49603814
    49613815  /* Output the merged relocation info, if requested with `-r'.  */
    4962 #ifdef EMX /* relocatable */
    49633816  if (output_style == OUTPUT_RELOCATABLE || reloc_flag)
    4964 #else /* !EMX */
    4965   if (output_style == OUTPUT_RELOCATABLE)
    4966 #endif /* !EMX */
    49673817    write_rel ();
    49683818
     
    49883838    perror_name (output_filename);
    49893839
    4990 #ifdef EMX /* emxbind */
    49913840  if (rsxnt_linked == EMX_DEFAULT && exe_filename != NULL)
    49923841    {
     
    51083957        }
    51093958    }
    5110 #endif /* EMX */
    51113959}
    51123960
     
    51754023      entry->datarel = reloc;
    51764024    }
    5177 
    5178 #ifdef MACH_O
    5179   if (entry->file_type == IS_MACH_O)
    5180     {
    5181       translate_mach_o_relocation (entry, entry->textrel,
    5182                                    entry->text_reloc_size / sizeof (struct relocation_info));
    5183       translate_mach_o_relocation (entry, entry->datarel,
    5184                                    entry->data_reloc_size / sizeof (struct relocation_info));
    5185     }
    5186 #endif
    51874025}
    51884026
     
    52114049
    52124050  if (entry->textrel)  reloc = entry->textrel;
    5213 #ifdef EMX /* relocatable */
    52144051  else if (output_style == OUTPUT_RELOCATABLE || reloc_flag)
    5215 #else /* !EMX */
    5216   else if (output_style == OUTPUT_RELOCATABLE)
    5217 #endif /* !EMX */
    52184052    {
    52194053      read_file_relocation (entry);
     
    52264060      if (entry->text_reloc_size != read (desc, reloc, entry->text_reloc_size))
    52274061        fatal_with_file ("premature eof in text relocation of ", entry);
    5228 #ifdef MACH_O
    5229       if (entry->file_type == IS_MACH_O)
    5230         translate_mach_o_relocation (entry, reloc,
    5231                                      entry->text_reloc_size / sizeof (struct relocation_info));
    5232 #endif
    52334062    }
    52344063
     
    52674096     description of length of the set vector section.  */
    52684097
    5269 #ifdef FIXSETBUG
    52704098  padfile (set_sect_pad, outdesc);
    5271 #endif /* FIXSETBUG */
    52724099
    52734100  if (set_vector_count)
    5274 #ifdef FIXSETBUG
    52754101    mywrite (set_vectors, set_symbol_count + 2 * set_vector_count,
    52764102             sizeof (unsigned long), outdesc);
    5277 #else /* !FIXSETBUG */
    5278     mywrite (set_vectors, 2 * set_symbol_count + set_vector_count,
    5279              sizeof (unsigned long), outdesc);
    5280 #endif /* !FIXSETBUG */
    52814103
    52824104  if (trace_files)
     
    53074129
    53084130  if (entry->datarel) reloc = entry->datarel;
    5309 #ifdef EMX /* relocatable */
    53104131  else if (output_style == OUTPUT_RELOCATABLE || reloc_flag) /* Will need this again */
    5311 #else /* !EMX */
    5312   else if (output_style == OUTPUT_RELOCATABLE)  /* Will need this again */
    5313 #endif /* !EMX */
    53144132    {
    53154133      read_file_relocation (entry);
     
    53224140      if (entry->data_reloc_size != read (desc, reloc, entry->data_reloc_size))
    53234141        fatal_with_file ("premature eof in data relocation of ", entry);
    5324 #ifdef MACH_O
    5325       if (entry->file_type == IS_MACH_O)
    5326         translate_mach_o_relocation (entry, reloc,
    5327                                      entry->data_reloc_size / sizeof (struct relocation_info));
    5328 #endif
    53294142    }
    53304143
     
    54594272      /* Unshifted mask for relocation */
    54604273      mask = (1 << RELOC_TARGET_BITSIZE(p)) - 1;
    5461       mask |= mask - 1;
    54624274      relocation &= mask;
    54634275
     
    55454357          {
    55464358            sp->def_count = count++;
    5547 #ifndef NeXT
    55484359            /* Leave room for the reference required by N_INDR, if
    55494360               necessary.  */
    55504361            if ((sp->defined & ~N_EXT) == N_INDR)
    5551 #ifdef EMX /* relocatable */
    55524362              if (!reloc_flag)
    5553 #endif /* EMX */
    5554               count++;
    5555 #endif
     4363                count++;
    55564364          }
    55574365    }
    55584366  /* Correct, because if (OUTPUT_RELOCATABLE), we will also be writing
    55594367     whatever indirect blocks we have.  */
    5560 #ifndef NeXT
    55614368  if (count != defined_global_sym_count
    55624369      + undefined_global_sym_count + global_indirect_count)
    5563 #else
    5564   if (count != defined_global_sym_count
    5565       + undefined_global_sym_count)
    5566 #endif
    55674370    fatal ("internal error");
    55684371
     
    55774380  lseek (outdesc, output_drel_offset, 0);
    55784381  each_full_file (copdatrel, 0);
    5579 #ifdef EMX /* relocatable */
    55804382  if (reloc_flag)
    55814383    {
     
    56044406          }
    56054407    }
    5606 #endif /* EMX */
    56074408
    56084409  if (trace_files)
     
    56424443             to an internal one.  */
    56434444
    5644 #ifdef EMX /* import */
    56454445          if (symptr->defined && symptr->defined != (N_IMP1 | N_EXT))
    5646 #else /* !EMX */
    5647           if (symptr->defined)
    5648 #endif /* !EMX */
    56494446            {
    56504447              RELOC_EXTERN_P(p) = 0;
    56514448              RELOC_SYMBOL(p) = (symptr->defined & ~N_EXT);
    5652 #ifdef EMX /* relocatable */
    56534449              if (RELOC_SYMBOL (p) == N_SETV)
    56544450                RELOC_SYMBOL (p) = N_DATA;
    5655 #endif /* EMX */
    56564451#ifdef RELOC_ADD_EXTRA
    56574452              /* If we aren't going to be adding in the value in
     
    56664461            /* Debugger symbols come first, so have to start this
    56674462               after them.  */
    5668 #ifndef NeXT
    56694463              RELOC_SYMBOL(p) = (symptr->def_count + nsyms
    56704464                                 - defined_global_sym_count
    56714465                                 - undefined_global_sym_count
    56724466                                 - global_indirect_count);
    5673 #else
    5674               RELOC_SYMBOL(p) = (symptr->def_count + nsyms
    5675                                  - defined_global_sym_count
    5676                                  - undefined_global_sym_count);
    5677 #endif
    56784467        }
    56794468      p++;
    56804469    }
    5681 
    5682 #ifdef MACH_O
    5683   if (output_file_type == IS_MACH_O)
    5684     generate_mach_o_relocations(entry->textrel,
    5685                                 entry->text_reloc_size / sizeof (struct relocation_info));
    5686 #endif
    56874470
    56884471  mywrite (entry->textrel, 1, entry->text_reloc_size, outdesc);
     
    57094492      if (RELOC_EXTERN_P(p))
    57104493        {
    5711           register int symindex = RELOC_SYMBOL(p) * sizeof (struct nlist);
    5712           symbol *symptr = ((symbol *)
    5713                             (((struct nlist *)
    5714                               (((char *)entry->symbols) + symindex))
    5715                              ->n_un.n_name));
     4494          register int symindex = RELOC_SYMBOL(p);
     4495          symbol *symptr = (symbol *)(entry->symbols [symindex].n_un.n_name);
    57164496          int symtype;
    57174497
    5718           if (symindex >= entry->syms_size)
     4498          if (symindex >= (entry->syms_size / sizeof (struct nlist)))
    57194499            fatal_with_file ("relocation symbolnum out of range in ", entry);
    57204500
     
    57254505#endif
    57264506
    5727 #ifdef EMX
    5728           if ((symtype = symptr->defined) != (N_IMP1 | N_EXT))
    5729 #endif
    5730             symtype = symptr->defined & ~N_EXT;
    5731 
    5732 #ifdef EMX /* relocatable */
    5733           if ((force_common_definition || reloc_flag)
    5734            && (symtype != (N_IMP1 | N_EXT)))
    5735 #endif /* EMX */
     4507          symtype = symptr->defined & ~N_EXT;
     4508
    57364509          if (force_common_definition
    5737               || symtype == N_DATA || symtype == N_TEXT || symtype == N_ABS)
     4510              || (reloc_flag && symtype != N_IMP1)
     4511              || symtype == N_DATA || symtype == N_TEXT
     4512              || symtype == N_ABS || symtype == N_BSS)
    57384513            {
    5739 #ifdef EMX /* relocatable */
    57404514              if (symtype == N_SETV)
    57414515                symtype = N_DATA;
    5742 #endif /* EMX */
    57434516              RELOC_EXTERN_P(p) = 0;
    57444517              RELOC_SYMBOL(p) = symtype;
     
    57474520            /* Debugger symbols come first, so have to start this
    57484521               after them.  */
    5749 #ifndef NeXT
    5750             RELOC_SYMBOL(p)
    5751 #ifdef EMX
    5752               = (symptr
    5753 #else /* not EMX */
    5754               = (((symbol *)
    5755                   (((struct nlist *)
    5756                     (((char *)entry->symbols) + symindex))
    5757                    ->n_un.n_name))
    5758 #endif /* not EMX */
    5759                  ->def_count
     4522            RELOC_SYMBOL(p) = (symptr->def_count
    57604523                 + nsyms - defined_global_sym_count
    57614524                 - undefined_global_sym_count
    57624525                 - global_indirect_count);
    5763 #else
    5764             RELOC_SYMBOL(p)
    5765               = (((symbol *)
    5766                   (((struct nlist *)
    5767                     (((char *)entry->symbols) + symindex))
    5768                    ->n_un.n_name))
    5769                  ->def_count
    5770                  + nsyms - defined_global_sym_count
    5771                  - undefined_global_sym_count);
     4526
     4527#if 0
     4528          if ((symtype = symptr->defined) != (N_IMP1 | N_EXT))
     4529            symtype = symptr->defined & ~N_EXT;
     4530
     4531          if ((force_common_definition || reloc_flag)
     4532           && (symtype != (N_IMP1 | N_EXT)))
     4533          {
     4534            if (force_common_definition
     4535                || symtype == N_DATA || symtype == N_TEXT || symtype == N_ABS)
     4536              {
     4537                if (symtype == N_SETV)
     4538                  symtype = N_DATA;
     4539                RELOC_EXTERN_P(p) = 0;
     4540                RELOC_SYMBOL(p) = symtype;
     4541              }
     4542            else
     4543              /* Debugger symbols come first, so have to start this
     4544                 after them.  */
     4545              RELOC_SYMBOL(p) = (symptr->def_count
     4546                   + nsyms - defined_global_sym_count
     4547                   - undefined_global_sym_count
     4548                   - global_indirect_count);
     4549          }
    57724550#endif
    57734551        }
    57744552      p++;
    57754553    }
    5776 #ifdef MACH_O
    5777   if (output_file_type == IS_MACH_O)
    5778     generate_mach_o_relocations(entry->datarel,
    5779                                 entry->data_reloc_size / sizeof (struct relocation_info));
    5780 #endif
    57814554
    57824555  mywrite (entry->datarel, 1, entry->data_reloc_size, outdesc);
     
    58324605
    58334606  if (!outstream)
    5834 #ifdef __EMX__
    58354607    outstream = fdopen (outdesc, "wb");
    5836 #else /* !__EMX__ */
    5837     outstream = fdopen (outdesc, "w");
    5838 #endif /* !__EMX__ */
    58394608
    58404609  for (i = 0; i < strtab_index; i++)
     
    58654634     extra struct for each indirect symbol to hold the extra reference
    58664635     following. */
    5867   struct nlist *buf
    5868 #ifndef NeXT
    5869     = (struct nlist *) alloca ((defined_global_sym_count
     4636  struct nlist *buf = (struct nlist *) alloca ((defined_global_sym_count
    58704637                                + undefined_global_sym_count
    58714638                                + global_indirect_count)
    5872                                * sizeof (struct nlist));
    5873 #else
    5874     = (struct nlist *) alloca ((defined_global_sym_count
    5875                                 + undefined_global_sym_count)
    5876                                * sizeof (struct nlist));
    5877 #endif
     4639                                * sizeof (struct nlist));
    58784640  /* Pointer for storing into BUF.  */
    58794641  register struct nlist *bufp = buf;
     
    59554717                nl.n_value = sp->max_common_size;
    59564718              }
    5957 #ifdef EMX /* WEAK */
    59584719            else if (!sp->defined && sp->weak)
    59594720              {
     
    59614722                nl.n_value = 0;
    59624723              }
    5963 #endif /* EMX */
    59644724            else if (!sp->defined)            /* undefined -- legit only if -r */
    59654725              {
     
    59794739            syms_written++;
    59804740            if (nl.n_type == (N_INDR | N_EXT))
    5981 #ifndef NeXT
    59824741              {
    59834742                struct nlist xtra_ref;
     
    59954754                syms_written++;
    59964755              }
    5997 #else
    5998             nl.n_value = assign_string_table_index (((symbol *) sp->value)->name);
    5999 #endif
    60004756          }
    60014757      }
    6002 
    6003 #ifdef MACH_O
    6004   if (output_file_type == IS_MACH_O)
    6005     generate_mach_o_symbols(buf, bufp - buf);
    6006 #endif
    60074758
    60084759  /* Output the buffer full of `struct nlist's.  */
     
    61034854      /* WRITE gets 1 for a non-global symbol that should be written.  */
    61044855
    6105 
    61064856      if (SET_ELEMENT_P (type)) /* This occurs even if global.  These */
    61074857                                /* types of symbols are never written */
     
    61374887    }
    61384888
    6139 #ifdef MACH_O
    6140   if (output_file_type == IS_MACH_O)
    6141     generate_mach_o_symbols(buf, bufp - buf);
    6142 #endif
    6143 
    61444889  /* All the symbols are now in BUF; write them.  */
    61454890
     
    62725017  symbol_define ("__etext", N_TEXT | N_EXT, &etext_symbol_alt);
    62735018  symbol_define ("__end", N_BSS | N_EXT, &end_symbol_alt);
    6274 
    6275 #ifdef sun
    6276   {
    6277     symbol *dynamic_symbol;
    6278     symbol_define ("__DYNAMIC", N_ABS | N_EXT, &dynamic_symbol);
    6279     if (dynamic_symbol)
    6280       dynamic_symbol->value = 0;
    6281   }
    6282 #endif
    6283 #ifdef sequent
    6284   {
    6285     symbol *i387_flt_symbol;
    6286     symbol_define ("_387_flt", N_ABS | N_EXT, &i387_flt_symbol);
    6287     if (i387_flt_symbol)
    6288       i387_flt_symbol->value = 0;
    6289   }
    6290 #endif
    6291 #ifdef NeXT
    6292   {
    6293     symbol *shlib_init_symbol;
    6294     symbol_define ("__shared_library_initialization", N_UNDF | N_EXT, &shlib_init_symbol);
    6295     if (shlib_init_symbol)
    6296       shlib_init_symbol->max_common_size = sizeof (long int);
    6297   }
    6298 #endif
    62995019}
    63005020
     
    63515071  bp->undef_refs = 0;
    63525072  bp->multiply_defined = 0;
    6353 #ifdef EMX /* WEAKU */
    63545073  bp->weak = 0;
    6355 #endif /* EMX */
    63565074
    63575075  /* Add the entry to the bucket.  */
     
    64455163     char *name;
    64465164{
    6447 #ifndef __EMX__
    6448   extern int errno, sys_nerr;
    6449   extern char *sys_errlist[];
    6450 #endif /* !__EMX__ */
    64515165  char *s;
    64525166
     
    64655179     struct file_entry *entry;
    64665180{
    6467 #ifndef __EMX__
    6468   extern int errno, sys_nerr;
    6469   extern char *sys_errlist[];
    6470 #endif /* !__EMX__ */
    64715181  char *s;
    64725182
     
    65905300
    65915301
    6592 #ifdef USG
    6593 
    6594 void
    6595 bzero (p, n)
    6596      char *p;
    6597 {
    6598   memset (p, 0, n);
    6599 }
    6600 
    6601 void
    6602 bcopy (from, to, n)
    6603      char *from, *to;
    6604 {
    6605   memcpy (to, from, n);
    6606 }
    6607 
    6608 getpagesize ()
    6609 {
    6610   return (4096);
    6611 }
    6612 
    6613 #endif
    6614 
    6615 #if defined(sun) && defined(sparc)
    6616 int
    6617 getpagesize ()
    6618 {
    6619   return 8192;
    6620 }
    6621 #endif
    6622 
    6623 #ifdef EMX /* demangling */
    6624 
    66255302char *my_cplus_demangle (const char *mangled)
    66265303{
     
    66295306  return cplus_demangle (mangled, demangle_options);
    66305307}
    6631 
    6632 #endif /* EMX */
  • trunk/src/emx/src/lib/alias/alias.smak

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r235 r236  
    2727$.$(.TARG): $.$(.TKIND.DIR)c.a $.$(.TKIND.DIR)c_app.a
    2828        $(call RM,$@)
     29        @$(call DO.STDALIAS,_strcasecmp,__std_stricmp,$.strcasecmp.o)
     30        @$(call DO.STDALIAS,_strncasecmp,__std_strnicmp,$.strncasecmp.o)
    2931        @$(foreach x,$(ALIAS.FUNCS),\
    30           $(call DO.STDALIAS,_$x,__std_$x,$(dir $@)$x.o)$(NL))
     32          $(call DO.STDALIAS,_$x,__std_$x,$.$x.o)$(NL))
    3133        @$(foreach x,$(ALIAS._FUNCS),\
    32           $(call DO.STDALIAS,__$x,__std_$x,$(dir $@)_$x.o)$(NL))
    33         $(AR) $(ARFLAGS) $@ $(addprefix $(dir $@),\
     34          $(call DO.STDALIAS,__$x,__std_$x,$._$x.o)$(NL))
     35        $(AR) $(ARFLAGS) $@ $(addprefix $.,\
     36          strcasecmp.o strncasecmp.o \
    3437          $(addsuffix .o,$(ALIAS.FUNCS) $(addprefix _,$(ALIAS._FUNCS))))
    35         @$(call RM,$(addprefix $(dir $@),$(addsuffix .o,$(ALIAS.FUNCS)\
    36           $(addprefix _,$(ALIAS._FUNCS)))))
     38        @$(call RM,$(addprefix $., \
     39          strcasecmp.o strncasecmp.o \
     40          $(addsuffix .o,$(ALIAS.FUNCS) $(addprefix _,$(ALIAS._FUNCS)))))
    3741
    3842include comend.smak
  • trunk/src/emx/src/lib/alias/aliasfuncs.awk

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r235 r236  
    3737  gulp(ARGV[1]"aout/c.a");
    3838  gulp(ARGV[1]"aout/c_app.a");
     39  gulp(ARGV[1]"aout/src/lib/startup/386/crt0.o");
    3940
    4041  prefix = ARGV[2];
    4142
    4243  for (x in stdfuncs)
    43     if (funcs[prefix""x] == "")
     44    if (funcs[prefix x] == "")
    4445      print x;
    4546
  • trunk/src/emx/src/lib/app/app.smak

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r235 r236  
    11.MODULE := app
    22.MDESC  := EMX.DLL 'replacement' for statically linked programs
     3.MDEP   := libc
    34
    45# Build two kinds of library: aout and aout-profile.
     
    78.TKIND  := aout
    89.TARGET := c_app.a
    9 .TSRC.386 := src/lib/app/386/crt2.s
    10 .TSRC   := $(.TSRC.$(CPU)) $(wildcard src/lib/app/*.c)
     10.TSRC   := $(wildcard src/lib/app/*.c)
     11.TCF    := -I$.
    1112.TCF.src/lib/app/stdio.c := -D_NFILES=40
    1213.TCF.src/lib/app/iodata.c := -D_NFILES=40
  • trunk/src/emx/src/lib/app/stdio.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r235 r236  
    1515extern int _files[];
    1616
    17 #if defined (__MT__)
    1817_rmutex _streamv_rmutex;        /* See io/_newstre.c */
    19 #endif
    2018
    2119
     
    2725struct streamvec _streamvec_head = {_streamv, NULL, _NFILES};
    2826
    29 #if defined (__MT__)
    30 
    3127/* If we don't preallocate the first entry, _CRT_init() will call
    3228   malloc() which breaks fork() because the heap object of the EXE
     
    3733struct streamvec2 _streamvec2_head = {_streamv2, NULL, _NFILES};
    3834
    39 #endif
    40 
    4135/* The buffer for stdin. */
    4236
     
    4539
    4640/* Initialize the streams -- this function will be called by
    47    _startup() via the __crtinit1__ set vector. */
     41   _CRT_init() via the __crtinit1__ set vector. */
    4842
    4943void _init_streams (void)
     
    5145  int i;
    5246
    53 #if defined (__MT__)
    5447  _rmutex_checked_create (&_streamv_rmutex, 0);
    55 #endif
    5648
    5749  for (i = 0; i < _nfiles && i < _streamvec_head.n; ++i)
     
    118110
    119111
    120 /* Shutdown the streams -- this function will be called by _cleanup()
     112/* Shutdown the streams -- this function will be called by _CRT_term()
    121113   via the __crtexit1__ set vector.  Do not close the streams as this
    122114   function is called by abort() and the signal handler might want to
  • trunk/src/emx/src/lib/conv/atod.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* atod.c (emx+gcc) -- Copyright (c) 1996-1998 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <ctype.h>
  • trunk/src/emx/src/lib/conv/bicmpbb.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* bicmpbb.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <emx/bigint.h>
    45
  • trunk/src/emx/src/lib/conv/bicmpp2.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* bicmpp2.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <emx/bigint.h>
    45
  • trunk/src/emx/src/lib/conv/bidivbb.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* bidivbb.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <alloca.h>
    45#include <assert.h>
  • trunk/src/emx/src/lib/conv/bidivp2.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* bidivp2.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <assert.h>
    45#include <emx/bigint.h>
  • trunk/src/emx/src/lib/conv/bifls.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* bifls.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <string.h>
    45#include <sys/builtin.h>
  • trunk/src/emx/src/lib/conv/bihdivb.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* bihdivb.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <assert.h>
    45#include <sys/builtin.h>
  • trunk/src/emx/src/lib/conv/bipow5.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* bipow5.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <alloca.h>
  • trunk/src/emx/src/lib/conv/bisetb.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* bisetb.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <string.h>
    45#include <emx/bigint.h>
  • trunk/src/emx/src/lib/conv/bisetd.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* bisetd.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <emx/bigint.h>
    45
  • trunk/src/emx/src/lib/conv/bisetw.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* bisetw.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <emx/bigint.h>
    45
  • trunk/src/emx/src/lib/conv/bishlb.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* bishlb.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <emx/bigint.h>
    45
  • trunk/src/emx/src/lib/conv/bishlw.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* bishlw.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <emx/bigint.h>
    45
  • trunk/src/emx/src/lib/conv/bishrb.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* bishrb.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <emx/bigint.h>
    45
  • trunk/src/emx/src/lib/conv/biwdivp2.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* biwdivp2.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <assert.h>
    45#include <emx/bigint.h>
  • trunk/src/emx/src/lib/conv/conv.smak

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    1 libc.TSRC.386 += $(addprefix src/lib/conv/386/,biaddbb.s bidivbw.s \
    2   bidivhlp.s bimulbb.s bimulbw.s bisubmbw.s)
    3 libc.TSRC += $(addprefix src/lib/conv/, atod.c atof.c atofl.c atoi.c \
    4   atol.c atoll.c dtoa.c gcvt.c itoa.c lltoa.c ltoa.c remzeros.c smalatod.c \
    5   smaldtoa.c strtod.c strtof.c strtol.c strtold.c ulltoa.c ultoa.c \
    6   bicmpbb.c bicmpp2.c bidivbb.c bidivp2.c bifls.c bihdivb.c bipow5.c \
    7   bisetb.c bisetd.c bisetw.c bishlb.c bishlw.c bishrb.c biwdivp2.c)
     1libc.TSRC.386 += $(filter-out %smallcnv.s,$(wildcard src/lib/conv/386/*.s))
     2libc.TSRC += $(filter-out %makepow5.c,$(wildcard src/lib/conv/*.c))
    83libc.TDEP += $(addprefix @O@src/lib/conv/,strtoul.o strtoll.o strtoull.o)
    94
    105$(call .MVER,conv/strtoul.o): src/lib/conv/strtol.c
    11         $(call DO.COMPILE.c, -DUNSIGNED)
     6        $(call DO.COMPILE.c, -I$. -DUNSIGNED)
    127$(call .MVER,conv/strtoll.o): src/lib/conv/strtol.c
    13         $(call DO.COMPILE.c, -DLONG_LONG)
     8        $(call DO.COMPILE.c, -I$. -DLONG_LONG)
    149$(call .MVER,conv/strtoull.o): src/lib/conv/strtol.c
    15         $(call DO.COMPILE.c, -DLONG_LONG -DUNSIGNED)
     10        $(call DO.COMPILE.c, -I$. -DLONG_LONG -DUNSIGNED)
    1611
    1712.TCF.src/lib/conv/bipow5.c := -I$.
     
    2217$.makepow5.exe: src/lib/conv/makepow5.c
    2318        $(LD) $(CFLAGS) $(CFLAGS.dbg) $(LDFLAGS.dbg) $(LDFLAGS.aout) -o $@ $<
     19
     20# Build smallcnv separately (for smaller but less accurate printf())
     21.MODULE :=
     22.TKIND  := aout
     23.TSRC.386 := src/lib/conv/386/smallcnv.s
     24.TSRC   := $(.TSRC.$(CPU))
     25.INSDIR :=
     26include common.smak
     27
     28.OBJS += $(subst /aout/,/omf/,$(patsubst %.o,%.obj,$(.OBJS)))
     29.DIRS := $(sort $(dir $(.OBJS)))
     30TARGDIRS += $(.DIRS)
     31
     32libc: $(.DIRS) $(.OBJS)
     33
     34INS.FILES += $(addprefix $(INS)lib/,$(notdir $(.OBJS)))
     35$(addprefix $(INS)lib/,$(notdir $(.OBJS))): $(.OBJS)
     36        $(call CP,$^,$(dir $@))
     37
     38# Additional dependencies to help stupid make.
     39$.omf/src/lib/conv/386/smallcnv.obj: $.aout/src/lib/conv/386/smallcnv.o
     40
     41include comend.smak
  • trunk/src/emx/src/lib/conv/dtoa.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* dtoa.c (emx+gcc) -- Copyright (c) 1996-1999 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <math.h>
  • trunk/src/emx/src/lib/conv/lltoa.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    44#include <stdlib.h>
    55
    6 char *_STD(lltoa) (long long value, char *string, int radix)
     6char *_lltoa (long long value, char *string, int radix)
    77{
    88  char *dst;
  • trunk/src/emx/src/lib/conv/ltoa.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    44#include <stdlib.h>
    55
    6 char *_STD(ltoa) (long value, char *string, int radix)
     6char *_ltoa (long value, char *string, int radix)
    77{
    88  char *dst;
  • trunk/src/emx/src/lib/conv/remzeros.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* remzeros.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <string.h>
    45#include <emx/float.h>
  • trunk/src/emx/src/lib/conv/smalatod.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* smalatod.c (emx+gcc) -- Copyright (c) 1990-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <math.h>
  • trunk/src/emx/src/lib/conv/smaldtoa.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* smalldtoa.c (emx+gcc) -- Copyright (c) 1994-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <string.h>
  • trunk/src/emx/src/lib/conv/ulltoa.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* ulltoa.c (emx+gcc) -- Copyright (c) 1990-1995 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45
  • trunk/src/emx/src/lib/conv/ultoa.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* ultoa.c (emx+gcc) -- Copyright (c) 1990-1995 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45
  • trunk/src/emx/src/lib/io/_crlf.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* _crlf.c (emx+gcc) -- Copyright (c) 1990-1995 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <string.h>
    45#include <io.h>
  • trunk/src/emx/src/lib/io/_fbuf.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* _fbuf.c (emx+gcc) -- Copyright (c) 1990-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdio.h>
    45#include <stdlib.h>
  • trunk/src/emx/src/lib/io/_fd.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* _fd.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <emx/io.h>
    45
  • trunk/src/emx/src/lib/io/_fdinit.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* _fdinit.c (emx+gcc) -- Copyright (c) 1996-1997 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <emx/io.h>
     
    1415extern int _lookahead[];
    1516
    16 #if defined (__MT__)
    17 
    1817/* This semaphore protects a critical region in _fd_init(). */
    1918
     
    2221
    2322/* Initialize the semaphore -- this function will be called by
    24    _startup() via the __crtinit1__ set vector. */
     23   _CRT_init() via the __crtinit1__ set vector. */
    2524
    2625void _init1_fdinit (void)
     
    3029
    3130_CRT_INIT1 (_init1_fdinit)
    32 
    33 #endif
    3431
    3532
     
    8178      p->next = NULL;
    8279
    83 #if defined (__MT__)
    8480      /* Prevent other threads from updating last->next. */
    8581
     
    117113          return _fd_init (handle);
    118114        }
    119 #else
    120       last->next = p;
    121 #endif
    122115    }
    123116
  • trunk/src/emx/src/lib/io/_fill.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* _fill.c (emx+gcc) -- Copyright (c) 1990-2000 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdio.h>
    45#include <io.h>
  • trunk/src/emx/src/lib/io/_flush.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* _flush.c (emx+gcc) -- Copyright (c) 1990-1998 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdio.h>
    45#include <io.h>
  • trunk/src/emx/src/lib/io/_flushst.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* _flushst.c (emx+gcc) -- Copyright (c) 1990-1998 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdio.h>
    45#include <io.h>
  • trunk/src/emx/src/lib/io/_fopen.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* _fopen.c (emx+gcc) -- Copyright (c) 1990-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdio.h>
    45#include <io.h>
  • trunk/src/emx/src/lib/io/_fseekhd.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* _fseekhd.c (emx+gcc) -- Copyright (c) 1990-1995 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdio.h>
    45#include <memory.h>
  • trunk/src/emx/src/lib/io/_fsetmod.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* _fsetmod.c (emx+gcc) -- Copyright (c) 1990-1998 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdio.h>
    45#include <io.h>
     
    1920      return -1;
    2021    }
    21   if (_setmode (stream->_handle, i) == -1)
     22  if (setmode (stream->_handle, i) == -1)
    2223    return -1;
    2324  return 0;
  • trunk/src/emx/src/lib/io/_fsopen.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* _fsopen.c (emx+gcc) -- Copyright (c) 1990-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdio.h>
    45#include <emx/io.h>
  • trunk/src/emx/src/lib/io/_imphand.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* _imphand.c (emx+gcc) -- Copyright (c) 1994-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <io.h>
    45#include <fcntl.h>
  • trunk/src/emx/src/lib/io/_input.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* _input.c (emx+gcc) -- Copyright (c) 1990-2000 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdio.h>
    45#include <stdlib.h>
     
    1011#include <emx/locale.h>
    1112#include <emx/io.h>
     13#include "getputc.h"
    1214
    1315#define FALSE   0
  • trunk/src/emx/src/lib/io/_isterm.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* _isterm.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <io.h>
    45#include <emx/syscalls.h>
  • trunk/src/emx/src/lib/io/_mfopen.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* _mfopen.c (emx+gcc) -- Copyright (c) 1993-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdio.h>
    45#include <stdlib.h>
  • trunk/src/emx/src/lib/io/_newstre.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* _newstre.c (emx+gcc) -- Copyright (c) 1990-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdio.h>
    45#include <stdlib.h>
     
    6970  return NULL;
    7071}
    71 
    72 #if defined (__MT__)
    7372
    7473int _setmore (FILE *stream, int lock)
     
    141140}
    142141
    143 #else
    144 
    145 int _setmore (FILE *stream, int lock)
    146 {
    147   stream->_mbstate = 0;
    148   stream->_more = NULL;
    149   return 0;
    150 }
    151 
    152 void _setdummymore (FILE *stream, struct _file2 *more)
    153 {
    154   stream->_mbstate = 0;
    155   stream->_more = NULL;
    156 }
    157 
    158 #endif
    159 
    160 
    161142void _closestream (FILE *stream)
    162143{
    163144  if (stream->_more != NULL && stream->_more->owner == stream)
    164145    {
    165 #if defined (__MT__)
    166146      _rmutex_close (&stream->_more->rsem);
    167 #endif
    168147      stream->_more->owner = NULL;
    169148    }
  • trunk/src/emx/src/lib/io/_output.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* _output.c (emx+gcc) -- Copyright (c) 1990-2000 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdio.h>
    45#include <stdlib.h>
     
    1213#include <emx/float.h>
    1314#include <emx/locale.h>
     15#include "getputc.h"
    1416
    1517#define FALSE           0
  • trunk/src/emx/src/lib/io/_rmtmp.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* _rmtmp.c (emx+gcc) -- Copyright (c) 1990-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <sys/builtin.h>        /* For <sys/fmutex.h> */
    45#include <sys/fmutex.h>         /* For <sys/rmutex.h> */
  • trunk/src/emx/src/lib/io/_seekhdr.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* _seekhdr.c (emx+gcc) -- Copyright (c) 1990-1995 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <memory.h>
    45#include <io.h>
  • trunk/src/emx/src/lib/io/_str_rd.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* _str_rd.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <unistd.h>
    45#include <errno.h>
  • trunk/src/emx/src/lib/io/_str_wr.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* _str_wr.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <unistd.h>
    45#include <errno.h>
  • trunk/src/emx/src/lib/io/_tempnam.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    22/*                         Copyright (c) 1991-1993 by Kolja Elsaesser */
    33
     4#include "libc-alias.h"
    45#include <stdio.h>
    56#include <stdlib.h>
  • trunk/src/emx/src/lib/io/_tmp.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* _tmp.c (emx+gcc) */
    22
     3#include "libc-alias.h"
    34#include <sys/builtin.h>        /* For <sys/fmutex.h> */
    45#include <sys/fmutex.h>         /* For <sys/rmutex.h> */
     
    1011
    1112
    12 #if defined (__MT__)
    13 
    1413/* This semaphore protects _tmpidx. */
    1514
     
    1817
    1918/* Initialize the semaphore -- this function will be called by
    20    _startup() via the __crtinit1__ set vector. */
     19   _CRT_init() via the __crtinit1__ set vector. */
    2120
    2221void _init1_tmp (void)
     
    3736  _rmutex_checked_release (&_tmpidx_rmutex);
    3837}
    39 
    40 #endif
  • trunk/src/emx/src/lib/io/_tmp.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    88int _tmpidxnam (char *string);
    99
    10 #if defined (__MT__)
    11 
    1210void _tmpidx_lock (void);
    1311void _tmpidx_unlock (void);
     
    1513#define TMPIDX_LOCK   _tmpidx_lock ()
    1614#define TMPIDX_UNLOCK _tmpidx_unlock ()
    17 
    18 #else
    19 
    20 #define TMPIDX_LOCK
    21 #define TMPIDX_UNLOCK
    22 
    23 #endif /* defined (__MT__) */
  • trunk/src/emx/src/lib/io/_tmpbuf.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* _tmpbuf.c (emx+gcc) -- Copyright (c) 1990-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdio.h>
    45#include <emx/io.h>
  • trunk/src/emx/src/lib/io/_tmpidxn.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    22/*                         Copyright (c) 1991-1993 by Kolja Elsaesser */
    33
     4#include "libc-alias.h"
    45#include <stdio.h>
    56#include <stdlib.h>
  • trunk/src/emx/src/lib/io/_trslash.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* _trslash.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <sys/nls.h>
    45#include <emx/io.h>
  • trunk/src/emx/src/lib/io/_vsopen.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* _vsopen.c (emx+gcc) -- Copyright (c) 1990-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdarg.h>
    45#include <io.h>
  • trunk/src/emx/src/lib/io/clearerr.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* clearerr.c (emx+gcc) -- Copyright (c) 1990-1995 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdio.h>
    45
  • trunk/src/emx/src/lib/io/ead.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* ead.c (emx+gcc) -- Copyright (c) 1993-2000 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#define INCL_DOSFILEMGR
    45#include <os2.h>
  • trunk/src/emx/src/lib/io/eadadd.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* eadadd.c (emx+gcc) -- Copyright (c) 1993-1995 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#define INCL_DOSFILEMGR
    45#include <os2.h>
  • trunk/src/emx/src/lib/io/eadcopy.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* eadcopy.c (emx+gcc) -- Copyright (c) 1993-1995 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#define INCL_DOSFILEMGR
    45#include <os2.h>
  • trunk/src/emx/src/lib/io/eadfea.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* eadfea.c (emx+gcc) -- Copyright (c) 1993-1995 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#define INCL_DOSFILEMGR
    45#include <os2.h>
  • trunk/src/emx/src/lib/io/eadread.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* eadread.c (emx+gcc) -- Copyright (c) 1994-1995 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#define INCL_DOSFILEMGR
    45#define INCL_DOSERRORS
  • trunk/src/emx/src/lib/io/eadsort.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* eadsort.c (emx+gcc) -- Copyright (c) 1993-1995 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#define INCL_DOSFILEMGR
    45#include <os2.h>
  • trunk/src/emx/src/lib/io/eadwrite.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* eadwrite.c (emx+gcc) -- Copyright (c) 1993-1995 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#define INCL_DOSFILEMGR
    45#include <os2.h>
  • trunk/src/emx/src/lib/io/eaerrno.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* eaerrno.c (emx+gcc) -- Copyright (c) 1993 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#define INCL_DOSFILEMGR
    45#define INCL_DOSERRORS
  • trunk/src/emx/src/lib/io/eafree.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* eafree.c (emx+gcc) -- Copyright (c) 1993 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <sys/ea.h>
  • trunk/src/emx/src/lib/io/eaget.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r235 r236  
    11/* eaget.c (emx+gcc) -- Copyright (c) 1993-1995 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#define INCL_DOSFILEMGR
    45#include <os2.h>
  • trunk/src/emx/src/lib/io/eaput.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    11/* eaput.c (emx+gcc) -- Copyright (c) 1993-1995 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#define INCL_DOSFILEMGR
    45#include <os2.h>
  • trunk/src/emx/src/lib/io/earemove.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* earemove.c (emx+gcc) -- Copyright (c) 1993-1995 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <sys/ea.h>
  • trunk/src/emx/src/lib/io/eawrite.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* eawrite.c (emx+gcc) -- Copyright (c) 1993-1995 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#define INCL_DOSFILEMGR
    45#include <os2.h>
  • trunk/src/emx/src/lib/io/eof.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    2121  if (cur < 0)
    2222    return -1;
    23   len = _filelength (handle);
     23  len = filelength (handle);
    2424  if (len < 0)
    2525    return -1;
  • trunk/src/emx/src/lib/io/fassign.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* fassign.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdio.h>
    45#include <errno.h>
  • trunk/src/emx/src/lib/io/fcloseal.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    11/* fcloseal.c (emx+gcc) -- Copyright (c) 1990-1998 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdio.h>
    45#include <emx/io.h>
  • trunk/src/emx/src/lib/io/fdopen.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    7878    }
    7979  if (bt)
    80     _setmode (handle, omode);
     80    setmode (handle, omode);
    8181  dst->_handle = handle;
    8282  dst->_ptr = NULL;
  • trunk/src/emx/src/lib/io/fgetc.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    88#include <stdlib.h>
    99#include <emx/io.h>
     10#include "getputc.h"
    1011
    1112int _STD(fgetc) (FILE *stream)
  • trunk/src/emx/src/lib/io/fgets.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    88#include <stdlib.h>
    99#include <emx/io.h>
     10#include "getputc.h"
    1011
    1112char *_STD(fgets) (char *buffer, int n, FILE *stream)
  • trunk/src/emx/src/lib/io/fputc.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    88#include <stdlib.h>
    99#include <emx/io.h>
     10#include "getputc.h"
    1011
    1112int _STD(fputc) (int c, FILE *stream)
  • trunk/src/emx/src/lib/io/fstat.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    1616  if (rc == 0)
    1717    {
    18       if (!_tzset_flag) _tzset ();
     18      if (!_tzset_flag) tzset ();
    1919      _loc2gmt (&buffer->st_atime, -1);
    2020      _loc2gmt (&buffer->st_mtime, -1);
  • trunk/src/emx/src/lib/io/gets.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    88#include <stdlib.h>
    99#include <emx/io.h>
     10#include "getputc.h"
    1011
    1112char *_STD(gets) (char *buffer)
  • trunk/src/emx/src/lib/io/io.smak

    • Property cvs2svn:cvs-rev changed from 1.5 to 1.6
    r235 r236  
    1212TARGDIRS += $(.DIRS)
    1313
    14 DO.INSTALL += $(call CP,$(.OBJS) $(INS)lib/)$(NL)
     14libc: $(.DIRS) $(.OBJS)
    1515
    16 libc: $(.DIRS) $(.OBJS)
     16INS.FILES += $(addprefix $(INS)lib/,$(notdir $(.OBJS)))
     17$(addprefix $(INS)lib/,$(notdir $(.OBJS))): $(.OBJS)
     18        $(call CP,$^,$(dir $@))
    1719
    1820include comend.smak
  • trunk/src/emx/src/lib/io/popen.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    4949      return NULL;
    5050    }
    51   f = _fdopen (pipe_local, mode);
     51  f = fdopen (pipe_local, mode);
    5252  if (f == NULL)
    5353    {
     
    6666    }
    6767  base = _getname (sh);
    68   if (_stricmp (base, "cmd.exe") == 0 || _stricmp (base, "4os2.exe") == 0)
     68  if (stricmp (base, "cmd.exe") == 0 || stricmp (base, "4os2.exe") == 0)
    6969    opt = "/c";
    7070  else
  • trunk/src/emx/src/lib/io/puts.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    99#include <string.h>
    1010#include <emx/io.h>
     11#include "getputc.h"
    1112
    1213int _STD(puts) (const char *string)
  • trunk/src/emx/src/lib/io/sopen.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    66#include <emx/io.h>
    77
    8 int _STD(sopen) (const char *name, int oflag, int shflag, ...)
     8int _sopen (const char *name, int oflag, int shflag, ...)
    99{
    1010  va_list va;
  • trunk/src/emx/src/lib/io/stat.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r235 r236  
    4040          return -1;
    4141        }
    42       if (!_tzset_flag) _tzset ();
     42      if (!_tzset_flag) tzset ();
    4343      _loc2gmt (&buffer->st_atime, -1);
    4444      _loc2gmt (&buffer->st_mtime, -1);
     
    4848          tmp = _getext (name);
    4949          if (tmp != NULL &&
    50               (_stricmp (tmp, ".exe") == 0 ||
    51                _stricmp (tmp, ".com") == 0 ||
    52                _stricmp (tmp, ".cmd") == 0 ||
    53                _stricmp (tmp, ".bat") == 0))
     50              (stricmp (tmp, ".exe") == 0 ||
     51               stricmp (tmp, ".com") == 0 ||
     52               stricmp (tmp, ".cmd") == 0 ||
     53               stricmp (tmp, ".bat") == 0))
    5454            buffer->st_mode |= (S_IEXEC >> 6) * 0111;
    5555        }
  • trunk/src/emx/src/lib/io/tmpfile.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    2929  if (fd == -1)
    3030    return NULL;
    31   f = _fdopen (fd, "w+b");
     31  f = fdopen (fd, "w+b");
    3232  if (f == NULL)
    3333    return NULL;
  • trunk/src/emx/src/lib/io/tmpnam.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    1010char *_STD(tmpnam) (char *string)
    1111{
    12 #if defined (__MT__)
    1312  struct _thread *tp = _thread ();
    14 #define tnbuf (tp->_th_tmpnam_buf)
    15 #else
    16   static char tnbuf[L_tmpnam];
    17 #endif
    1813
    19   if (string == NULL) string = tnbuf;
     14  if (string == NULL)
     15    string = tp->_th_tmpnam_buf;
    2016  if (_tmpidxnam (string) >= 0)
    2117    return string;
  • trunk/src/emx/src/lib/io/ttyname.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    88char *_STD(ttyname) (int handle)
    99{
    10 #if defined (__MT__)
    1110  struct _thread *tp = _thread ();
    12 #define buf (tp->_th_ttyname)
    13 #else
    14   static char buf[32];
    15 #endif
    1611
    17   if (__ttyname (handle, buf, sizeof (buf)) == 0)
    18     return buf;
     12  if (__ttyname (handle, tp->_th_ttyname, sizeof (tp->_th_ttyname)) == 0)
     13    return tp->_th_ttyname;
    1914  else
    2015    return NULL;
  • trunk/src/emx/src/lib/io/utime.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    2525      tv[1].tv_usec = 0;
    2626    }
    27   if (!_tzset_flag) _tzset ();
     27  if (!_tzset_flag) tzset ();
    2828  tmp = tv[0].tv_sec; _gmt2loc (&tmp); tv[0].tv_sec = tmp;
    2929  tmp = tv[1].tv_sec; _gmt2loc (&tmp); tv[1].tv_sec = tmp;
  • trunk/src/emx/src/lib/io/utimes.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    2222      tv[1] = tvp[1];
    2323    }
    24   if (!_tzset_flag) _tzset ();
     24  if (!_tzset_flag) tzset ();
    2525  tmp = tv[0].tv_sec; _gmt2loc (&tmp); tv[0].tv_sec = tmp;
    2626  tmp = tv[1].tv_sec; _gmt2loc (&tmp); tv[1].tv_sec = tmp;
  • trunk/src/emx/src/lib/libc.smak

    • Property cvs2svn:cvs-rev changed from 1.6 to 1.7
    r235 r236  
    1111LIBC.SUBMAK := $(wildcard src/lib/*/*.smak)
    1212-include $(LIBC.SUBMAK)
     13# Add to the list of genrules.smak dependencies
     14$.genrules.smak: $(LIBC.SUBMAK)
    1315
    14 $(OUT)genrules.smak: $(LIBC.SUBMAK)
     16# First of all, libc target needs the libc-std.h file generated.
     17# If we depend directly on the header file, it is a pain since every
     18# time a .c file is modified, the .h file is regenerated, and then
     19# every source file is recompiled (since libc-std.h is included from
     20# every libc source file). To avoid this, we create a stamp file which
     21# takes care not to update libc-std.h if it has not been changed.
     22libc: $.stmp-libc-std
    1523
    1624.MODULE := libc
     
    2129.TSRC   := $(libc.TSRC.$(CPU)) $(libc.TSRC)
    2230.TDEP   := $(libc.TDEP.$(CPU)) $(libc.TDEP)
     31.TCF    := -I$.
    2332.INSDIR = lib/
    2433.TKEEP  := 1
     
    3544#------------------------------------------------------
    3645LIBC.DLL = $.aout/libc$(VH)$(VM).dll
     46LIBC.IMPLIB = $.aout/c_dll.a $.omf/c_dll.lib
    3747
    3848DO.HELP.MODULES += $(call ECHO,    libc-dll - The dynamic C library (.dll))$(NL)
    3949
    40 DO.INSTALL += $(call CP,$(LIBC.DLL),$(INS)dll/)$(NL)
    41 INSDIRS += $(INS)dll/
     50INS.FILES += $(INS)dll/$(notdir $(LIBC.DLL)) \
     51  $(addprefix $(INS)lib/,$(notdir $(LIBC.IMPLIB)))
     52
     53$(INS)dll/$(notdir $(LIBC.DLL)): $(LIBC.DLL)
     54        $(call CP,$<,$@)
     55$(addprefix $(INS)lib/,$(notdir $(LIBC.IMPLIB))): $(LIBC.IMPLIB)
     56        $(call CP,$^,$(dir $@))
    4257
    4358.PHONY: libc-dll
    4459all: libc-dll
    45 libc-dll: $(EMXEXP.DEPON) $(EMXBIND.DEPON) $(EMXIMP.DEPON) app alias libc os2 $(LIBC.DLL)
     60libc-dll: emxbind emxexp app alias libc os2 $(LIBC.DLL) $(LIBC.IMPLIB)
    4661
    4762$(LIBC.DLL): $.aout/src/lib/startup/386/dll0.o $(.OBJS) $(.DEPS) \
     
    5267        @$(call RM,__libc__)
    5368
     69$(LIBC.IMPLIB): $.aout/libc.def
     70        emximp -o $@ $<
     71
    5472$.aout/libc.def: $.aout/c.a $.aout/c_app.a
    5573        $(call RM,$@)
     
    5876        @$(call FECHO,$@,EXPORTS)
    5977        @$(call DO.EMXEXP)
     78
     79# How libc-std.h can be auto-generated.
     80# Unfortunately, we cannot use c.a to find out all _std_ names since
     81# c.a itself depends on this header file. Thus we have to scan all source
     82# files for _STD() macros invocations. Fortunately, gawk rulez forever thus
     83# this happens in just a fraction of second.
     84$.stmp-libc-std: $(wildcard src/lib/*/*.c src/lib/*/386/*.s)
     85        gawk -f src/lib/mkstd.awk $^ >__tmp__
     86        $(call UPDATE,__tmp__,$.libc-std.h)
     87        $(call TOUCH,$@)
    6088
    6189# Forget temporary variables
  • trunk/src/emx/src/lib/locale/setlocal.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    224224
    225225  for (dp = _lc_table; dp->name != NULL; ++dp)
    226     if (_stricmp (dp->name, locale) == 0)
     226    if (stricmp (dp->name, locale) == 0)
    227227      return dp;
    228228  return NULL;
     
    344344         that locale. */
    345345
    346       if (_stricmp (lcn_collate, lcn_ctype) == 0
    347           && _stricmp (lcn_collate, lcn_monetary) == 0
    348           && _stricmp (lcn_collate, lcn_numeric) == 0
    349           && _stricmp (lcn_collate, lcn_time) == 0)
     346      if (stricmp (lcn_collate, lcn_ctype) == 0
     347          && stricmp (lcn_collate, lcn_monetary) == 0
     348          && stricmp (lcn_collate, lcn_numeric) == 0
     349          && stricmp (lcn_collate, lcn_time) == 0)
    350350        return lcn_collate;
    351351
  • trunk/src/emx/src/lib/malloc/defalloc.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* defalloc.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
     
    2930
    3031  saved_errno = errno;
    31   rest = _ulimit (UL_OBJREST, 0); /* The 2nd arg isn't required */
     32  rest = ulimit (UL_OBJREST, 0); /* The 2nd arg isn't required */
    3233  errno = saved_errno;
    3334  if (rest != -1 && rest != 0 && n > (size_t)rest)
     
    5455             requested memory allocation to the next call. */
    5556
    56           p = _sbrk ((int)rest);
     57          p = sbrk ((int)rest);
    5758          if (p == (void *)-1)
    5859            return NULL;
     
    6465  /* Allocate memory. */
    6566
    66   p = _sbrk (n);
     67  p = sbrk (n);
    6768  if (p == (void *)-1)
    6869    {
    6970      n = *size;
    70       p = _sbrk (n);
     71      p = sbrk (n);
    7172      if (p == (void *)-1)
    7273        return NULL;
  • trunk/src/emx/src/lib/malloc/defexpan.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* defexpan.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
     
    1516  size_t n;
    1617
    17   if (_UM_ADD (base, old_size) != _sbrk (0))
     18  if (_UM_ADD (base, old_size) != sbrk (0))
    1819    return 0;
    1920  n = (*new_size - old_size + 0xffff) & ~0xffff;
    20   p = _sbrk (n);
     21  p = sbrk (n);
    2122  if (p == (void *)-1)
    2223    {
    2324      n = *new_size - old_size;
    24       p = _sbrk (n);
     25      p = sbrk (n);
    2526      if (p == (void *)-1)
    2627        return 0;
     
    2829  if (p != _UM_ADD (base, old_size))
    2930    {
    30       _sbrk (-n);
     31      sbrk (-n);
    3132      return 0;
    3233    }
  • trunk/src/emx/src/lib/malloc/defrelea.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* defrelea.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
     
    1314  void *cur;
    1415
    15   cur = _sbrk (0);
     16  cur = sbrk (0);
    1617  if (_UM_ADD (memory, size) == cur)
    17     _sbrk (-size);
     18    sbrk (-size);
    1819}
  • trunk/src/emx/src/lib/malloc/defshrin.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* defshrink.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
     
    1415  void *cur;
    1516
    16   cur = _sbrk (0);
     17  cur = sbrk (0);
    1718  if (_UM_ADD (memory, old_size) != cur
    18       || _sbrk ((int)(*new_size - old_size)) == (void *)-1)
     19      || sbrk ((int)(*new_size - old_size)) == (void *)-1)
    1920    *new_size = old_size;
    2021}
  • trunk/src/emx/src/lib/malloc/heapchk.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* heapchk.c (emx+gcc) -- Copyright (c) 1996-1998 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/heapmin.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* heapmin.c (emx+gcc) -- Copyright (c) 1996-1998 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/heapset.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* heapset.c (emx+gcc) -- Copyright (c) 1996-1998 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/heapwalk.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* heapwalk.c (emx+gcc) -- Copyright (c) 1996-1998 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/iaddmem.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* iaddmem.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/ialloc.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* ialloc.c (emx+gcc) -- Copyright (c) 1996-1999 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/ifree.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* ifree.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/imisc.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* imisc.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/initr.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* initr.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
     
    3536        {
    3637          _uflags (_UF_SBRK_MODEL, _UF_SBRK_ARBITRARY);
    37           memory = _sbrk (_INITIAL_DEFAULT_HEAP_SIZE);
     38          memory = sbrk (_INITIAL_DEFAULT_HEAP_SIZE);
    3839          if (memory == (void *)-1)
    3940            abort ();
  • trunk/src/emx/src/lib/malloc/initt.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* initt.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
     
    1516
    1617Heap_t _um_tiled_heap = NULL;
    17 
    18 
    19 /* This is an attempt at provoking a linker error if malloc() has been
    20    replaced and -ltmalloc has been forgotten.  By referencing the
    21    _emx_tmalloc_magic() function, we force in the module compiled from
    22    malloc.c.  That will hopefully conflict with the replacement
    23    malloc().  Note that the symbol must actually be used; we do this
    24    by calling the function. */
    25 
    26 extern void _emx_tmalloc_magic (void);
    2718
    2819
     
    4334        {
    4435          /* Use the regular heap also as tiled heap. */
    45 
    46           _emx_tmalloc_magic ();
    4736          _um_init_default_regular_heap ();
    4837          _um_tiled_heap = _um_regular_heap;
  • trunk/src/emx/src/lib/malloc/irealloc.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* irealloc.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/iwalk.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* iwalk.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/malloc.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    1919  return _umalloc (_UM_DEFAULT_REGULAR_HEAP, size);
    2020}
    21 
    22 /* See initt.c */
    23 
    24 void _emx_tmalloc_magic (void)
    25 {
    26 }
  • trunk/src/emx/src/lib/malloc/mheap.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* mheap.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/msize.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* msize.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/tcalloc.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* tcalloc.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/tfree.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* tfree.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/theapmin.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* theapmin.c (emx+gcc) -- Copyright (c) 1996-1998 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/tmalloc.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* tmalloc.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/trealloc.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* trealloc.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/uaddmem.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* uaddmem.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/ucalloc.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* ucalloc.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/uclose.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* uclose.c (emx+gcc) -- Copyright (c) 1996-1997 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
     
    1415      || h == _um_regular_heap || h == _um_tiled_heap)
    1516    return -1;
    16 #if defined (__MT__)
    1717  _rmutex_close (&h->rsem);
    18 #endif
    1918  return 0;
    2019}
  • trunk/src/emx/src/lib/malloc/ucreate.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* ucreate.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/ucreate2.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* ucreate2.c (emx+gcc) -- Copyright (c) 1996-1997 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
     
    7677
    7778  /* Initialize the mutex semaphore. */
    78 
    79 #if defined (__MT__)
    8079  if (_rmutex_create (&h->rsem, (type & _HEAP_SHARED) ? _FMC_SHARED : 0) != 0)
    8180    return NULL;
    82 #endif
    8381
    8482  /* The heap has been created, except for the initial segment. */
  • trunk/src/emx/src/lib/malloc/udefault.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* udefault.c (emx+gcc) -- Copyright (c) 1996-1998 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/udestroy.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* udestroy.c (emx+gcc) -- Copyright (c) 1996-1997 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
     
    8889     decrements the open count to 0, destroying the semaphore. */
    8990
    90 #if defined (__MT__)
    9191  _rmutex_close (&h->rsem);
    92 #endif
    9392  return 0;
    9493}
  • trunk/src/emx/src/lib/malloc/uheapchk.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* uheapchk.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/uheapmin.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* uheapmin.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/uheapset.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* uheapset.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/umalloc.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* umalloc.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/uopen.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* uopen.c (emx+gcc) -- Copyright (c) 1996-1997 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
     
    1415      || h == _um_regular_heap || h == _um_tiled_heap)
    1516    return -1;
    16 #if defined (__MT__)
    1717  if (_rmutex_open (&h->rsem) != 0)
    1818    return -1;
    19 #endif
    2019  return 0;
    2120}
  • trunk/src/emx/src/lib/malloc/ustats.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* ustats.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/utcalloc.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* utcalloc.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/utdefaul.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* utdefaul.c (emx+gcc) -- Copyright (c) 1996-1998 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/utmalloc.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* utmalloc.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/utype.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* utype.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/uwalk.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* uwalk.c (emx+gcc) -- Copyright (c) 1996-2000 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/malloc/uwalk2.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* uwalk2.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <stddef.h>
  • trunk/src/emx/src/lib/math/386/acos.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    55#define FUNC    MATHSUFFIX1(acos)
    66
    7         .globl  LABEL(FUNC)
     7        .globl  FUNC
    88
    99        .text
     
    1717#define x       4(%esp)
    1818
    19 LABEL(FUNC):
     19FUNC:
    2020        PROFILE_NOFRAME
    2121        FLD     x                       /* x */
  • trunk/src/emx/src/lib/math/386/asin.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    55#define FUNC    MATHSUFFIX1(asin)
    66
    7         .globl  LABEL(FUNC)
     7        .globl  FUNC
    88
    99        .text
     
    1717#define x       4(%esp)
    1818
    19 LABEL(FUNC):
     19FUNC:
    2020        PROFILE_NOFRAME
    2121        FLD     x                       /* x */
  • trunk/src/emx/src/lib/math/386/atan.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    55#define FUNC    MATHSUFFIX1(atan)
    66
    7         .globl  LABEL(FUNC)
     7        .globl  FUNC
    88
    99        .text
     
    1515#define x       4(%esp)
    1616
    17 LABEL(FUNC):
     17FUNC:
    1818        PROFILE_NOFRAME
    1919        FLD     x                       /* x */
  • trunk/src/emx/src/lib/math/386/atan2.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    55#define FUNC    MATHSUFFIX1(atan2)
    66
    7         .globl  LABEL(FUNC)
     7        .globl  FUNC
    88
    99        .text
     
    2020#endif
    2121
    22 LABEL(FUNC):
     22FUNC:
    2323        PROFILE_NOFRAME
    2424        FLD     y                       /* y */
  • trunk/src/emx/src/lib/math/386/ceil.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    55#define FUNC    MATHSUFFIX1(ceil)
    66
    7         .globl  LABEL(FUNC)
     7        .globl  FUNC
    88
    99        .text
     
    1818#define x         8(%esp)
    1919
    20 LABEL(FUNC):
     20FUNC:
    2121        PROFILE_NOFRAME
    2222        subl    $4, %esp
  • trunk/src/emx/src/lib/math/386/clear.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    33#include <emx/asm386.h>
    44
    5         .globl  LABEL(_clear87)
     5        .globl  __clear87
    66
    77        .text
     
    1111/ unsigned _clear87 (void)
    1212
    13 LABEL(_clear87):
     13__clear87:
    1414        PROFILE_NOFRAME
    1515        xor     %eax, %eax              /* Clear upper 16 bits */
    1616        fstsw   %ax
    1717        fclex
    18         EPILOGUE(_clear87)
     18        EPILOGUE(__clear87)
  • trunk/src/emx/src/lib/math/386/control.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    33#include <emx/asm386.h>
    44
    5         .globl  LABEL(_control87)
     5        .globl  __control87
    66
    77        .text
     
    1717#define mask            12(%esp)
    1818
    19 LABEL(_control87):
     19__control87:
    2020        PROFILE_NOFRAME
    2121        pushl   %ecx                    /* Dummy (for control word) */
     
    33331:      popl    %eax                    /* Return old cw in lower 16 bits */
    3434        movzwl  %ax, %eax               /* Clear upper 16 bits */
    35         EPILOGUE(_control87)
     35        EPILOGUE(__control87)
  • trunk/src/emx/src/lib/math/386/copysig.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    55#define FUNC    MATHSUFFIX2(copysign)
    66
    7         .globl  LABEL(FUNC)
     7        .globl  FUNC
    88
    99        .text
     
    1818#define y(i)    16+i(%esp)
    1919
    20 LABEL(FUNC):
     20FUNC:
    2121        PROFILE_NOFRAME
    2222        movb    y(9), %al
     
    3434#define y(i)    8+i(%esp)
    3535
    36 LABEL(FUNC):
     36FUNC:
    3737        PROFILE_NOFRAME
    3838        movb    y(3), %al
     
    5050#define y(i)    12+i(%esp)
    5151
    52 LABEL(FUNC):
     52FUNC:
    5353        PROFILE_NOFRAME
    5454        movb    y(7), %al
  • trunk/src/emx/src/lib/math/386/cos.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    66#define FUNC    MATHSUFFIX1(cos)
    77
    8         .globl  LABEL(FUNC)
     8        .globl  FUNC
    99
    1010        .text
     
    1616#define x       4(%esp)
    1717
    18 LABEL(FUNC):
     18FUNC:
    1919        PROFILE_NOFRAME
    2020        FLD     x                       /* x */
  • trunk/src/emx/src/lib/math/386/cosh.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    55#define FUNC    MATHSUFFIX1(cosh)
    66
    7         .globl  LABEL(FUNC)
     7        .globl  FUNC
    88
    99        .text
     
    2020/ cosh(x) = 0.5 * (exp(x) + exp(-x)) = 0.5 * (exp(x) + 1/exp(-x))
    2121
    22 LABEL(FUNC):
     22FUNC:
    2323        PROFILE_NOFRAME
    2424        subl    $4, %esp                /* space for control words */
  • trunk/src/emx/src/lib/math/386/exp.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    55#define FUNC    MATHSUFFIX1(exp)
    66
    7         .globl  LABEL(FUNC)
     7        .globl  FUNC
    88
    99        .text
     
    1818#define x        8(%esp)
    1919
    20 LABEL(FUNC):
     20FUNC:
    2121        PROFILE_NOFRAME
    2222        subl    $4, %esp                /* space for control words */
  • trunk/src/emx/src/lib/math/386/fabs.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    55#define FUNC    MATHSUFFIX1(fabs)
    66
    7         .globl  LABEL(FUNC)
     7        .globl  FUNC
    88
    99        .text
     
    1515#define x       4(%esp)
    1616
    17 LABEL(FUNC):
     17FUNC:
    1818        PROFILE_NOFRAME
    1919        FLD     x                       /* x */
  • trunk/src/emx/src/lib/math/386/floor.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    55#define FUNC    MATHSUFFIX1(floor)
    66
    7         .globl  LABEL(FUNC)
     7        .globl  FUNC
    88
    99        .text
     
    1818#define x         8(%esp)
    1919
    20 LABEL(FUNC):
     20FUNC:
    2121        PROFILE_NOFRAME
    2222        subl    $4, %esp
  • trunk/src/emx/src/lib/math/386/fmod.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    66#define FUNC    MATHSUFFIX1(fmod)
    77
    8         .globl  LABEL(FUNC)
     8        .globl  FUNC
    99
    1010        .text
     
    2222#endif
    2323
    24 LABEL(FUNC):
     24FUNC:
    2525        PROFILE_NOFRAME
    2626        FLD     y                       /* y */
  • trunk/src/emx/src/lib/math/386/fpclass.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    55#define FUNC    MATHSUFFIX3(__fpclassify)
    66
    7         .globl  LABEL(FUNC)
     7        .globl  FUNC
    88
    99        .text
     
    1717#define x       4(%esp)
    1818
    19 LABEL(FUNC):
     19FUNC:
    2020        PROFILE_NOFRAME
    2121        fldt    x
     
    5858#define x       4(%esp)
    5959
    60 LABEL(FUNC):
     60FUNC:
    6161        PROFILE_NOFRAME
    6262        movl    x, %edx
     
    8484#define x4      8(%esp)
    8585
    86 LABEL(FUNC):
     86FUNC:
    8787        PROFILE_NOFRAME
    8888        movl    x4, %edx
  • trunk/src/emx/src/lib/math/386/fpreset.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    33#include <emx/asm386.h>
    44
    5         .globl  LABEL(_fpreset)
     5        .globl  __fpreset
    66
    77        .text
     
    1111/ void _fpreset (void)
    1212
    13 LABEL(_fpreset):
     13__fpreset:
    1414        PROFILE_NOFRAME
    1515        finit
    16         EPILOGUE(_fpreset)
     16        EPILOGUE(__fpreset)
  • trunk/src/emx/src/lib/math/386/frexp.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    66#define FUNC    MATHSUFFIX1(frexp)
    77
    8         .globl  LABEL(FUNC)
     8        .globl  FUNC
    99
    1010        .text
     
    2121#endif
    2222
    23 LABEL(FUNC):
     23FUNC:
    2424        PROFILE_NOFRAME
    2525        movl    exp_ptr, %edx
  • trunk/src/emx/src/lib/math/386/fxam.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    55#define FUNC    MATHSUFFIX2(fxam)
    66
    7         .globl  LABEL(FUNC)
     7        .globl  FUNC
    88
    99        .text
     
    1616#define x       4(%esp)
    1717
    18 LABEL(FUNC):
     18FUNC:
    1919        PROFILE_NOFRAME
    2020        FLD     x                       /* x */
  • trunk/src/emx/src/lib/math/386/hypot.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    99#define FUNC    MATHSUFFIX2(hypot)
    1010
    11         .globl  LABEL(FUNC)
     11        .globl  FUNC
    1212
    1313        .text
     
    2424#endif
    2525
    26 LABEL(FUNC):
     26FUNC:
    2727        PROFILE_NOFRAME
    2828        FLD     x                       /* x */
  • trunk/src/emx/src/lib/math/386/isfin.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    55#define FUNC    MATHSUFFIX3(__isfinite)
    66
    7         .globl  LABEL(FUNC)
     7        .globl  FUNC
    88
    99        .text
     
    1717#define x       4(%esp)
    1818
    19 LABEL(FUNC):
     19FUNC:
    2020        PROFILE_NOFRAME
    2121        fldt    x
     
    5858#define x       4(%esp)
    5959
    60 LABEL(FUNC):
     60FUNC:
    6161        PROFILE_NOFRAME
    6262        movl    x, %edx
     
    7474#define x4      8(%esp)
    7575
    76 LABEL(FUNC):
     76FUNC:
    7777        PROFILE_NOFRAME
    7878        movl    x4, %edx
  • trunk/src/emx/src/lib/math/386/isnan.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    55#define FUNC    MATHSUFFIX3(__isnan)
    66
    7         .globl  LABEL(FUNC)
     7        .globl  FUNC
    88
    99        .text
     
    1717#define x       4(%esp)
    1818
    19 LABEL(FUNC):
     19FUNC:
    2020        PROFILE_NOFRAME
    2121        fldt    x
     
    5858#define x       4(%esp)
    5959
    60 LABEL(FUNC):
     60FUNC:
    6161        PROFILE_NOFRAME
    6262        movl    x, %edx
     
    7474#define x4      8(%esp)
    7575
    76 LABEL(FUNC):
     76FUNC:
    7777        PROFILE_NOFRAME
    7878        movl    x4, %edx
  • trunk/src/emx/src/lib/math/386/isnorm.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    55#define FUNC    MATHSUFFIX3(__isnormal)
    66
    7         .globl  LABEL(FUNC)
     7        .globl  FUNC
    88
    99        .text
     
    1717#define x       4(%esp)
    1818
    19 LABEL(FUNC):
     19FUNC:
    2020        PROFILE_NOFRAME
    2121        fldt    x
     
    3535#define x       4(%esp)
    3636
    37 LABEL(FUNC):
     37FUNC:
    3838        PROFILE_NOFRAME
    3939        movl    x, %edx
     
    5252#define x4      8(%esp)
    5353
    54 LABEL(FUNC):
     54FUNC:
    5555        PROFILE_NOFRAME
    5656        movl    x4, %edx
  • trunk/src/emx/src/lib/math/386/ldexp.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    55#define FUNC    MATHSUFFIX1(ldexp)
    66
    7         .globl  LABEL(FUNC)
     7        .globl  FUNC
    88
    99        .text
     
    2020#endif
    2121
    22 LABEL(FUNC):
     22FUNC:
    2323        PROFILE_NOFRAME
    2424        fildl   exp                     /* exp */
  • trunk/src/emx/src/lib/math/386/log.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    55#define FUNC    MATHSUFFIX1(log)
    66
    7         .globl  LABEL(FUNC)
     7        .globl  FUNC
    88
    99        .text
     
    1515#define x       4(%esp)
    1616
    17 LABEL(FUNC):
     17FUNC:
    1818        PROFILE_NOFRAME
    1919        FLD     x                       /* x */
  • trunk/src/emx/src/lib/math/386/log10.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    55#define FUNC    MATHSUFFIX1(log10)
    66
    7         .globl  LABEL(FUNC)
     7        .globl  FUNC
    88
    99        .text
     
    1515#define x       4(%esp)
    1616
    17 LABEL(FUNC):
     17FUNC:
    1818        PROFILE_NOFRAME
    1919        FLD     x                       /* x */
  • trunk/src/emx/src/lib/math/386/modf.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    55#define FUNC    MATHSUFFIX1(modf)
    66
    7         .globl  LABEL(FUNC)
     7        .globl  FUNC
    88
    99        .text
     
    2323#endif
    2424
    25 LABEL(FUNC):
     25FUNC:
    2626        PROFILE_NOFRAME
    2727        subl    $4, %esp
  • trunk/src/emx/src/lib/math/386/nextaft.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    55#define FUNC    MATHSUFFIX2(nextafter)
    66
    7         .globl  LABEL(FUNC)
     7        .globl  FUNC
    88
    99        .text
     
    1818#define y(i)    16+i(%esp)
    1919
    20 LABEL(FUNC):
     20FUNC:
    2121        PROFILE_NOFRAME
    2222        fldt    x(0)
     
    161161#define y       8(%esp)
    162162
    163 LABEL(FUNC):
     163FUNC:
    164164        PROFILE_NOFRAME
    165165        flds    x
     
    238238#define y(i)    12+i(%esp)
    239239
    240 LABEL(FUNC):
     240FUNC:
    241241        PROFILE_NOFRAME
    242242        fldl    x(0)
  • trunk/src/emx/src/lib/math/386/pow.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    66#define FUNC    MATHSUFFIX1(pow)
    77
    8         .globl  LABEL(FUNC)
     8        .globl  FUNC
    99
    1010        .text
     
    2525#endif
    2626
    27 LABEL(FUNC):
     27FUNC:
    2828        pushl   %ebp
    2929        movl    %esp, %ebp
  • trunk/src/emx/src/lib/math/386/rint.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    55#define FUNC    MATHSUFFIX2(rint)
    66
    7         .globl  LABEL(FUNC)
     7        .globl  FUNC
    88
    99        .text
     
    1818#define x         8(%esp)
    1919
    20 LABEL(FUNC):
     20FUNC:
    2121        PROFILE_NOFRAME
    2222        subl    $4, %esp
  • trunk/src/emx/src/lib/math/386/signbit.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    55#define FUNC    MATHSUFFIX3(__signbit)
    66
    7         .globl  LABEL(FUNC)
     7        .globl  FUNC
    88
    99        .text
     
    1818#define x9      13(%esp)
    1919
    20 LABEL(FUNC):
     20FUNC:
    2121        PROFILE_NOFRAME
    2222        xorl    %eax, %eax
     
    3232#define x3      7(%esp)
    3333
    34 LABEL(FUNC):
     34FUNC:
    3535        PROFILE_NOFRAME
    3636        xorl    %eax, %eax
     
    4646#define x7      11(%esp)
    4747
    48 LABEL(FUNC):
     48FUNC:
    4949        PROFILE_NOFRAME
    5050        xorl    %eax, %eax
  • trunk/src/emx/src/lib/math/386/sin.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    66#define FUNC    MATHSUFFIX1(sin)
    77
    8         .globl  LABEL(FUNC)
     8        .globl  FUNC
    99
    1010        .text
     
    1616#define x       4(%esp)
    1717
    18 LABEL(FUNC):
     18FUNC:
    1919        PROFILE_NOFRAME
    2020        FLD     x                       /* x */
  • trunk/src/emx/src/lib/math/386/sinh.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    55#define FUNC    MATHSUFFIX1(sinh)
    66
    7         .globl  LABEL(FUNC)
     7        .globl  FUNC
    88
    99        .text
     
    2020/ sinh(x) = 0.5 * (exp(x) - exp(-x)) = 0.5 * (exp(x) - 1/exp(x))
    2121
    22 LABEL(FUNC):
     22FUNC:
    2323        PROFILE_NOFRAME
    2424        subl    $4, %esp                /* space for control words */
  • trunk/src/emx/src/lib/math/386/sqrt.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    55#define FUNC    MATHSUFFIX1(sqrt)
    66
    7         .globl  LABEL(FUNC)
     7        .globl  FUNC
    88
    99        .text
     
    1515#define x       4(%esp)
    1616
    17 LABEL(FUNC):
     17FUNC:
    1818        PROFILE_NOFRAME
    1919        FLD     x                       /* x */
  • trunk/src/emx/src/lib/math/386/status.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    33#include <emx/asm386.h>
    44
    5         .globl  LABEL(_status87)
     5        .globl  __status87
    66
    77        .text
     
    1111/ unsigned _status87 (void)
    1212
    13 LABEL(_status87):
     13__status87:
    1414        PROFILE_NOFRAME
    1515        xor     %eax, %eax              /* Clear upper 16 bits */
    1616        fstsw   %ax
    17         EPILOGUE(_status87)
     17        EPILOGUE(__status87)
  • trunk/src/emx/src/lib/math/386/tan.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    66#define FUNC    MATHSUFFIX1(tan)
    77
    8         .globl  LABEL(FUNC)
     8        .globl  FUNC
    99
    1010        .text
     
    1616#define x       4(%esp)
    1717
    18 LABEL(FUNC):
     18FUNC:
    1919        PROFILE_NOFRAME
    2020        FLD     x                       /* x */
  • trunk/src/emx/src/lib/math/386/tanh.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    55#define FUNC    MATHSUFFIX1(tanh)
    66
    7         .globl  LABEL(FUNC)
     7        .globl  FUNC
    88
    99        .text
     
    2020/ tanh(x) = (t-1.0) / (t+1.0) with t = exp (2.0 * x)
    2121
    22 LABEL(FUNC):
     22FUNC:
    2323        PROFILE_NOFRAME
    2424        subl    $4, %esp                /* space for control words */
  • trunk/src/emx/src/lib/math/386/trunc.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    55#define FUNC    MATHSUFFIX2(trunc)
    66
    7         .globl  LABEL(FUNC)
     7        .globl  FUNC
    88
    99        .text
     
    1818#define x         8(%esp)
    1919
    20 LABEL(FUNC):
     20FUNC:
    2121        PROFILE_NOFRAME
    2222        subl    $4, %esp
  • trunk/src/emx/src/lib/math/math.smak

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    1010  sinl.o sinhl.o sqrtl.o tanl.o tanhl.o truncl.o)
    1111
    12 # bird: .s files are in math/386 not math.
    13 #       And besides the call doesn't work correctly
    14 # <rant>Pitty gnu make doesn have .for like BSD make have, that one actually
    15 #       can generate rules on the fly :) </rant>
    16 #
    17 #$(call .MVER,math/%f.o): src/lib/math/386/%.s
    18 #       $(call DO.COMPILE.s, -DFLOAT)
    19 #$(call .MVER,math/%l.o): src/lib/math/386/%.s
    20 #       $(call DO.COMPILE.s, -DLONG_DOUBLE)
    21 
    22 $.aout/src/lib/math/386/%f.o: src/lib/math/386/%.s
     12$(call .MVER,math/386/%f.o): src/lib/math/386/%.s
    2313        $(call DO.COMPILE.s, -DFLOAT)
    24 $.aout/src/lib/math/386/%l.o: src/lib/math/386/%.s
     14$(call .MVER,math/386/%l.o): src/lib/math/386/%.s
    2515        $(call DO.COMPILE.s, -DLONG_DOUBLE)
    26 $.aout-prof/src/lib/math/386/%f.o: src/lib/math/386/%.s
    27         $(call DO.COMPILE.s, -DFLOAT)
    28 $.aout-prof/src/lib/math/386/%l.o: src/lib/math/386/%.s
    29         $(call DO.COMPILE.s, -DLONG_DOUBLE)
    30 
  • trunk/src/emx/src/lib/mbyte/mblen.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    66#include <emx/locale.h>
    77
    8 #if defined (__MT__)
    9 #define shift tp->_th_mblen_shift
    10 #else
    11 static int shift = 0;
    12 #endif
    13 
    14 
    158int _STD(mblen) (const char *s, size_t n)
    169{
    17 #if defined (__MT__)
    1810  struct _thread *tp = _thread ();
    19 #endif
    2011
    2112  if (s == NULL)
     
    2314      if (_cur_mbyte.mode == _MB_SHIFT)
    2415        {
    25           shift = 0;
     16          tp->_th_mblen_shift = 0;
    2617          return 1;             /* State dependency */
    2718        }
     
    2920        return 0;               /* No state dependency */
    3021    }
    31   return _mbtowc (NULL, s, n, &shift);
     22  return _mbtowc (NULL, s, n, &tp->_th_mblen_shift);
    3223}
  • trunk/src/emx/src/lib/mbyte/mbtowc.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    66#include <emx/locale.h>
    77
    8 #if defined (__MT__)
    9 #define shift tp->_th_mbtowc_shift
    10 #else
    11 static int shift = 0;
    12 #endif
    13 
    14 
    158int _STD(mbtowc) (wchar_t *pwc, const char *s, size_t n)
    169{
    17 #if defined (__MT__)
    1810  struct _thread *tp = _thread ();
    19 #endif
    2011
    2112  if (s == NULL)
     
    2314      if (_cur_mbyte.mode == _MB_SHIFT)
    2415        {
    25           shift = 0;
     16          tp->_th_mbtowc_shift = 0;
    2617          return 1;             /* State dependency */
    2718        }
     
    2920        return 0;               /* No state dependency */
    3021    }
    31   return _mbtowc (pwc, s, n, &shift);
     22  return _mbtowc (pwc, s, n, &tp->_th_mbtowc_shift);
    3223}
  • trunk/src/emx/src/lib/mbyte/wctomb.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    77#include <emx/locale.h>
    88
    9 #if defined (__MT__)
    10 #define shift (tp->_th_wctomb_shift)
    11 #else
    12 static int shift = 0;
    13 #endif
    14 
    159int _STD(wctomb) (char *s, wchar_t wchar)
    1610{
    17 #if defined (__MT__)
    1811  struct _thread *tp = _thread ();
    19 #endif
    2012
    2113  if (s == NULL)
     
    2315      if (_cur_mbyte.mode == _MB_SHIFT)
    2416        {
    25           shift = 0;
     17          tp->_th_wctomb_shift = 0;
    2618          return 1;             /* State dependency */
    2719        }
     
    2921        return 0;               /* No state dependency */
    3022    }
    31   return _wctomb (s, wchar, MB_LEN_MAX, &shift);
     23  return _wctomb (s, wchar, MB_LEN_MAX, &tp->_th_wctomb_shift);
    3224}
  • trunk/src/emx/src/lib/misc/386/div.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    33#include <emx/asm386.h>
    44
    5         .globl _div, _ldiv
     5        .globl _STD(div), _STD(ldiv)
    66
    77        .text
     
    1111/ ldiv_t ldiv (long num, long den)
    1212
    13 _ldiv:
    14 _div:
     13_STD(ldiv):
     14_STD(div):
    1515        PROFILE_NOFRAME
    1616        movl    1*4(%esp), %eax         /* num */
    1717        cltd                            /* sign extension */
    1818        idivl   2*4(%esp)               /* den */
    19         EPILOGUE(div)
     19        EPILOGUE(_STD(div))
  • trunk/src/emx/src/lib/misc/386/setjmp.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    33#include <emx/asm386.h>
    44
    5         .globl _setjmp, _longjmp
     5        .globl _STD(setjmp), _STD(longjmp)
    66
    77        .text
     
    2020/ int setjmp (jmp_buf here)
    2121
    22 _setjmp:
     22_STD(setjmp):
    2323        PROFILE_NOFRAME
    2424        movl    1*4(%esp), %edx         /* here */
     
    3434        movl    %eax, J_XCP(%edx)
    3535        xorl    %eax, %eax
    36         EPILOGUE(setjmp)
     36        EPILOGUE(_STD(setjmp))
    3737
    3838        ALIGN
     
    4040/ void longjmp (jmp_buf there, int n)
    4141
    42 _longjmp:
     42_STD(longjmp):
    4343        PROFILE_NOFRAME
    4444        movl    1*4(%esp), %eax         /* there */
     
    5858        movl    J_EIP(%edx), %edx
    5959        movl    %edx, 0*4(%esp)         /* return address */
    60         EPILOGUE(longjmp)               /* well, ... */
     60        EPILOGUE(_STD(longjmp))         /* well, ... */
  • trunk/src/emx/src/lib/misc/abort.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r235 r236  
    1414
    1515  /* Special handling if there's a signal-catching function installed
    16      and SIGABRT is not blocked: do not yet call _cleanup(). */
     16     and SIGABRT is not blocked: do not yet call _CRT_term(). */
    1717
    1818  if (sigaction (SIGABRT, NULL, &act) == 0
     
    3838
    3939  if (abort_flag++ == 0)
    40     _cleanup ();
     40    _CRT_term ();
    4141
    4242  /* Unblock SIGABRT. */
  • trunk/src/emx/src/lib/misc/abspath.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* abspath.c (emx+gcc) -- Copyright (c) 1992-1998 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <string.h>
  • trunk/src/emx/src/lib/misc/assert.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    33#undef NDEBUG
    44
     5#include "libc-alias.h"
    56#include <assert.h>
    67#include <stdio.h>
  • trunk/src/emx/src/lib/misc/chdir2.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* chdir2.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <string.h>
  • trunk/src/emx/src/lib/misc/defext.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* defext.c (emx+gcc) -- Copyright (c) 1990-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <string.h>
  • trunk/src/emx/src/lib/misc/dtread.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    11/* dtread.c (emx+gcc) -- Copyright (c) 1987-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <string.h>
     
    164165  int len, saved_errno;
    165166
    166   if (!_tzset_flag) _tzset ();
     167  if (!_tzset_flag) tzset ();
    167168  data.dir = dir;
    168169  data.mask = mask;
  • trunk/src/emx/src/lib/misc/dtsort.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* dtsort.c (emx+gcc) -- Copyright (c) 1987-1995 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <string.h>
  • trunk/src/emx/src/lib/misc/dtsplit.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* dtsplit.c (emx+gcc) -- Copyright (c) 1987-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <string.h>
  • trunk/src/emx/src/lib/misc/envargs.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* envargs.c (emx+gcc) -- Copyright (c) 1993-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <string.h>
  • trunk/src/emx/src/lib/misc/fnexplod.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* fnexplod.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <string.h>
  • trunk/src/emx/src/lib/misc/fngetdrv.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* fngetdrv.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45
  • trunk/src/emx/src/lib/misc/fnisabs.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* fnisabs.c (emx+gcc) -- Copyright (c) 1992-1995 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <ctype.h>
  • trunk/src/emx/src/lib/misc/fnisrel.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* fnisrel.c (emx+gcc) -- Copyright (c) 1993-1995 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <ctype.h>
  • trunk/src/emx/src/lib/misc/fnslashi.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* fnslashi.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <sys/nls.h>
  • trunk/src/emx/src/lib/misc/fullpath.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* fullpath.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdio.h>
    45#include <stdlib.h>
  • trunk/src/emx/src/lib/misc/getcwd1.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* getcwd1.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <emx/syscalls.h>
  • trunk/src/emx/src/lib/misc/getcwd2.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* getcwd2.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <string.h>
  • trunk/src/emx/src/lib/misc/getegid.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    11/* getegid.c (emx+gcc) -- Copyright (c) 1994-1995 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <unistd.h>
    45#include <sys/types.h>
  • trunk/src/emx/src/lib/misc/geteuid.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    11/* geteuid.c (emx+gcc) -- Copyright (c) 1994-1995 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <unistd.h>
    45#include <sys/types.h>
  • trunk/src/emx/src/lib/misc/getext.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* getext.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <string.h>
  • trunk/src/emx/src/lib/misc/getext2.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* getext2.c (emx+gcc) -- Copyright (c) 1993 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <string.h>
  • trunk/src/emx/src/lib/misc/getgrgid.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    11/* getgrgid.c (emx+gcc) -- Copyright (c) 1994-1995 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <string.h>
    45#include <sys/types.h>
  • trunk/src/emx/src/lib/misc/getname.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    1313/* Note: This function is used by emx.dll. */
    1414
    15 char *_STD(getname) (const char *path)
     15char *_getname (const char *path)
    1616{
    1717  const char *p;
  • trunk/src/emx/src/lib/misc/getopt.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r235 r236  
    11/* getopt.c (emx+gcc) -- Copyright (c) 1990-1995 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdio.h>
    45#include <stdlib.h>
     
    67#include <emx/getopt.h>
    78
    8 char *_optarg          = NULL;
    9 int _optind            = 1;              /* Default: first call             */
    10 int _opterr            = 1;              /* Default: error messages enabled */
    11 char *_optswchar       = "-";            /* Default: '-' starts options     */
    12 enum _optmode _optmode = GETOPT_UNIX;
    13 int _optopt;
     9char *optarg          = NULL;
     10int optind            = 1;              /* Default: first call             */
     11int opterr            = 1;              /* Default: error messages enabled */
     12char *optswchar       = "-";            /* Default: '-' starts options     */
     13enum _optmode optmode = GETOPT_UNIX;
     14int optopt;
    1415
    1516static char * next_opt;             /* Next character in cluster of options */
     
    2829
    2930#define PUT(dst) BEGIN \
    30                   if (_optmode == GETOPT_ANY) \
    31                     dst[dst##_count++] = argv[_optind]; \
     31                  if (optmode == GETOPT_ANY) \
     32                    dst[dst##_count++] = argv[optind]; \
    3233                 END
    3334
    3435/* Note: `argv' is not const as GETOPT_ANY reorders argv[]. */
    3536
    36 int _getopt (int argc, char * argv[], const char *opt_str)
     37int _STD(getopt) (int argc, char * argv[], const char *opt_str)
    3738{
    3839  char c, *q;
    3940  int i, j;
    4041
    41   if (!init || _optind == 0)
     42  if (!init || optind == 0)
    4243    {
    43       if (_optind == 0) _optind = 1;
     44      if (optind == 0) optind = 1;
    4445      done = 0; init = 1;
    4546      next_opt = "";
    46       if (_optmode == GETOPT_ANY)
     47      if (optmode == GETOPT_ANY)
    4748        {
    4849          options = (char **)malloc (argc * sizeof (char *));
     
    5960    return -1;
    6061restart:
    61   _optarg = NULL;
     62  optarg = NULL;
    6263  if (*next_opt == 0)
    6364    {
    64       if (_optind >= argc)
     65      if (optind >= argc)
    6566        {
    66           if (_optmode == GETOPT_ANY)
     67          if (optmode == GETOPT_ANY)
    6768            {
    6869              j = 1;
     
    7172              for (i = 0; i < non_options_count; ++i)
    7273                argv[j++] = non_options[i];
    73               _optind = options_count+1;
     74              optind = options_count+1;
    7475              free (options); free (non_options);
    7576            }
     
    7778          return -1;
    7879        }
    79       else if (!strchr (_optswchar, argv[_optind][0]) || argv[_optind][1] == 0)
     80      else if (!strchr (optswchar, argv[optind][0]) || argv[optind][1] == 0)
    8081        {
    81           if (_optmode == GETOPT_UNIX)
     82          if (optmode == GETOPT_UNIX)
    8283            {
    8384              done = 1;
     
    8586            }
    8687          PUT (non_options);
    87           _optarg = argv[_optind++];
    88           if (_optmode == GETOPT_ANY)
     88          optarg = argv[optind++];
     89          if (optmode == GETOPT_ANY)
    8990            goto restart;
    90           /* _optmode==GETOPT_KEEP */
     91          /* optmode==GETOPT_KEEP */
    9192          return 0;
    9293        }
    93       else if (argv[_optind][0] == argv[_optind][1] && argv[_optind][2] == 0)
     94      else if (argv[optind][0] == argv[optind][1] && argv[optind][2] == 0)
    9495        {
    95           if (_optmode == GETOPT_ANY)
     96          if (optmode == GETOPT_ANY)
    9697            {
    9798              j = 1;
    9899              for (i = 0; i < options_count; ++i)
    99100                argv[j++] = options[i];
    100               argv[j++] = argv[_optind];
     101              argv[j++] = argv[optind];
    101102              for (i = 0; i < non_options_count; ++i)
    102103                argv[j++] = non_options[i];
    103               for (i = _optind+1; i < argc; ++i)
     104              for (i = optind+1; i < argc; ++i)
    104105                argv[j++] = argv[i];
    105               _optind = options_count+2;
     106              optind = options_count+2;
    106107              free (options); free (non_options);
    107108            }
    108           ++_optind;
     109          ++optind;
    109110          done = 1;
    110111          return -1;
     
    113114        {
    114115          PUT (options);
    115           sw_char = argv[_optind][0];
    116           next_opt = argv[_optind]+1;
     116          sw_char = argv[optind][0];
     117          next_opt = argv[optind]+1;
    117118        }
    118119    }
    119120  c = *next_opt++;
    120121  if (*next_opt == 0)  /* Move to next argument if end of argument reached */
    121     ++_optind;
     122    ++optind;
    122123  if (c == ':' || (q = strchr (opt_str, c)) == NULL)
    123124    {
    124       if (_opterr && opt_str[0] != ':')
     125      if (opterr && opt_str[0] != ':')
    125126        {
    126127          if (c < ' ' || c >= 127)
     
    131132                     argv[0], sw_char, c);
    132133        }
    133       _optopt = c;
     134      optopt = c;
    134135      return '?';
    135136    }
     
    138139      if (*next_opt != 0)         /* Argument given */
    139140        {
    140           _optarg = next_opt;
     141          optarg = next_opt;
    141142          next_opt = "";
    142           ++_optind;
     143          ++optind;
    143144        }
    144145      else if (q[2] == ':')
    145         _optarg = NULL;           /* Optional argument missing */
    146       else if (_optind >= argc)
     146        optarg = NULL;            /* Optional argument missing */
     147      else if (optind >= argc)
    147148        {                         /* Required argument missing */
    148           if (_opterr && opt_str[0] != ':')
     149          if (opterr && opt_str[0] != ':')
    149150            fprintf (stderr, "%s: no argument for `%c%c' option\n",
    150151                     argv[0], sw_char, c);
    151           _optopt = c;
     152          optopt = c;
    152153          return (opt_str[0] == ':' ? ':' : '?');
    153154        }
     
    155156        {
    156157          PUT (options);
    157           _optarg = argv[_optind++];
     158          optarg = argv[optind++];
    158159        }
    159160    }
  • trunk/src/emx/src/lib/misc/getpass1.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* getpass1.c (emx+gcc) -- Copyright (c) 1994-1995 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <unistd.h>
    45#include <sys/ioctl.h>
  • trunk/src/emx/src/lib/misc/getpass2.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    22/*                         Copyright (c) 1994-1995 by Eberhard Mattes */
    33
     4#include "libc-alias.h"
    45#include <stdio.h>
    56#include <stdlib.h>
  • trunk/src/emx/src/lib/misc/getvol.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* getvol.c (emx+gcc) -- Copyright (c) 1994-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <string.h>
     
    1112char *_getvol (char drive)
    1213{
    13 #if defined (__MT__)
    1414  struct _thread *tp = _thread();
    15 #define result (tp->_th_vollabel)
    16 #else
    17   static char result[12];
    18 #endif
    1915
    2016  if (drive == 0)
     
    3329  if (rc != 0)
    3430    return NULL;
    35   strcpy (result, fsinfo.vol.szVolLabel);
     31  strcpy (tp->_th_vollabel, fsinfo.vol.szVolLabel);
    3632
    37   return result;
     33  return tp->_th_vollabel;
    3834}
  • trunk/src/emx/src/lib/misc/glob.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    11/* glob.c (emx+gcc) -- Copyright (c) 1995-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <string.h>
  • trunk/src/emx/src/lib/misc/makepath.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* makepath.c (emx+gcc) -- Copyright (c) 1993-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <sys/nls.h>
  • trunk/src/emx/src/lib/misc/os2bad.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    11/* os2bad.c (emx+gcc) */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <emx/syscalls.h>
  • trunk/src/emx/src/lib/misc/path.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* path.c (emx+gcc) -- Copyright (c) 1990-1995 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <string.h>
  • trunk/src/emx/src/lib/misc/rand.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    55#include <emx/thread.h>
    66
    7 #if defined (__MT__)
    8 #define _rand (tp->_th_rand)
    9 #else
    10 static unsigned int _rand = 1;
    11 #endif
    12 
    13 
    147int _STD(rand) (void)
    158{
    16 #if defined (__MT__)
    179  struct _thread *tp = _thread();
    18 #endif
    19 
    20   _rand = _rand * 69069 + 5;
    21   return (_rand >> 16) & 0x7fff;
     10  tp->_th_rand = tp->_th_rand * 69069 + 5;
     11  return (tp->_th_rand >> 16) & 0x7fff;
    2212}
    23 
    2413
    2514void _STD(srand) (unsigned int seed)
    2615{
    27 #if defined (__MT__)
    2816  struct _thread *tp = _thread();
    29 #endif
    30 
    31   _rand = seed;
     17  tp->_th_rand = seed;
    3218}
  • trunk/src/emx/src/lib/misc/readkbd.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* readkbd.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <emx/syscalls.h>
  • trunk/src/emx/src/lib/misc/remext.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* remext.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <string.h>
  • trunk/src/emx/src/lib/misc/response.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* response.c (emx+gcc) -- Copyright (c) 1990-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdio.h>
    45#include <stdlib.h>
  • trunk/src/emx/src/lib/misc/searchen.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* searchen.c (emx+gcc) -- Copyright (c) 1990-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <string.h>
  • trunk/src/emx/src/lib/misc/splitarg.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* splitarg.c (emx+gcc) -- Copyright (c) 1993-1995 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <errno.h>
  • trunk/src/emx/src/lib/misc/splitpat.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* splitpath.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <string.h>
  • trunk/src/emx/src/lib/misc/swchar.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* swchar.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <emx/syscalls.h>
  • trunk/src/emx/src/lib/misc/wildcard.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* wildcard.c (emx+gcc) -- Copyright (c) 1990-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdio.h>
    45#include <stdlib.h>
  • trunk/src/emx/src/lib/omflib/omflib0.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    66#define TRUE  1
    77
     8#ifndef _BYTE_WORD_DWORD
     9#define _BYTE_WORD_DWORD
    810typedef unsigned char byte;
    911typedef unsigned short word;
    1012typedef unsigned long dword;
    11 
     13#endif /* _BYTE_WORD_DWORD */
    1214
    1315#define FLAG_DELETED  0x0001
  • trunk/src/emx/src/lib/process/386/_errno.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    33#include <emx/asm386.h>
    44
    5 #if defined (__MT__)
     5        .globl  __errno
     6        .globl  __errno_fun
    67
    7         .globl  __errno
    8         .globl  __errno_fun
     8        .text
    99
    10         .text
    11 
    12         ALIGN
     10        ALIGN
    1311
    1412__errno:
    1513__errno_fun:
    16         fs
    17         movl    12, %eax                /* ptib2 */
    18         movl    0(%eax), %eax           /* TID */
    19         movl    __thread_tab(,%eax,4), %eax
    20 /       addl    $0, %eax                /* address of errno */
    21         EPILOGUE(_errno)
    22 
    23 #else
    24 
    25         .globl  __errno
    26 
    27         .text
    28 
    29         ALIGN
    30 
    31 __errno:
    32         movl    $_errno, %eax
    33         EPILOGUE(_errno)
    34 
    35 #endif
     14        fs
     15        movl    12, %eax                /* ptib2 */
     16        movl    0(%eax), %eax           /* TID */
     17        movl    __thread_tab(,%eax,4), %eax
     18/       addl    $0, %eax                /* address of errno */
     19        EPILOGUE(_errno)
  • trunk/src/emx/src/lib/process/386/thread.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    11/ thread.s (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes
    2 
    3 #if defined (__MT__)
    42
    53#include <emx/asm386.h>
    64
    7         .globl  __thread
     5        .globl  __thread
    86
    9         .text
     7        .text
    108
    11         ALIGN
     9        ALIGN
    1210
    1311__thread:
    14         fs
    15         movl    12, %eax                /* ptib2 */
    16         movl    0(%eax), %edx           /* TID */
    17         movl    __thread_tab(,%edx,4), %eax
    18         testl   %eax, %eax
    19         jz      1f
     12        fs
     13        movl    12, %eax                /* ptib2 */
     14        movl    0(%eax), %edx           /* TID */
     15        movl    __thread_tab(,%edx,4), %eax
     16        testl   %eax, %eax
     17        jnz     Lreturn
     18
     19        pushl   %edx
     20        call    ___alloc_thread
     21        popl    %edx
     22        testl   %eax, %eax
     23        jz      Lreturn
     24        movl    %eax, __thread_tab(,%edx,4)
     25
    2026Lreturn:EPILOGUE(_thread)
    21 
    22         ALIGN
    23 1:      pushl   %edx
    24         call    ___alloc_thread
    25         popl    %edx
    26         testl   %eax, %eax
    27         jz      Lreturn
    28         movl    %eax, __thread_tab(,%edx,4)
    29         jmp     Lreturn
    30 
    31 #endif
  • trunk/src/emx/src/lib/process/beginthr.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* beginth.c (emx+gcc) -- Copyright (c) 1992-1998 by Eberhard Mattes */
    22
    3 #if defined (__MT__)
    4 
     3#include "libc-alias.h"
    54#include <stdlib.h>
    65#include <string.h>
     
    131130    DosExit ((tid == 1 ? EXIT_PROCESS : EXIT_THREAD), 0);
    132131}
    133 
    134 #endif
  • trunk/src/emx/src/lib/process/fmutex.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* fmutex.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#define INCL_DOSSEMAPHORES
    45#define INCL_DOSPROCESS
  • trunk/src/emx/src/lib/process/fmutex2.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* fmutex2.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <sys/builtin.h>
  • trunk/src/emx/src/lib/process/fork.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r235 r236  
    1212
    1313  pid = __fork ();
    14 #if defined (__MT__)
    1514  if (pid == 0)
    1615    _rmutex_fork ();
    17 #endif
    1816  return pid;
    1917}
  • trunk/src/emx/src/lib/process/rmutex.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* rmutex.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#define INCL_DOSERRORS
    45#include <os2.h>
  • trunk/src/emx/src/lib/process/smutex.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* smutex.c (emx+gcc) */
    22
     3#include "libc-alias.h"
    34#define INCL_DOSPROCESS
    45#include <os2.h>
  • trunk/src/emx/src/lib/process/threadst.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* threadst.c (emx+gcc) -- Copyright (c) 1993-1996 by Eberhard Mattes */
    22
    3 #if defined (__MT__)
    4 
     3#include "libc-alias.h"
    54#include <stdlib.h>
    65#include <emx/thread.h>
     
    109  return &_thread()->_th_store;
    1110}
    12 
    13 #endif
  • trunk/src/emx/src/lib/socket/inetntoa.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    88char *inet_ntoa (struct in_addr in)
    99{
    10 #if defined (__MT__)
    1110  struct _thread *tp = _thread ();
    12 #define result (tp->_th_inetntoa)
    13 #else
    14   static char result[16];
    15 #endif
    1611  unsigned char *t;
    1712
    1813  t = (unsigned char *)&in;
    19   sprintf (result, "%d.%d.%d.%d",
     14  sprintf (tp->_th_inetntoa, "%d.%d.%d.%d",
    2015           t[0] & 0xff, t[1] & 0xff, t[2] & 0xff, t[3] & 0xff);
    21   return result;
     16  return tp->_th_inetntoa;
    2217}
  • trunk/src/emx/src/lib/startup/386/crt0.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    1 / crt0.s (emx+gcc) -- Copyright (c) 1990-1998 by Eberhard Mattes
     1/*
     2    Application entry point.
     3
     4    Copyright (c) 1992-1998 by Eberhard Mattes
     5    Copyright (c) 2003 InnoTek Systemberatung GmbH
     6
     7    This is the routine that gets control first.
     8    It should prepare argc/argv/envp and call the
     9    main function.
     10*/
     11
     12#include <emx/asm386.h>
    213
    314        .globl  __text
     
    718
    819__text:
    9         push    $__data
    10         call    __emx_init
     20        call    ___init_app
    1121        cld
    12         call    __entry1
    13         call    __entry2
     22        leal    (%esp), %edi    /* argv[] */
     23        movl    %edi, _STD(environ)
     24        movl    %edi, __org_environ
     25        pushl   %edi            /* envp */
     26        call    L_ptr_tbl
     27        pushl   %edi            /* argv */
     28        call    L_ptr_tbl
     29        pushl   %ecx            /* argc */
    1430#if defined (MCRT0)
    1531        pushl   $__mcleanup
    1632        call    _atexit
    17         addl    $4, %esp
    1833        pushl   $__etext
    1934        pushl   $__text
    2035        call    _monstartup
    21         addl    $2*4, %esp
     36        addl    $3*4, %esp
    2237#endif
    23         call    __startup
     38        call    __CRT_init
    2439        call    _main
    2540        addl    $3*4, %esp
    2641        pushl   %eax
    2742        call    _exit
    28 2:      jmp     2b
     431:      jmp     1b              /* Just in case exit() returns :-) */
     44
     45L_ptr_tbl:
     46        xorl    %eax, %eax
     47        movl    $-1, %ecx
     482:      incl    %ecx
     49        scasl
     50        jne     2b
     51        ret
    2952
    3053        .data
     
    3457        .long   __os2dll        // list of OS/2 DLL references
    3558
    36         .stabs  "__os2dll", 21, 0, 0, 0xffffffff
     59        .stabs  "__os2dll", 21, 0, 0, 0xffffffff
    3760        .stabs  "___CTOR_LIST__", 21, 0, 0, 0xffffffff
    3861        .stabs  "___DTOR_LIST__", 21, 0, 0, 0xffffffff
  • trunk/src/emx/src/lib/startup/386/dll0.s

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    1 / dll0.s (emx+gcc) -- Copyright (c) 1992-1998 by Eberhard Mattes
     1/*
     2    Standard entry point for dynamic libraries.
     3
     4    Copyright (c) 1992-1998 by Eberhard Mattes
     5    Copyright (c) 2003 InnoTek Systemberatung GmbH
     6
     7    This routine gets control right after dynamic library
     8    is loaded.
     9*/
     10
     11#include <emx/asm386.h>
    212
    313        .globl  __text
     
    717
    818__text:
    9         push    $__data
    10         call    __emx_init
    11         cld
    12         pushl   %ebp
    13         movl    %esp, %ebp
    14         pushl   12(%ebp)
    15         pushl   8(%ebp)
    16         call    __DLL_InitTerm
    17         addl    $8, %esp
    18         popl    %ebp
    19         ret
     19        call    ___init_dll
     20        cld
     21        pushl   %ebp
     22        movl    %esp, %ebp
     23        pushl   12(%ebp)
     24        pushl   8(%ebp)
     25        call    __DLL_InitTerm
     26        addl    $8, %esp
     27        popl    %ebp
     28        ret
    2029
    21         .data
     30        .data
    2231
    2332__data:
    2433        .long   0xba0bab        // Magic number (error detection)
    25         .long   __os2dll        // list of OS/2 DLL references
     34        .long   __os2dll        // list of OS/2 DLL references
    2635
    27         .stabs  "__os2dll", 21, 0, 0, 0xffffffff
    28         .stabs  "___CTOR_LIST__", 21, 0, 0, 0xffffffff
    29         .stabs  "___DTOR_LIST__", 21, 0, 0, 0xffffffff
    30         .stabs  "___crtinit1__", 21, 0, 0, 0xffffffff
    31         .stabs  "___crtexit1__", 21, 0, 0, 0xffffffff
    32         .stabs  "___eh_frame__", 21, 0, 0, 0xffffffff
     36        .stabs  "__os2dll", 21, 0, 0, 0xffffffff
     37        .stabs  "___CTOR_LIST__", 21, 0, 0, 0xffffffff
     38        .stabs  "___DTOR_LIST__", 21, 0, 0, 0xffffffff
     39        .stabs  "___crtinit1__", 21, 0, 0, 0xffffffff
     40        .stabs  "___crtexit1__", 21, 0, 0, 0xffffffff
     41        .stabs  "___eh_frame__", 21, 0, 0, 0xffffffff
  • trunk/src/emx/src/lib/startup/cleanup.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    66extern void __ctordtorTerm1 (int *ptr);
    77
    8 void _cleanup (void)
     8void _CRT_term (void)
    99{
    1010  __ctordtorTerm1 (&__crtexit1__);
  • trunk/src/emx/src/lib/startup/dllinit.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* static/dllinit.c (emx+gcc) -- Copyright (c) 1994-1996 by Eberhard Mattes */
    22
    3 int _CRT_init (void);
     3#include <emx/startup.h>
     4
    45void __ctordtorInit (void);
    56void __ctordtorTerm (void);
  • trunk/src/emx/src/lib/startup/exit.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    1414  for (i = _atexit_n-1; i >= 0; --i)
    1515    _atexit_v[i]();
    16   _cleanup ();
     16  _CRT_term ();
    1717  _exit (ret);
    1818}
  • trunk/src/emx/src/lib/startup/gmon.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    140140        return;
    141141    }
    142 #   ifdef DEBUG
     142#   ifdef GMON_DEBUG
    143143        fprintf( stderr , "[mcleanup] sbuf 0x%x ssiz %d\n" , sbuf , ssiz );
    144 #   endif /* DEBUG */
     144#   endif /* GMON_DEBUG */
    145145    write( fd , sbuf , ssiz );
    146146    endfrom = s_textsize / (HASHFRACTION * sizeof(*froms));
     
    151151        frompc = s_lowpc + (fromindex * HASHFRACTION * sizeof(*froms));
    152152        for (toindex=froms[fromindex]; toindex!=0; toindex=tos[toindex].link) {
    153 #           ifdef DEBUG
     153#           ifdef GMON_DEBUG
    154154                fprintf( stderr ,
    155155                        "[mcleanup] frompc 0x%x selfpc 0x%x count %d\n" ,
    156156                        frompc , tos[toindex].selfpc , tos[toindex].count );
    157 #           endif /* DEBUG */
     157#           endif /* GMON_DEBUG */
    158158            rawarc.raw_frompc = (unsigned long) frompc;
    159159            rawarc.raw_selfpc = (unsigned long) tos[toindex].selfpc;
  • trunk/src/emx/src/lib/startup/startup.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    1818extern void __ctordtorInit1 (int *ptr);
    1919
    20 /* The version of this libc. */
    21 static const char _libc_version[] =
    22   " libc for emx 0.9d";
    23 
    24 /* Display this warning if emx.dll or emx.exe is out of date. */
    25 static const char _version_warning[] =
    26   "WARNING: emx 0.9d or later required\r\n";
    27 
    28 
    2920static void init_files (void);
    30 
    3121
    3222/* Initialize the C run-time library.  This function is called from
    3323   crt0.s. */
    34 
    35 void _startup (void)
     24int _CRT_init (void)
    3625{
    3726  static int startup_flag;
     
    3928  /* Protect against multiple calls (for instance, by _CRT_init() in a
    4029     _DLL_InitTerm() and by the application program's startup code). */
    41 
    4230  if (startup_flag)
    43     return;
     31    return 0;
    4432  startup_flag = 1;
    4533
    46   /* Print a warning message on handle 2 (stderr) if emx.dll or
    47      emx.exe is out of date. */
    48 
    49   if (_emx_vcmp < 0x302e3964)   /* 0.9d */
    50     __write (2, _version_warning, sizeof (_version_warning) - 1);
    51 
    5234  /* Initialize the file handles. */
    53 
    5435  init_files ();
    5536
    5637  /* Initialize streams etc. if required. */
    57 
    5838  __ctordtorInit1 (&__crtinit1__);
    5939
     
    6343     The above code usually sets errno to EBADF, therefore we reset
    6444     errno to zero before calling main(). */
     45  errno = 0;
    6546
    66   errno = 0;
     47  return 0;
    6748}
    6849
  • trunk/src/emx/src/lib/startup/startup.smak

    • Property cvs2svn:cvs-rev changed from 1.6 to 1.7
    r235 r236  
    1 libc.TSRC.386 += src/lib/startup/386/crt1.s
    2 libc.TSRC += $(addprefix src/lib/startup/, crtinit.c crtterm.c cleanup.c \
    3   ctor1.c dtor1.c exit.c startup.c _exit.c dllinit.c)
     1libc.TSRC += $(filter-out %gmon.c,$(wildcard src/lib/startup/*.c))
    42
    53# Build startup object files separately (not included in libraries)
     
    1917libc: $(.DIRS) $(.OBJS)
    2018
    21 DO.INSTALL += $(call CP,$(.OBJS) $(INS)lib/)$(NL)
     19INS.FILES += $(addprefix $(INS)lib/,$(notdir $(.OBJS)))
     20$(addprefix $(INS)lib/,$(notdir $(.OBJS))): $(.OBJS)
     21        $(call CP,$^,$(dir $@))
    2222
    2323$.aout/src/lib/startup/mcrt0.o: src/lib/startup/386/crt0.s
  • trunk/src/emx/src/lib/static/dllinit.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* static/dllinit.c (emx+gcc) -- Copyright (c) 1994-1996 by Eberhard Mattes */
    22
    3 int _CRT_init (void);
     3#include <emx/startup.h>
     4
    45void __ctordtorInit (void);
    56void __ctordtorTerm (void);
  • trunk/src/emx/src/lib/str/386/bcmp.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    33#include <emx/asm386.h>
    44
    5         .globl __bcmp
     5        .globl _STD(bcmp)
    66
    77/ int _bcmp (const void *s1, const void *s2, size_t n)
     
    2121        ALIGN
    2222
    23 __bcmp:
     23_STD(bcmp):
    2424        PROFILE_NOFRAME
    2525        pushl   %esi
     
    36361:      popl    %edi
    3737        popl    %esi
    38         EPILOGUE(_bcmp)
     38        EPILOGUE(_STD(bcmp))
  • trunk/src/emx/src/lib/str/386/bcopy.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    33#include <emx/asm386.h>
    44
    5         .globl __bcopy
     5        .globl _STD(bcopy)
    66
    77/ void _bcopy (const void *s1, void *s2, size_t n)
     
    2323        ALIGN
    2424
    25 __bcopy:
     25_STD(bcopy):
    2626        PROFILE_NOFRAME
    2727        pushl   %esi
     
    6060Lreturn:popl    %edi
    6161        popl    %esi
    62         EPILOGUE(_bcopy)
     62        EPILOGUE(_STD(bcopy))
  • trunk/src/emx/src/lib/str/386/bzero.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    33#include <emx/asm386.h>
    44
    5         .globl __bzero
     5        .globl _STD(bzero)
    66
    77/ void _bzero (void *s, size_t n)
     
    1919        ALIGN
    2020
    21 __bzero:
     21_STD(bzero):
    2222        PROFILE_NOFRAME
    2323        pushl   %edi
     
    3333        stosb
    3434        popl    %edi
    35         EPILOGUE(_bzero)
     35        EPILOGUE(_STD(bzero))
  • trunk/src/emx/src/lib/str/386/ffs.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    33#include <emx/asm386.h>
    44
    5         .globl  __ffs
     5        .globl  _STD(ffs)
    66
    77/ int _ffs (int i)
     
    2020        ALIGN
    2121
    22 __ffs:
     22_STD(ffs):
    2323        PROFILE_NOFRAME
    2424        movl    1*4(%esp), %edx         /* i */
     
    3030Lzero:  xorl    %eax, %eax
    3131        ALIGN
    32 Lreturn:EPILOGUE(_ffs)
     32Lreturn:EPILOGUE(_STD(ffs))
  • trunk/src/emx/src/lib/str/386/index.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    33#include <emx/asm386.h>
    44
    5         .globl __index
     5        .globl _STD(index)
    66
    77/ char *_index (const char *string, int c)
     
    1919        ALIGN
    2020
    21 __index:
     21_STD(index):
    2222        PROFILE_NOFRAME
    2323        pushl   %esi
     
    48483:      lea     -1(%esi), %eax
    4949Ldone:  popl    %esi
    50         EPILOGUE(_index)
     50        EPILOGUE(_STD(index))
  • trunk/src/emx/src/lib/str/386/memchr.s

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    4040        ALIGN
    4141Ldone:  popl    %edi
    42         EPILOGUE(memchr)
     42        EPILOGUE(_STD(memchr))
  • trunk/src/emx/src/lib/str/386/memcmp.s

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    4141Ldone:  popl    %edi
    4242        popl    %esi
    43         EPILOGUE(memcmp)
     43        EPILOGUE(_STD(memcmp))
  • trunk/src/emx/src/lib/str/386/memcpy.s

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    3737        popl    %edi
    3838        popl    %esi
    39         EPILOGUE(memcpy)
     39        EPILOGUE(_STD(memcpy))
  • trunk/src/emx/src/lib/str/386/memmove.s

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    6363        popl    %edi
    6464        popl    %esi
    65         EPILOGUE(memmove)
     65        EPILOGUE(_STD(memmove))
  • trunk/src/emx/src/lib/str/386/memset.s

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    3939        movl    2*4(%esp), %eax         /* s */
    4040        popl    %edi
    41         EPILOGUE(memset)
     41        EPILOGUE(_STD(memset))
  • trunk/src/emx/src/lib/str/386/rindex.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    33#include <emx/asm386.h>
    44
    5         .globl __rindex
     5        .globl _STD(rindex)
    66 
    77/ char *_rindex (const char *string, int c)
     
    2323        ALIGN
    2424
    25 __rindex:
     25_STD(rindex):
    2626        PROFILE_NOFRAME
    2727        pushl   %edi
     
    4545Lnull:  xorl    %eax, %eax
    4646Lreturn:popl    %edi
    47         EPILOGUE(_rindex)
     47        EPILOGUE(_STD(rindex))
  • trunk/src/emx/src/lib/str/386/strcat.s

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    4242        popl    %edi
    4343        popl    %esi
    44         EPILOGUE(strcat)
     44        EPILOGUE(_STD(strcat))
  • trunk/src/emx/src/lib/str/386/strchr.s

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    4848Lfound: lea     -1(%esi), %eax
    4949Lreturn:popl    %esi
    50         EPILOGUE(strchr)
     50        EPILOGUE(_STD(strchr))
  • trunk/src/emx/src/lib/str/386/strcmp.s

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    4444Lreturn:popl    %edi
    4545        popl    %esi
    46         EPILOGUE(strcmp)
     46        EPILOGUE(_STD(strcmp))
  • trunk/src/emx/src/lib/str/386/strcpy.s

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    3535        popl    %edi
    3636        popl    %esi
    37         EPILOGUE(strcpy)
     37        EPILOGUE(_STD(strcpy))
  • trunk/src/emx/src/lib/str/386/strlen.s

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    3131        subl    %ecx, %eax
    3232        popl    %edi
    33         EPILOGUE(strlen)
     33        EPILOGUE(_STD(strlen))
  • trunk/src/emx/src/lib/str/386/strrchr.s

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    4545Lnull:  xorl    %eax, %eax
    4646Lreturn:popl    %edi
    47         EPILOGUE(strrchr)
     47        EPILOGUE(_STD(strrchr))
  • trunk/src/emx/src/lib/str/386/swab.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    33#include <emx/asm386.h>
    44
    5         .globl __swab
     5        .globl _STD(swab)
    66
    77/ void _swab (const void *src, void *dst, size_t n)
     
    2424        ALIGN
    2525
    26 __swab:
     26_STD(swab):
    2727        PROFILE_NOFRAME
    2828        pushl   %esi
     
    4141Lreturn:popl    %edi
    4242        popl    %esi
    43         EPILOGUE(_swab)
     43        EPILOGUE(_STD(swab))
  • trunk/src/emx/src/lib/str/strerror.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r235 r236  
    1313    {
    1414      static char msg[] = "Unknown error ";
    15 #if defined (__MT__)
    1615      struct _thread *tp = _thread();
    17 #define result (tp->_th_error)
    18 #else
    19       static char result[32];
    20 #endif
    21       memcpy (result, msg, sizeof (msg) - 1);
    22       _itoa (errnum, result + sizeof (msg) - 1, 10);
    23       return result;
     16      memcpy (tp->_th_error, msg, sizeof (msg) - 1);
     17      _itoa (errnum, tp->_th_error + sizeof (msg) - 1, 10);
     18      return tp->_th_error;
    2419    }
    2520}
  • trunk/src/emx/src/lib/str/strtok.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r235 r236  
    99  char table[256];
    1010  unsigned char *p, *result;
    11 #if defined (__MT__)
    1211  struct _thread *tp = _thread ();
    13 #define next (tp->_th_strtok_ptr)
    14 #else
    15     static unsigned char *next = NULL;
    16 #endif
    1712  if (string1 != NULL)
    1813    p = (unsigned char *)string1;
    1914  else
    2015    {
    21       if (next == NULL)
     16      if (tp->_th_strtok_ptr == NULL)
    2217        return NULL;
    23       p = next;
     18      p = tp->_th_strtok_ptr;
    2419    }
    2520  memset (table, 0, 256);
     
    3732      if (p == result)
    3833        {
    39           next = NULL;
     34          tp->_th_strtok_ptr = NULL;
    4035          return NULL;
    4136        }
     
    4338  else
    4439    *p++ = 0;
    45   next = p;
     40  tp->_th_strtok_ptr = p;
    4641  return (char *)result;
    4742}
  • trunk/src/emx/src/lib/sys/386/systhrea.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/ systhrea.s (emx+gcc) -- Copyright (c) 1993-1996 by Eberhard Mattes
    2 
    3 #if defined (__MT__)
    42
    53        .globl  __sys_thread
     
    2725        movl    __sys_thread_table(,%edx,4), %eax
    2826        ret
    29 
    30 #endif
  • trunk/src/emx/src/lib/sys/386/thunk0.s

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/ thunk0.asm (emx+gcc) -- Copyright (c) 1992-1993 by Eberhard Mattes
    22
    3                 .globl  __emx_16to32
    4                 .globl  __emx_32to16
     3                .globl  __libc_16to32
     4                .globl  __libc_32to16
    55
    66                .p2align 2
    7 __emx_32to16:   movl    4(%esp),%eax
     7__libc_32to16:  movl    4(%esp),%eax
    88                jmp     DosFlatToSel
    99
    1010                .p2align 2
    11 __emx_16to32:   movl    4(%esp),%eax
     11__libc_16to32:  movl    4(%esp),%eax
    1212                jmp     DosSelToFlat
  • trunk/src/emx/src/lib/sys/386/thunk1.s

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/ thunk1.asm (emx+gcc) -- Copyright (c) 1992-1994 by Eberhard Mattes
    22
    3                 .globl  __emx_thunk1
     3                .globl  __libc_thunk1
    44
    55/
    6 / unsigned long _emx_thunk1 (void *args, void *fun)
     6/ unsigned long _libc_thunk1 (void *args, void *fun)
    77/
    88/ Call 16-bit code
     
    2626                .set    RETADDR, -4*4           # Offset to spare space relative to FUN
    2727
    28 __emx_thunk1:   pushl   %ebp                    # Leave two dwords spare
     28__libc_thunk1:  pushl   %ebp                    # Leave two dwords spare
    2929                pushl   %ebp                    # space for 32-bit return address
    3030                pushl   %ebp                    # Set up stack frame
     
    3434                pushl   %ebx                    # Save %ebx
    3535                pushl   %es                     # (2) Save %es
    36 /               movw    %ss, %dx                # Prepare conversion of
    37 /               andb    $3, %dl                 # %esp to %ss:%sp
    38 /               orb     $4, %dl                 # LDT
    3936                movl    %esp, %eax              # Check stack
    4037                cmpw    $0x1000, %ax            # 1000H bytes left in this 64K
     
    10198                .byte   0x67,0x66,0xff,0x6e,RETADDR
    10299
    103 /               movl    %esp, %eax
    104 /               roll    $16, %eax
    105 /               shlw    $3, %ax
    106 /               orb     %dl, %al
    107 /               pushl   %eax                    # Push new %ss
    108 /               shrl    $16, %eax
    109 /               pushl   %eax                    # Push new %esp
    110 /               lss     (%esp), %esp            # Switch to new %ss:%sp
    111 /               jmpl    FAR PTR TEXT16:THUNK16_CALL ; (3)
    112 
    113100                .p2align 2
    114101Lthunk1_ret:    movzwl  %di, %esp               # (4) Remove arguments
  • trunk/src/emx/src/lib/sys/__chdir.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/chdir.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <os2emx.h>
    45#include <emx/syscalls.h>
  • trunk/src/emx/src/lib/sys/__chmod.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/chmod.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <string.h>
    45#include <errno.h>
  • trunk/src/emx/src/lib/sys/__chsize.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/chsize.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <os2emx.h>
    45#include <emx/syscalls.h>
  • trunk/src/emx/src/lib/sys/__close.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/close.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <os2emx.h>
    45#include <emx/syscalls.h>
  • trunk/src/emx/src/lib/sys/__dup.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/dup.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <os2emx.h>
    45#include <emx/syscalls.h>
  • trunk/src/emx/src/lib/sys/__dup2.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/dup2.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <os2emx.h>
    45#include <emx/syscalls.h>
  • trunk/src/emx/src/lib/sys/__endthread.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/endthrea.c (emx+gcc) -- Copyright (c) 1993-1996 by Eberhard Mattes */
    22
    3 #if defined (__MT__)
    4 
     3#include "libc-alias.h"
    54#define INCL_DOS
    65#include <os2emx.h>
     
    2221  return 0;
    2322}
    24 
    25 #endif
  • trunk/src/emx/src/lib/sys/__exit.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/exit.c (emx+gcc) -- Copyright (c) 1992-1993 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <os2emx.h>
    45
  • trunk/src/emx/src/lib/sys/__fcntl.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/fcntl.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <fcntl.h>
    45#include <errno.h>
  • trunk/src/emx/src/lib/sys/__fork.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
     1#include "libc-alias.h"
    12#include <stdlib.h>
    23#include <emx/syscalls.h>
  • trunk/src/emx/src/lib/sys/__fstat.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/fstat.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <os2emx.h>
    45#include <string.h>
  • trunk/src/emx/src/lib/sys/__ftime.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    11/* sys/ftime.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <os2emx.h>
    45#include <sys/timeb.h>
  • trunk/src/emx/src/lib/sys/__ftruncate.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/ftruncat.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <os2emx.h>
    45#include <emx/syscalls.h>
  • trunk/src/emx/src/lib/sys/__getcwd.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/getcwd.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <os2emx.h>
    45#include <emx/syscalls.h>
  • trunk/src/emx/src/lib/sys/__getdrive.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    11/* sys/getdrive.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <os2emx.h>
    45#include <emx/syscalls.h>
  • trunk/src/emx/src/lib/sys/__imphandle.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* imphandl.c (emx+gcc) -- Copyright (c) 1994-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <emx/syscalls.h>
    45
  • trunk/src/emx/src/lib/sys/__init.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    1 /* sys/init.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    2 
     1/*
     2    Application low-level initialization routine.
     3
     4    Copyright (c) 1992-1998 by Eberhard Mattes
     5    Copyright (c) 2003 InnoTek Systemberatung GmbH
     6
     7    This routine is called from crt0.o. It should parse
     8    argv and envp, initialize heap and do all other sorts
     9    of low-level initialization.
     10*/
     11
     12#include "libc-alias.h"
    313#define INCL_DOS
    414#include <os2emx.h>
     
    1020#include <alloca.h>
    1121
    12 #define SYS_PRIVATE_HEAP_SIZE 0x100000
    13 
    1422#define EXTERN
    1523#define INIT(x) = x
     
    2331static char *pool;
    2432
     33extern void __init_os_version (void);
     34extern void __init_dll ();
    2535extern void volatile __init_ret (void *stack);
    2636static void parse_args (const char *src);
     
    113123
    114124
    115 struct layout
    116 {
    117   ULONG text_base;
    118   ULONG text_end;
    119   ULONG data_base;
    120   ULONG data_end;
    121   ULONG bss_base;
    122   ULONG bss_end;
    123   ULONG heap_base;
    124   ULONG heap_end;
    125   ULONG heap_brk;
    126   ULONG heap_off;
    127   ULONG os2_dll;
    128   ULONG stack_base;
    129   ULONG stack_end;
    130   ULONG flags;
    131   ULONG reserved[2];
    132   UCHAR options[64];
    133 };
    134 
    135 
    136 void __init (struct layout *layout)
     125void __init (int is_dll)
    137126{
    138127  ULONG rc;
     
    142131  int n;
    143132  ULONG times;
    144   static char init_level;
    145 
    146   /* In a custom C runtime DLL, this function is called at least
    147      twice, once from the startup code of this DLL, once from the
    148      startup code of the application, and once from each DLL using
    149      this DLL.  init_level indicates which initializations have been
    150      performed.  Initially init_level is 0, meaning no initializations
    151      have been done.  init_level 1 indicates that initializations
    152      common to DLLs and applications have been performed.  init_level
    153      2 indicates that initializations specific to applications have
    154      been done as well as initializations of init_level 1. */
    155 
    156   if (init_level == 0)
    157     {
    158       init_level = 1;
    159 
    160       /* Initialize the heap.  Here, we only create the semaphore
    161          (while having only one thread).  The heap will be created by
    162          __sbrk(). */
    163 
    164 #if defined (__MT__)
    165       if (_fmutex_create (&_sys_heap_fmutex, 0) != 0)
    166         DosExit (EXIT_PROCESS, 255);
    167 #endif
    168 
    169       /* Get the process ID and parent process ID.  This is also
    170          required for (stand-alone) DLLs.  At least, we need ptib and
    171          ppib. */
    172 
    173       rc = DosGetInfoBlocks (&ptib, &ppib);
    174       if (rc != 0)
    175         DosExit (EXIT_PROCESS, 255);
    176       _sys_pid = ppib->pib_ulpid;
    177       _sys_ppid = ppib->pib_ulppid;
    178 
    179       /* Initialize threads.  This is also required for (stand-alone)
    180          DLLs as these may call _beginthread(). */
    181 #if defined (__MT__)
    182       rc = DosAllocMem (&_sys_private_heap, SYS_PRIVATE_HEAP_SIZE,
    183                         PAG_READ | PAG_WRITE);
    184       if (rc != 0)
    185         DosExit (EXIT_PROCESS, 255);
    186       rc = DosSubSetMem (_sys_private_heap,
    187                          DOSSUB_INIT | DOSSUB_SPARSE_OBJ | DOSSUB_SERIALIZE,
    188                          SYS_PRIVATE_HEAP_SIZE);
    189       if (rc != 0)
    190         DosExit (EXIT_PROCESS, 255);
    191       for (n = 0; n < MAX_THREADS; ++n)
    192         _sys_thread_table[n] = NULL;
    193       __newthread (ptib->tib_ptib2->tib2_ultid);
    194 #else
    195       _sys_init_thread (&_sys_thread_one);
    196 #endif
    197 
    198       /* Get current time for clock().  We do this also for
    199          (stand-alone) DLLs. */
    200 
    201       _sys_get_clock (&_sys_clock0_ms);
    202     }
    203 
    204   /* Stop here if called from the startup code of a DLL.  The
    205      remaining code is used only if this function has been called from
    206      the startup code of an application. */
    207 
    208   if (layout->flags & 1)
     133  static int initialized = 0;
     134
     135  if (initialized)
    209136    return;
    210 
    211   /* Avoid performing the following initializations more than once. */
    212 
    213   if (init_level == 2)
    214     return;
    215   init_level = 2;
     137  initialized = 1;
     138
     139  /* Do the initialization common for executables and DLLs. */
     140  __init_dll ();
    216141
    217142  /* Get ptib and ppib again, in case __init() has already been called
    218143     for a DLL. */
    219 
    220144  rc = DosGetInfoBlocks (&ptib, &ppib);
    221145  if (rc != 0)
     
    223147
    224148  /* Copy command line arguments and environment. */
    225 
    226149  vec = NULL; pool = NULL;
    227150  parse_env (ppib->pib_pchenv);
     
    240163
    241164  /* Initialize exception handling. */
    242 
    243165  _sys_xreg->prev_structure = (void *)0xffffffff;
    244166  _sys_xreg->ExceptionHandler = _sys_exception;
     
    250172
    251173  /* Return to the program. */
    252 
    253174  __init_ret (stack);
    254175}
     
    338259  _sys_deliver_pending_signals (tp);
    339260  switch (sig_info[signo].fun_action)
    340     {
     261  {
    341262    case ST_TERM:
    342263      _sys_terminate (signo);
     
    345266    case ST_IGNORE:
    346267      return XCPT_CONTINUE_EXECUTION;
    347     }
     268  }
    348269  return XCPT_CONTINUE_SEARCH;  /* Keep the optimizer happy */
    349270}
  • trunk/src/emx/src/lib/sys/__initthread.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/initthre.c (emx+gcc) -- Copyright (c) 1993-1996 by Eberhard Mattes */
    22
    3 #if defined (__MT__)
    4 
     3#include "libc-alias.h"
    54#include <errno.h>
    65#define INCL_DOS
     
    1615  return 0;
    1716}
    18 
    19 #endif
  • trunk/src/emx/src/lib/sys/__ioctl1.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/ioctl1.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <errno.h>
    45#include <os2emx.h>
  • trunk/src/emx/src/lib/sys/__ioctl2.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    11/* sys/ioctl2.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <sys/ioctl.h>
    45#include <errno.h>
  • trunk/src/emx/src/lib/sys/__lseek.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/lseek.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <os2emx.h>
    45#include <emx/syscalls.h>
  • trunk/src/emx/src/lib/sys/__mkdir.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* sys/mkdir.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <os2emx.h>
    45#include <emx/syscalls.h>
  • trunk/src/emx/src/lib/sys/__newthread.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/newthrea.c (emx+gcc) -- Copyright (c) 1993-1996 by Eberhard Mattes */
    22
    3 #if defined (__MT__)
    4 
     3#include "libc-alias.h"
    54#include <errno.h>
    65#define INCL_DOS
     
    3837  return __sys_newthread (tid, &errno);
    3938}
    40 
    41 #endif
  • trunk/src/emx/src/lib/sys/__nls_ctype.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/nls_ctyp.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#define INCL_DOSNLS
    45#include <os2emx.h>
  • trunk/src/emx/src/lib/sys/__nls_memupr.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/nls_memu.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#define INCL_DOSNLS
    45#include <os2emx.h>
  • trunk/src/emx/src/lib/sys/__open.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/open.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#define INCL_DOSERRORS
    45#include <os2emx.h>
  • trunk/src/emx/src/lib/sys/__os_version.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/os_ver.c (emx+gcc) -- Copyright (c) 1992-1995 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#define INCL_DOSMISC
    45#include <os2emx.h>
    56
    6 int __os_version (void)
     7unsigned char _osmajor;
     8unsigned char _osminor;
     9
     10void __init_os_version (void)
    711{
    8   LONG maj, min;
    9 
    10   maj = 0; min = 0;             /* In case DosQuerySysInfo fails... */
    11   DosQuerySysInfo (QSV_VERSION_MAJOR, QSV_VERSION_MAJOR, &maj, sizeof (maj));
    12   DosQuerySysInfo (QSV_VERSION_MINOR, QSV_VERSION_MINOR, &min, sizeof (min));
    13   return ((min & 0xff) << 8) | (maj & 0xff) | 0x6d650000;
     12  _osmajor = _osminor = 0;    /* In case DosQuerySysInfo fails... */
     13  DosQuerySysInfo (QSV_VERSION_MAJOR, QSV_VERSION_MAJOR, &_osmajor, sizeof (_osmajor));
     14  DosQuerySysInfo (QSV_VERSION_MINOR, QSV_VERSION_MINOR, &_osminor, sizeof (_osminor));
    1415}
  • trunk/src/emx/src/lib/sys/__pipe.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/pipe.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#define INCL_DOSQUEUES
    45#include <os2emx.h>
  • trunk/src/emx/src/lib/sys/__read.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/read.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <os2emx.h>
    45#include <emx/syscalls.h>
  • trunk/src/emx/src/lib/sys/__read_kbd.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/read_kbd.c (emx+gcc) -- Copyright (c) 1993-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#define INCL_DOSFILEMGR
    45#define INCL_KBD
  • trunk/src/emx/src/lib/sys/__rmdir.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* sys/rmdir.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <os2emx.h>
    45#include <emx/syscalls.h>
  • trunk/src/emx/src/lib/sys/__select.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
     1#include "libc-alias.h"
    12#include <stdlib.h>
    23#include <emx/syscalls.h>
  • trunk/src/emx/src/lib/sys/__settime.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
     1#include "libc-alias.h"
    12#include <time.h>
    23#include <sys/time.h>
  • trunk/src/emx/src/lib/sys/__spawnve.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* sys/spawnve.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <string.h>
  • trunk/src/emx/src/lib/sys/__stat.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/stat.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <os2emx.h>
    45#include <string.h>
  • trunk/src/emx/src/lib/sys/__swchar.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/swchar.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <emx/syscalls.h>
    45
  • trunk/src/emx/src/lib/sys/__ttyname.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
     1#include "libc-alias.h"
    12#include <stdlib.h>
    23#include <emx/syscalls.h>
  • trunk/src/emx/src/lib/sys/__ulimit.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/ulimit.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <sys/ulimit.h>
    45#include <errno.h>
  • trunk/src/emx/src/lib/sys/__utimes.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/utimes.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <os2emx.h>
    45#include <string.h>
  • trunk/src/emx/src/lib/sys/__wait.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/wait.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#define INCL_DOSPROCESS
    45#include <os2emx.h>
  • trunk/src/emx/src/lib/sys/__waitpid.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/waitpid.c (emx+gcc) -- Copyright (c) 1993-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#define INCL_DOSPROCESS
    45#include <os2emx.h>
  • trunk/src/emx/src/lib/sys/__write.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/write.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <os2emx.h>
    45#include <emx/syscalls.h>
  • trunk/src/emx/src/lib/sys/brk.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    1313  ULONG base;
    1414
    15 #ifdef __MT__
    1615  if (_fmutex_request (&_sys_heap_fmutex, _FMR_IGNINT) != 0)
    1716    return (void *)-1;
    18 #endif
    1917
    2018  if (_sys_heap_obj_count == 0)
     
    2927    base = _sys_shrink_heap_to ((ULONG)brkp);
    3028
    31 #ifdef __MT__
    3229  if (_fmutex_release (&_sys_heap_fmutex) != 0)
    3330    return (void *)-1;
    34 #endif
    3531
    3632  if (base == 0)
  • trunk/src/emx/src/lib/sys/core.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* core.c (emx+gcc) -- Copyright (c) 1990-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <stdlib.h>
    45#include <emx/syscalls.h>
  • trunk/src/emx/src/lib/sys/execname.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* sys/execname.c (emx+gcc) -- Copyright (c) 1993-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#define INCL_DOS
    45#include <os2emx.h>
  • trunk/src/emx/src/lib/sys/filefind.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/filefind.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <string.h>
    45#include <errno.h>
  • trunk/src/emx/src/lib/sys/filesys.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    11/* sys/filesys.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <string.h>
    45#include <errno.h>
  • trunk/src/emx/src/lib/sys/heap.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/heap.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#define INCL_DOSERRORS
    45#include <os2emx.h>
  • trunk/src/emx/src/lib/sys/heapdump.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/heapdump.c (emx+gcc) -- Copyright (c) 1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include "syscalls.h"
    45#include <stdio.h>
    5 
    66
    77void _sys_dump_heap_objs (FILE *f)
  • trunk/src/emx/src/lib/sys/p2t.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    11/* sys/p2t.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <os2emx.h>
    45#include <time.h>
  • trunk/src/emx/src/lib/sys/sbrk.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    1414  ULONG base;
    1515
    16 #ifdef __MT__
    1716  if (_fmutex_request (&_sys_heap_fmutex, _FMR_IGNINT) != 0)
    1817    return (void *)-1;
    19 #endif
    2018
    2119  if (incr >= 0)
     
    2422    base = _sys_shrink_heap_by (-incr, _sys_uflags & _UF_SBRK_MODEL);
    2523
    26 #ifdef __MT__
    2724  if (_fmutex_release (&_sys_heap_fmutex) != 0)
    2825    return (void *)-1;
    29 #endif
    3026
    3127  if (base == 0)
  • trunk/src/emx/src/lib/sys/scrsize.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* sys/scrsize.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#define INCL_VIO
    45#include <os2emx.h>
  • trunk/src/emx/src/lib/sys/seterrno.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    11/* sys/seterrno.c (emx+gcc) -- Copyright (c) 1992-1998 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <errno.h>
    45#include "syscalls.h"
  • trunk/src/emx/src/lib/sys/sleep2.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* sys/sleep2.c (emx+gcc) -- Copyright (c) 1993-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#define INCL_DOSPROCESS
    45#include <os2emx.h>
  • trunk/src/emx/src/lib/sys/syscalls.h

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    11/* sys/syscalls.h (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
    22
     3#include "libc-alias.h"
    34#include <sys/signal.h>
    45
     
    121122void _sys_deliver_pending_signals (thread_data *tp);
    122123
    123 #if defined (__MT__)
    124 
    125124#define MAX_THREADS 1024
    126125
     
    135134#define SYS_THREAD (_sys_thread ())
    136135
    137 #else /* !defined (_MT) */
    138 
    139 EXTERN thread_data _sys_thread_one;
    140 #define SYS_THREAD (&_sys_thread_one)
    141 
    142 #endif /* !defined (_MT) */
    143 
    144136#endif /* _OS2EMX_H */
    145137
  • trunk/src/emx/src/lib/sys/uflags.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    44#include "syscalls.h"
    55
    6 int _STD(uflags) (int mask, int new_flags)
     6int _uflags (int mask, int new_flags)
    77{
    88  int ret;
  • trunk/src/emx/src/lib/time/asctime.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    1313char *_STD(asctime) (const struct tm *t)
    1414{
    15 #if defined (__MT__)
    1615  struct _thread *tp = _thread();
    1716#define result (tp->_th_asctime_buf)
    18 #else
    19   static char result[26];
    20 #endif
    2117
    2218  memcpy (result+0, wdays+t->tm_wday*3, 3);
  • trunk/src/emx/src/lib/time/ftime.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r235 r236  
    1111  time_t t_loc;
    1212
    13   if (!_tzset_flag) _tzset ();
     13  if (!_tzset_flag) tzset ();
    1414  __ftime (ptr);
    1515  t_loc = ptr->time;
  • trunk/src/emx/src/lib/time/gettimeo.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r235 r236  
    1414  int dst;
    1515
    16   if (!_tzset_flag) _tzset ();
     16  if (!_tzset_flag) tzset ();
    1717  __ftime (&tb);
    1818  t_loc = tb.time;
  • trunk/src/emx/src/lib/time/gmtime.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    99struct tm *_STD(gmtime) (const time_t *t)
    1010{
    11 #if defined (__MT__)
    1211  struct _thread *tp = _thread ();
    13 #define result (tp->_th_gmtime_buf)
    14 #else
    15   static struct tm result;
    16 #endif
    17   return _gmtime (&result, t);
     12  return _gmtime (&tp->_th_gmtime_buf, t);
    1813}
    1914
  • trunk/src/emx/src/lib/time/localtim.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r235 r236  
    88struct tm *_STD(localtime) (const time_t *t)
    99{
    10 #if defined (__MT__)
    1110  struct _thread *tp = _thread ();
    12 #define result (tp->_th_gmtime_buf)
    13 #else
    14   static struct tm result;
    15 #endif
    16   return _localtime (&result, t);
     11  return _localtime (&tp->_th_gmtime_buf, t);
    1712}
    1813
     
    2318  struct tm *p;
    2419
    25   if (!_tzset_flag) _tzset ();
     20  if (!_tzset_flag) tzset ();
    2621  lt = *t;
    2722  isdst = _gmt2loc (&lt);
  • trunk/src/emx/src/lib/time/mktime.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r235 r236  
    1212  int dst;
    1313
    14   if (!_tzset_flag) _tzset ();
     14  if (!_tzset_flag) tzset ();
    1515
    1616  /* _mktime() requires that tm_mon is in range.  The other members
  • trunk/src/emx/src/lib/time/settimeo.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r235 r236  
    1818      return -1;
    1919    }
    20   if (!_tzset_flag) _tzset ();
     20  if (!_tzset_flag) tzset ();
    2121  t = tp->tv_sec;
    2222  local.tv_sec = _gmt2loc (&t);
  • trunk/src/emx/src/lib/time/strftime.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r235 r236  
    103103  int mbn, shift;
    104104
    105   if (!_tzset_flag) _tzset ();
     105  if (!_tzset_flag) tzset ();
    106106  shift = 0; n = 0;
    107107  while ((c = *format) != 0)
  • trunk/src/emx/src/libomflib/omflib0.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r235 r236  
    66#define TRUE  1
    77
     8#ifndef _BYTE_WORD_DWORD
     9#define _BYTE_WORD_DWORD
    810typedef unsigned char byte;
    911typedef unsigned short word;
    1012typedef unsigned long dword;
    11 
     13#endif /* _BYTE_WORD_DWORD */
    1214
    1315#define FLAG_DELETED  0x0001
  • trunk/src/emx/src/regexp/regexp.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    775775STATIC int regrepeat();
    776776
    777 #ifdef DEBUG
     777#ifdef REGEXP_DEBUG
    778778int regnarrate = 0;
    779779void regdump();
     
    892892
    893893        scan = prog;
    894 #ifdef DEBUG
     894#ifdef REGEXP_DEBUG
    895895        if (scan != NULL && regnarrate)
    896896                fprintf(stderr, "%s(\n", regprop(scan));
    897897#endif
    898898        while (scan != NULL) {
    899 #ifdef DEBUG
     899#ifdef REGEXP_DEBUG
    900900                if (regnarrate)
    901901                        fprintf(stderr, "%s...\n", regprop(scan));
     
    11511151}
    11521152
    1153 #ifdef DEBUG
     1153#ifdef REGEXP_DEBUG
    11541154
    11551155STATIC char *regprop();
  • trunk/src/emx/version.smak

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r235 r236  
    1414VERSION = $(VH).$(VM).$(VL)
    1515
     16# The flag for C compiler to pass the VERSION macro to preprocessor
     17CFLAGS.DEF.VERSION = -DVERSION=\\\"$(VERSION)\\\"
     18
    1619# Copyright
    1720COPYRIGHT = Copyright (c) 2003 InnoTek Systemberatung GmbH
Note: See TracChangeset for help on using the changeset viewer.