I'm using g++ for Hitachi sh and h8 but....

Michael Svetlik m.svetlik@ssi-schaefer-peem.com
Tue Dec 10 02:50:00 GMT 2002


Fabio,

you explicitly tell ld, to link libraries into the output file: 
-L$(SYSLIBDIR) -L$(LIBGCCDIR) -lstdc++ -lc -lgcc
In the map file, you can see their extension .a, so, those files are 
static libs - the linker just does, what it's told to.
In the ld docs at 
http://www.gnu.org/manual/ld-2.9.1/html_chapter/ld_2.html, you will find 
a '--no-whole-archive' option - I'm not sure it will work, but for me it 
seems so.
BTW: I've programmed those HITACHI H8 crutches for about five years - 
you are sure you need to hack them in C++ ? We discarded this choice, 
because of the amount of required resources ...

HTH
Michael

Fabio Giovagnini wrote:

>The following is a part of my map file:
>
>....
>....
>
> .text          0x0000afa0      0xfe0 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libstdc++.a(tinfo.o)
>                0x0000b170                
>__ZN10__cxxabiv117__class_type_infoD2Ev
>                0x0000b310                
>__ZNK10__cxxabiv117__class_type_info11__do_upcastEPKS0_PPv
>                0x0000afc0                __ZNSt9type_infoD1Ev
>                0x0000b120                __ZNKSt9type_info14__is_pointer_pEv
>                0x0000be30                __ZTVSt10bad_typeid
>                0x0000b200                
>__ZN10__cxxabiv120__si_class_type_infoD1Ev
>                0x0000b130                __ZNKSt9type_info15__is_function_pEv
>                0x0000ba60                
>__ZNK10__cxxabiv120__si_class_type_info11__do_upcastEPKNS_17__class_type_infoEPKvRNS1_15__upcast_resultE
>                0x0000b3f0                
>__ZNK10__cxxabiv121__vmi_class_type_info20__do_find_public_srcElPKvPKNS_17__class_type_infoES2_
>                0x0000b0b0                __ZNSt10bad_typeidD0Ev
>                0x0000b070                __ZNSt10bad_typeidD2Ev
>                0x0000be58                __ZTVSt9type_info
>                0x0000b220                
>__ZN10__cxxabiv120__si_class_type_infoD0Ev
>                0x0000b090                __ZNSt10bad_typeidD1Ev
>                0x0000ba20                
>__ZNK10__cxxabiv117__class_type_info11__do_upcastEPKS0_PKvRNS0_15__upcast_resultE
>                0x0000b190                
>__ZN10__cxxabiv117__class_type_infoD1Ev
>                0x0000b140                
>__ZNKSt9type_info10__do_catchEPKS_PPvj
>                0x0000bdac                
>__ZTVN10__cxxabiv121__vmi_class_type_infoE
>                0x0000bca0                ___dynamic_cast
>                0x0000b040                __ZNSt8bad_castD0Ev
>                0x0000b2c0                
>__ZNK10__cxxabiv117__class_type_info10__do_catchEPKSt9type_infoPPvj
>                0x0000b250                
>__ZN10__cxxabiv121__vmi_class_type_infoD2Ev
>                0x0000b380                
>__ZNK10__cxxabiv120__si_class_type_info20__do_find_public_srcElPKvPKNS_17__class_type_infoES2_
>                0x0000b270                
>__ZN10__cxxabiv121__vmi_class_type_infoD1Ev
>                0x0000b0e0                __ZNKSt9type_infoeqERKS_
>                0x0000b540                
>__ZNK10__cxxabiv120__si_class_type_info12__do_dyncastElNS_17__class_type_info10__sub_kindEPKS1_PKvS4_S6_RNS1_16__dyncast_resultE
>                0x0000be44                __ZTVSt8bad_cast
>                0x0000b1b0                
>__ZN10__cxxabiv117__class_type_infoD0Ev
>                0x0000b290                
>__ZN10__cxxabiv121__vmi_class_type_infoD0Ev
>                0x0000b1e0                
>__ZN10__cxxabiv120__si_class_type_infoD2Ev
>                0x0000b160                
>__ZNKSt9type_info11__do_upcastEPKN10__cxxabiv117__class_type_infoEPPv
>                0x0000b600                
>__ZNK10__cxxabiv121__vmi_class_type_info12__do_dyncastElNS_17__class_type_info10__sub_kindEPKS1_PKvS4_S6_RNS1_16__dyncast_resultE
>                0x0000b020                __ZNSt8bad_castD1Ev
>                0x0000afe0                __ZNSt9type_infoD0Ev
>                0x0000be04                
>__ZTVN10__cxxabiv117__class_type_infoE
>                0x0000b4d0                
>__ZNK10__cxxabiv117__class_type_info12__do_dyncastElNS0_10__sub_kindEPKS0_PKvS3_S5_RNS0_16__dyncast_resultE
>                0x0000bdd8                
>__ZTVN10__cxxabiv120__si_class_type_infoE
>                0x0000bab0                
>__ZNK10__cxxabiv121__vmi_class_type_info11__do_upcastEPKNS_17__class_type_infoEPKvRNS1_15__upcast_resultE
>                0x0000b360                
>__ZNK10__cxxabiv117__class_type_info20__do_find_public_srcElPKvPKS0_S2_
>                0x0000afa0                __ZNSt9type_infoD2Ev
>                0x0000b000                __ZNSt8bad_castD2Ev
> .text          0x0000bf80      0x170 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libstdc++.a(eh_aux_runtime.o)
>                0x0000bf80                ___cxa_bad_cast
>                0x0000c010                ___cxa_bad_typeid
> .text          0x0000c0f0       0xa0 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(sprintf.o)
>                0x0000c140                _sprintf
>                0x0000c0f0                __sprintf_r
> .text          0x0000c190       0xa0 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(strncpy.o)
>                0x0000c190                _strncpy
> .text          0x0000c230       0xa0 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(memcpy.o)
>                0x0000c230                _memcpy
> .text          0x0000c2d0       0xd0 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(strncmp.o)
>                0x0000c2d0                _strncmp
> .text          0x0000c3a0       0x70 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(strlen.o)
>                0x0000c3a0                _strlen
> .text          0x0000c410       0x40 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(strcpy.o)
>                0x0000c410                _strcpy
> .text          0x0000c450       0x40 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(malloc.o)
>                0x0000c470                _free
>                0x0000c450                _malloc
> .text          0x0000c490       0x10 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(syswrite.o)
>                0x0000c490                _write
> .text          0x0000c4a0       0x20 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(abort.o)
>                0x0000c4a0                _abort
> .text          0x0000c4c0       0x40 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(memset.o)
>                0x0000c4c0                _memset
> .text          0x0000c500       0x40 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(strcmp.o)
>                0x0000c500                _strcmp
> .text          0x0000c540     0x17f0 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(vfprintf.o)
>                0x0000c6f0                __vfprintf_r
>                0x0000c600                _vfprintf
> .text          0x0000dd30       0x10 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(impure.o)
> .text          0x0000dd40      0x620 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(mallocr.o)
>                0x0000dec0                __malloc_r
> .text          0x0000e360      0x330 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(freer.o)
>                0x0000e5b0                __malloc_trim_r
>                0x0000e360                __free_r
> .text          0x0000e690      0x3b0 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(syscalls.o)
>                0x0000e810                __exit
>                0x0000e850                __getpid
>                0x0000e8d0                __utime
>                0x0000e6d0                __write
>                0x0000e690                __read
>                0x0000e7f0                __unlink
>                0x0000e7b0                __open
>                0x0000e870                __stat
>                0x0000e800                _isatty
>                0x0000e900                __wait
>                0x0000e830                __kill
>                0x0000e890                __chmod
>                0x0000e930                __execv
>                0x0000e910                __execve
>                0x0000e990                ___setup_argv_and_call_main
>                0x0000e970                __gettimeofday
>                0x0000e710                __link
>                0x0000e860                __raise
>                0x0000e7d0                __creat
>                0x0000e950                __pipe
>                0x0000e8b0                __chown
>                0x0000e6b0                __lseek
>                0x0000e6f0                __close
>                0x0000e960                __times
>                0x0000e7a0                __fstat
>                0x0000e8f0                __fork
>                0x0000e740                __sbrk
> .text          0x0000ea40      0x280 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(signal.o)
>                0x0000eb00                __raise_r
>                0x0000eca0                ___sigtramp
>                0x0000ec40                _raise
>                0x0000ec80                __init_signal
>                0x0000eba0                ___sigtramp_r
>                0x0000ec60                _signal
>                0x0000ea90                __signal_r
>                0x0000ea40                __init_signal_r
> .text          0x0000ecc0      0x2e0 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(fvwrite.o)
>                0x0000ecc0                ___sfvwrite
> .text          0x0000efa0       0xf0 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(fflush.o)
>                0x0000efa0                _fflush
> .text          0x0000f090      0x200 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(findfp.o)
>                0x0000f130                _(short, float,  *)
>                0x0000f220                ___sinit
>                0x0000f200                __cleanup
>                0x0000f1e0                __cleanup_r
>                0x0000f0e0                ___sfmoreglue
> .text          0x0000f290       0xe0 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(locale.o)
>                0x0000f330                _setlocale
>                0x0000f2d0                __setlocale_r
>                0x0000f350                _localeconv
>                0x0000f320                __localeconv_r
> .text          0x0000f370       0x40 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(mbtowc_r.o)
>                0x0000f370                __mbtowc_r
> .text          0x0000f3b0       0x30 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(s_isinf.o)
>                0x0000f3b0                _isinf
> .text          0x0000f3e0       0x30 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(s_isnan.o)
>                0x0000f3e0                _isnan
> .text          0x0000f410       0xc0 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(memchr.o)
>                0x0000f410                _memchr
> .text          0x0000f4d0      0x100 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(wsetup.o)
>                0x0000f4d0                ___swsetup
> .text          0x0000f5d0     0x1310 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(dtoa.o)
>                0x0000f780                __dtoa_r
> .text          0x000108e0       0x40 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(sbrkr.o)
>                0x000108e0                __sbrk_r
> .text          0x00010920       0x20 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(mlock.o)
>                0x00010920                ___malloc_lock
>                0x00010930                ___malloc_unlock
> .text          0x00010940       0x20 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(trap.o)
>                0x00010940                ___trap34
> .text          0x00010960       0x50 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(signalr.o)
>                0x000109a0                __getpid_r
>                0x00010960                __kill_r
> .text          0x000109b0       0xb0 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(memmove.o)
>                0x000109b0                _memmove
> .text          0x00010a60       0x60 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(fwalk.o)
>                0x00010a60                __fwalk
> .text          0x00010ac0      0x150 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(stdio.o)
>                0x00010b10                ___swrite
>                0x00010bf0                ___sclose
>                0x00010ac0                ___sread
>                0x00010b90                ___sseek
> .text          0x00010c10      0x120 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(makebuf.o)
>                0x00010c10                ___smakebuf
> .text          0x00010d30      0xcd0 
>/usr/local/gcc-3.0.3/sh-hms/lib/m2/libc.a(mprec.o)
>                0x000113e0                ___mcmp
>                0x00011800                __ratio
>                0x00011080                __i2b
>                0x000115c0                __b2d
>                0x00010e90                __s2b
>                0x00010f30                __hi0bits
>                0x00011220                __pow5mult
>                0x00011430                ___mdiff
>                0x00011300                __lshift
>                0x000110a0                __multiply
>                0x000116e0                __d2b
>                0x00010d30                __Balloc
>                0x00011974                ___mprec_tinytens
>                0x000119a0                __mprec_log10
>                0x0001194c                ___mprec_bigtens
>                0x00011530                __ulp
>                0x00010dc0                __Bfree
>                0x00011884                ___mprec_tens
>                0x00010fc0                __lo0bits
>                0x00010de0                __multadd
>....
>....
>
>are the syscalls a necessary requirement for stdc++ library?
>
>thanks.
>
>This is my final linker command
>ld_step : _arnmain_
>	$(LD) $(LFLAGS) -o $(OUTFILE) \
>	$(BASE_ARNSYS_DIR)/$(ARNSYS_DIR)/arch/arch.o \
>	$(BASE_ARNSYS_DIR)/$(ARNSYS_DIR)/system/system.o \
>	./arnMain/main.o \
>	-L$(SYSLIBDIR) -L$(LIBGCCDIR) -lstdc++ -lc -lgcc
>and my partial linker commands are:
>1) $(LD) -r -S -o arch.o  $(FILE_TO_LINK)
>2) $(LD) -r -S -o system.o  $(FILE_TO_LINK)
>
>
>
>Alle 10:27, martedì 10 dicembre 2002, Michael Svetlik ha scritto:
>
>>Are you sure, those linker tags _are_ syscalls? I assume, they are
>>compiler built-in's, so give him a -fno-builtin.
>>More informations about gcc and friends are here :
>>http://www.gnu.org/software/gcc/onlinedocs/
>>
>>MS (not M$)
>>
>>Fabio Giovagnini wrote:
>>
>>>Hi everybody,
>>>as in the object, I'm using g++ for sh and h8 that are the uP we use for
>>>our boards. Because of we work in a very strict real time enviroment we
>>>can't use a general purpose os, so I wrote a simpel c++ application
>>>framework to improve the speed of my development. Every thing works fine,
>>>but if I analyze the map file, I can see all the posix system calls
>>>linked in, even if I don't implement the posix sys calls and I don't use
>>>them.
>>>Is there a linker or compiler option to turn off a set of standard c
>>>functions?
>>>
>>>Thanks.
>>>
>>>------
>>>Want more information?  See the CrossGCC FAQ,
>>>http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to
>>>crossgcc-unsubscribe@sources.redhat.com
>>>
>>------
>>Want more information?  See the CrossGCC FAQ,
>>http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to
>>crossgcc-unsubscribe@sources.redhat.com
>>
>



------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com



More information about the crossgcc mailing list