public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] problems with GCC-3.2.1 and new/delete operators.
@ 2003-03-31 17:34 marco
  2003-04-08  1:35 ` Jonathan Larmour
  0 siblings, 1 reply; 5+ messages in thread
From: marco @ 2003-03-31 17:34 UTC (permalink / raw)
  To: ecos-discuss

Hello. I am experiencing problems with new/delete/GCC-3.2.1 and would need 
some suggestions.

+Moving an eCos application that compiles/runs fine with 2.95.2, I had 
while linking (just reporting the error message):
(...cut...)
undefined reference to `operator new(unsigned)'
undefined reference to `operator delete(void*)'
undefined reference to `operator new(unsigned)'
undefined reference to `operator delete[](void*)'
undefined reference to `operator new[](unsigned)'
(...cut...)

+ I therefore grouped libsupc++.a to libtarget.a and added the Bart's 
patch to get the __impure_ptr fix in the INFRA package 
(prevously in the list was suggested to get the same effect using 
-Wl,--defsym -Wl,__cxa_pure_virtual=0). pure.cxx is included.
I can pass the undefined reference error but other things pop up.
Please, see below. Seems I lack some sections in the linker script that 
are required when using libsupc++. Is this correct? If yes, is 
there a reference script I could look at?

My toolchain is mipsisa32-elf-* (ecoscentric) and I am compiling the 
application code with these flags:
"-EL -mips2 -G0 -msoft-float -Wall -ffunction-sections -fdata-sections 
-fno-exceptions -fno-rtti -finit-priority -Wno-deprecated"

while linking with:
"-EL -msoft-float -nostartfiless -Wl,--gc-sections -fno-exceptions 
-fno-rtti -nostdlib"

Thanks in advance.
Marco

