www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/11/25/13:59:26

Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3C013F37.F451C083@phekda.freeserve.co.uk>
Date: Sun, 25 Nov 2001 18:57:59 +0000
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: Building a profiled version of libc
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1011119103715 DOT 8761F-100000 AT is> <3BF97E29 DOT 39FC7C7E AT phekda DOT freeserve DOT co DOT uk> <3405-Tue20Nov2001082315+0200-eliz AT is DOT elta DOT co DOT il> <3C00F797 DOT 88E8AA45 AT phekda DOT freeserve DOT co DOT uk> <7263-Sun25Nov2001182924+0200-eliz AT is DOT elta DOT co DOT il>
Reply-To: djgpp-workers AT delorie DOT com

Hello.

Eli Zaretskii wrote:
> Yes, probably.  Could you also modify the makefile's so that emu387
> is built without -pg?

I've modified the makefile to build the sources without any profiling
options. This wasn't actually the cause of the failure I mentioned. This
is in the link stage:

bash-2.04$ pwd
c:/develop/djgpp.rw/src/libemu
bash-2.04$ make
../makemake.exe
makemake: scanning libemu for makefiles
c:/djgpp/bin/make.exe -f makefile.sub
c:/djgpp/bin/make.exe -C src
../makemake.exe -2
makemake: scanning libemu for object files
c:/djgpp/bin/make.exe ./../../lib/libemu.a
make.exe[1]: `../../lib/libemu.a' is up to date.
./../../hostbin/dxegen.exe ./../../bin/emu387.dxe __emu_entry src/emu387.o
id_em
u.o src/emudummy.o -L../../lib c:/djgpp/lib/gcc-lib/djgpp/3.02/libgcc.a
-lc c:/d
jgpp/lib/gcc-lib/djgpp/3.02/libgcc.a
ld -X -S -r -o dxe__tmp.o -L./../../lib src/emu387.o id_emu.o
src/emudummy.o -L.
./../lib c:/djgpp/lib/gcc-lib/djgpp/3.02/libgcc.a -lc
c:/djgpp/lib/gcc-lib/djgpp
/3.02/libgcc.a  -T dxe.ld
./../../lib/libc.a(_write.o)(.text+0x0):_write.c: multiple definition of
`_write
'
src/emudummy.o(.text+0x10):emudummy.c: first defined here
make.exe: *** [../../bin/emu387.dxe] Error 1

I thought it might be a function definition mistmatch that was causing
this error, so I made the changes shown in the diff at the end of the
mail. This didn't fix it.

I thought linking took the first object file resolving for a
variable/function name and did not care about subsequent objects
containing it.
 
Do you have any suggestions on how to fix this? Are there any options I
can pass to ld from dxegen that would help? I had a look through the ld
options in info, but nothing stood out.

The proper solution, I guess, is to build two versions of libc - one with
and one without profiling - and to link against the non-profiling version
when building DXEs.

> > OK to commit?
> 
> Fine with me, but please add a note about this in wc204.txi.

Will do.

I also checked in a fix for a mismatch between the real prototype of
_write() in io.h and the one documented in _write.txh.

Thanks, bye, Rich =]

-- 
Richard Dawe
http://www.phekda.freeserve.co.uk/richdawe/

RCS file: /cvs/djgpp/djgpp/src/libemu/src/emudummy.c,v
retrieving revision 1.1
diff -p -c -3 -r1.1 emudummy.c
*** src/libemu/src/emudummy.c   1997/11/02 19:54:30     1.1
--- src/libemu/src/emudummy.c   2001/11/25 18:47:29
***************
*** 1,14 ****
  /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  /* Dummy routines to enable building of emu387.dxe from libemu.a - since
we
     can't do I/O, dummy the I/O routines out.  */

! void vsprintf(void);
! void _write(void);

! void vsprintf(void) {}
! void _write(void) {}

  int __djgpp_exception_state_ptr;

--- 1,27 ----
+ /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  /* Dummy routines to enable building of emu387.dxe from libemu.a - since
we
     can't do I/O, dummy the I/O routines out.  */
+
+ #include <stdio.h>
+ #include <stdarg.h>
+ #include <io.h>
+ #include <errno.h>

! int
! vsprintf (char *buf, const char *fmt, va_list args)
! {
!   return 0;
! }

! ssize_t
! _write (int fd, const void *buf, size_t nbyte)
! {
!   errno = EACCES;
!   return -1;
! }

  int __djgpp_exception_state_ptr;

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019