delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/10/26/09:24:02

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
X-Authentication-Warning: gwa2.fe.bosch.de: uucp set sender to <Uwe DOT Junkes AT de DOT bosch DOT com> using -f
Message-ID: <01CDE14BF507D2119A0C00805FBBB7130F0321@ermail3.er.bosch.de>
From: "Junkes Uwe (AT/ESA2)" <Uwe DOT Junkes AT de DOT bosch DOT com>
To: "'cygwin AT sourceware DOT cygnus DOT com'" <cygwin AT sourceware DOT cygnus DOT com>
Cc: "Egner Armin (AT/ESA2) *" <Armin DOT Egner AT de DOT bosch DOT com>
Subject: Problems with relocatable links fom C++ - modules
Date: Thu, 26 Oct 2000 15:21:44 +0200
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2651.58)
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id JAA22306

Hello,

I use the Cygwin V1.0 on WIN/NT-4.0 and have a problem by generating 
relocatable links for C++ - modules ( virtual functions).
I send you a short example and hope somebody can solve my problem. 

 
//
// Module test1.cc
//
#include "test1.hh"

int CCTest1::init(int name)
{
  return 0;
}

void main()
{
};
**************************************
**************************************
//
//Module test1.hh
//
class CCTest1
{
public:
virtual int init (int name);
};
**************************************
**************************************
//
// Module test2.cc
//
#include "test1.hh"
#include "test2.hh"

CCTest2 bsp2;

int CCTest2::init(int name)
{
  return 0;
}

void TES_Test2Init(int phase)
{
  bsp2.init(1);
}
**************************************
**************************************
//
// Module test2.hh
//
class CCTest2 : public CCTest1
{
public:
int init (int name);
};

First I compile the source files :
gcc -c -o test1.o test1.cc
gcc -c -o test2.o test2.cc

Then I generate two relocatable objects:
ld -r -o test1_fun.o test1.o
ld -r -o test2_fun.o test2.o

Then I generate the file Test:

ld -o Test /usr/i686-cygwin/lib/crt0.o
-L/usr/lib/gcc-lib/i686-cygwin/2.9-cygwin-990830 test1_fun.o test2_fun.o
-lgcc -lcygwin -lkernel32

Result :
We have no linker-errors and the file Test will be generated.
But the addresses of the functions from test2_fun.o are not correct.
 
Here a part of the symbol-file from Test ( nm Test ):

00404e60 T _cygwin_crt0
00404ee0 T ___main
00000020 C _TES_Test2Init__Fi
         U __GLOBAL_$I$bsp2
00000000 A _bsp2



Mit freundlichen Grüßen / best regards

   Uwe Junkes

   Uwe Junkes, 
   Robert Bosch GmbH, 
   Berlinerstrasse 25
   D  64711 Erbach/Odw.
   Abt./Dep. AT/ESA
   Tel. +49 (0)6062-78 686, fax. +49 (0)6062-78 771
   eMail: Uwe DOT Junkes AT de DOT bosch DOT com



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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