(...cut...)
make[1]: Entering directory `/ecos/work-new/ooicu/icu/src/ftp/server'
mipsisa32-elf-gcc -EL  -msoft-float -nostartfiles 
-L../../../../icu/lib/release -L/ecos/work-new//complete_scm40_install/lib 
-Wl,--gc-sections -fno-exceptions -fno-rtti -nostdlib -o release/ftp.exe 
release/ftpmain.o -lutils -lftp -lplatform -Ttarget.ld -nostdlib
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/bin/ld: 
warning: no memory region specified for section 
`.gnu.linkonce.s._ZTISt9exception'
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/bin/ld: 
warning: no memory region specified for section 
`.gnu.linkonce.s._ZTISt9type_info'
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/bin/ld: 
address 0x10 of release/ftp.exe section .data1 is not within region ram
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/bin/ld: 
address 0x10 of release/ftp.exe section .eh_frame is not within region ram
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/bin/ld: 
address 0x10 of release/ftp.exe section .gcc_except_table is not within 
region ram
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/bin/ld: 
address 0x68 of release/ftp.exe section .ctors is not within region ram
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/bin/ld: 
address 0xa8 of release/ftp.exe section .dtors is not within region ram
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/bin/ld: 
address 0x3b8 of release/ftp.exe section .devtab is not within region ram
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/bin/ld: 
address 0x3b8 of release/ftp.exe section .got is not within region ram
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/bin/ld: 
address 0x3b8 of release/ftp.exe section .dynamic is not within region ram
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/bin/ld: 
address 0x3c0 of release/ftp.exe section .sdata is not within region ram
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/bin/ld: 
address 0x3c0 of release/ftp.exe section .lit8 is not within region ram
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/bin/ld: 
warning: no memory region specified for section 
`.gnu.linkonce.s._ZTISt9exception'
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/bin/ld: 
warning: no memory region specified for section 
`.gnu.linkonce.s._ZTISt9type_info'
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/bin/ld: 
address 0x10 of release/ftp.exe section .data1 is not within region ram
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/bin/ld: 
address 0x10 of release/ftp.exe section .eh_frame is not within region ram
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/bin/ld: 
address 0x10 of release/ftp.exe section .gcc_except_table is not within 
region ram
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/bin/ld: 
address 0x68 of release/ftp.exe section .ctors is not within region ram
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/bin/ld: 
address 0xa8 of release/ftp.exe section .dtors is not within region ram
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/bin/ld: 
address 0x3b8 of release/ftp.exe section .devtab is not within region ram
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/bin/ld: 
address 0x3b8 of release/ftp.exe section .got is not within region ram
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/bin/ld: 
address 0x3b8 of release/ftp.exe section .dynamic is not within region ram
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/bin/ld: 
address 0x3c0 of release/ftp.exe section .sdata is not within region ram
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/bin/ld: 
address 0x3c0 of release/ftp.exe section .lit8 is not within region ram
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/lib/soft-float/el/libsupc++.a(new_handler.o): 
In function `std::set_new_handler(void (*)())':
new_handler.o(.text+0x0): relocation truncated to fit: R_MIPS_GPREL16 
__new_handler
new_handler.o(.text+0x4): relocation truncated to fit: R_MIPS_GPREL16 
__new_handler
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/lib/soft-float/el/libsupc++.a(new_op.o): 
In function `operator new(unsigned)':
new_op.o(.text+0x3c): relocation truncated to fit: R_MIPS_GPREL16 
__new_handler
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/lib/soft-float/el/libsupc++.a(eh_alloc.o): 
In function `__cxa_allocate_exception':
eh_alloc.o(.text+0x4c): relocation truncated to fit: R_MIPS_GPREL16 no 
symbol
eh_alloc.o(.text+0xa0): relocation truncated to fit: R_MIPS_GPREL16 no 
symbol
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/lib/soft-float/el/libsupc++.a(eh_alloc.o): 
In function `__cxa_free_exception':
eh_alloc.o(.text+0xf8): relocation truncated to fit: R_MIPS_GPREL16 no 
symbol
eh_alloc.o(.text+0x100): relocation truncated to fit: R_MIPS_GPREL16 no 
symbol
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/lib/soft-float/el/libsupc++.a(eh_globals.o): 
In function `__cxa_get_globals_fast':
eh_globals.o(.text+0x0): relocation truncated to fit: R_MIPS_GPREL16 no 
symbol
/tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/lib/soft-float/el/libsupc++.a(eh_globals.o): 
In function `__cxa_get_globals':
eh_globals.o(.text+0xc): relocation truncated to fit: R_MIPS_GPREL16 no 
symbol
collect2: ld returned 1 exit status
make[1]: *** [release/ftp.exe] Error 1

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] problems with GCC-3.2.1 and new/delete operators.
  2003-03-31 17:34 [ECOS] problems with GCC-3.2.1 and new/delete operators marco
@ 2003-04-08  1:35 ` Jonathan Larmour
  2003-04-09 10:37   ` marco
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Larmour @ 2003-04-08  1:35 UTC (permalink / raw)
  To: marco; +Cc: ecos-discuss

marco@sitek.it wrote:
> Hello. I am experiencing problems with new/delete/GCC-3.2.1 and would need 
> some suggestions.
> [snip]
> (...cut...)
> make[1]: Entering directory `/ecos/work-new/ooicu/icu/src/ftp/server'
> mipsisa32-elf-gcc -EL  -msoft-float -nostartfiles 
> -L../../../../icu/lib/release -L/ecos/work-new//complete_scm40_install/lib 
> -Wl,--gc-sections -fno-exceptions -fno-rtti -nostdlib -o release/ftp.exe 
> release/ftpmain.o -lutils -lftp -lplatform -Ttarget.ld -nostdlib
> /tools/mipsisa32-elf/bin/../lib/gcc-lib/mipsisa32-elf/3.2.1/../../../../mipsisa32-elf/bin/ld: 
> warning: no memory region specified for section 
> `.gnu.linkonce.s._ZTISt9exception'
[snip lots more]

Looks like the memory layout files (particularly the .ldi file) for your 
platform doesn't contain all the sections it should. Compare against 
another one that's already working like the atlas HAL.

Jifl
-- 
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
--[ "You can complain because roses have thorns, or you ]--
--[  can rejoice because thorns have roses." -Lincoln   ]-- Opinions==mine


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] problems with GCC-3.2.1 and new/delete operators.
  2003-04-08  1:35 ` Jonathan Larmour
