From: sandmann AT clio DOT rice DOT edu (Charles Sandmann) Message-Id: <10212070634.AA13865@clio.rice.edu> Subject: dxeload proposed patches To: djgpp-workers AT delorie DOT com (DJGPP developers) Date: Sat, 7 Dec 2002 00:34:10 -0600 (CST) X-Mailer: ELM [version 2.5 PL2] Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Proposed patches for dxeload and documentation below. DXEGEN and DXE2OBJ are still being tweaked, but dxeload hasn't changed substantially on my system in a long time. *** dxeload.c_ Fri Apr 26 12:52:54 1996 --- dxeload.c Sat Nov 30 00:30:02 2002 *************** *** 1,3 **** ! /* Copyright (C) 1995 Charles Sandmann (sandmann AT clio DOT rice DOT edu) This software may be freely distributed with above copyright, no warranty. Based on code by DJ Delorie, it's really his, enhanced, bugs fixed. */ --- 1,3 ---- ! /* Copyright (C) 1995,2002 Charles Sandmann (sandmann AT clio DOT rice DOT edu) This software may be freely distributed with above copyright, no warranty. Based on code by DJ Delorie, it's really his, enhanced, bugs fixed. */ *************** *** 8,11 **** --- 8,14 ---- #include + char *_dxe_data; + long *_dxe_fixup; + void *_dxe_load(char *name) { *************** void *_dxe_load(char *name) *** 39,43 **** int i; _read(h, relocs, sizeof(long)*dh.nrelocs); - _close(h); for (i=0; i + + char *_dxe_data; + @end example + + @subheading Description + + This data pointer stores the memory allocated by @code{_dxe_load} @pxref{_dxe_load} + when loading the dynamic executable image. If desired, this value can be + stored after the image is loaded and passed to @code{free} when the image is + no longer needed in memory. + + @subheading Portability + + @portability !ansi, !posix + + @subheading Example + + @example + char *dxe_base; + + add = _dxe_load("add.dxe"); + dxe_base = _dxe_data; + ... + free(dxe_base); + @end example + + @c ---------------------------------------------------------------------- + + @node _dxe_fixup, misc + @subheading Syntax + + @example + #include + + long *_dxe_fixup; + @end example + + @subheading Description + + This data pointer should be set to a list of offsets needed to fix up + symbol locations in a dynamic executable image which reference the main + image. The symbols and their order are defined by the DXE at the time + it is built. After setting the data pointer, call @code{_dxe_load} which + will perform the fix ups. + + Note: @code{_dxe_load} will clear the pointer @code{_dxe_fixup} after it + is used, so you must set it before each call. + + @subheading Portability + + @portability !ansi, !posix + + @subheading Example + + @example + static long dxefixup[] = @{ (long)&malloc, (long)&printf @}; + + _dxe_fixup = dxefixup; + add = _dxe_load("add.dxe"); + @end example +