@ 2003-04-09 10:37   ` marco
  2003-04-09 18:27     ` Jonathan Larmour
  0 siblings, 1 reply; 5+ messages in thread
From: marco @ 2003-04-09 10:37 UTC (permalink / raw)
  To: Jonathan Larmour; +Cc: ecos-discuss

> Looks like the memory layout files (particularly the .ldi file) for your 

> platform doesn't contain all the sections it should. Compare against 
> another one that's already working like the atlas HAL.

Thanks for the reply.
I've checked against the MALTA memory layout file (ram) we use with the 
application. mlt_..._ram.h and mlt_..._ram.ldi are the same except for 
memory size. About the linker script. I checked it against the MIPS32 
target and added 

#if (__GNUC__ >= 3)
GROUP(libtarget.a libgcc.a libsupc++.a)
#else
GROUP(libtarget.a libgcc.a)
#endif 


Test case below. You link this fine?


#include <stdio.h>
int main()
{
   unsigned int index=5, *point;

   unsigned int  *point_time = new unsigned int[12];

   point = new unsigned int;
   *point = index;

   printf("*Point= %d \n",*point);
   delete point;

   for ( int i=0;i<12;i++) {
    point_time[i]=i+1;
   }

   for ( int i=0;i<12;i++) {
    printf("Hour %d \n", point_time[i]);
   }

   delete [] point_time;
}


Best regards,
Marco

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] problems with GCC-3.2.1 and new/delete operators.
  2003-04-09 10:37   ` marco
@ 2003-04-09 18:27     ` Jonathan Larmour
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Larmour @ 2003-04-09 18:27 UTC (permalink / raw)
  To: marco; +Cc: ecos-discuss

marco@sitek.it wrote:
>>Looks like the memory layout files (particularly the .ldi file) for your 
> 
> 
>>platform doesn't contain all the sections it should. Compare against 
>>another one that's already working like the atlas HAL.
> [snip]
> Test case below. You link this fine?

Ahhhh. I see there is a problem now, but it was "just" a type I hadn't 
seen before. You need to edit mips_mips32.ld and change:

#define SECTION_sdata(_region_, _vma_, _lma_)                 \
   .sdata _vma_ : _lma_                                        \
     {                                                         \
       FORCE_OUTPUT; *(.sdata) *(.sdata.*) *(.gnulinkonce.s*)  \
     } > _region_

to

#define SECTION_sdata(_region_, _vma_, _lma_)                 \
   .sdata _vma_ : _lma_                                        \
     {                                                         \
       FORCE_OUTPUT; *(.sdata) *(.sdata.*) *(.gnu.linkonce.s*) \
     } > _region_

I'll patch the master sources.

Jifl
-- 
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
--[ "You can complain because roses have thorns, or you ]--
--[  can rejoice because thorns have roses." -Lincoln   ]-- Opinions==mine


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] problems with GCC-3.2.1 and new/delete operators.
       [not found] <OF0280E8FE.326F3FB0-ONC1256D03.00394221-C1256D03.003A570F@LocalDomain>
@ 2003-04-09 10:43 ` marco
  0 siblings, 0 replies; 5+ messages in thread
From: marco @ 2003-04-09 10:43 UTC (permalink / raw)
  To: Jonathan Larmour; +Cc: ecos-discuss

> Thanks for the reply.
> I've checked against the MALTA memory layout file (ram) we use with the 

sorry. I meant ATLAS.
Regards
Marco

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-04-09 18:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-31 17:34 [ECOS] problems with GCC-3.2.1 and new/delete operators marco
2003-04-08  1:35 ` Jonathan Larmour
2003-04-09 10:37   ` marco
2003-04-09 18:27     ` Jonathan Larmour
     [not found] <OF0280E8FE.326F3FB0-ONC1256D03.00394221-C1256D03.003A570F@LocalDomain>
2003-04-09 10:43 ` marco

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).