[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::c_plus_plus

Title:C++
Notice:Read 1.* and use keywords (e.g. SHOW KEY/FULL KIT_CXX_VAX_VMS)
Moderator:DECCXX::AMARTIN
Created:Fri Nov 06 1987
Last Modified:Thu Jun 05 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:3604
Total number of notes:18242

3447.0. "Can't find ... ladebug, g2, g0 when just c??" by KERNEL::PULLEY (Come! while living waters flow) Thu Feb 13 1997 05:24

Hi Folks,

I've a customer who's having a slight problem with C++ v5.4, Digital UNIX v4.0,
and Ladebug.
Basically he asks for -g2, when using C++ with just a .c program but the C
compiler seems to pick up g0.
There's the cut out from a script the customer sent in below.
Only seems to fail if a '.c' extension is used.
I.e., if extention .C it's ok.

Thanks for any comments,
Steve.

more test1.c

main()
{
}
cxx -g2 test1.c -v -source_listing -show all
/usr/lib/cmplrs/cxx/cc -source_listing -show all -c -o test1.o test1.c
0.02u 0.03s 0:00.1 60%
/usr/lib/cmplrs/cxx/cc -G 8 -g2 -call_shared /usr/lib/cmplrs/cxx/_main.o
test1.o -v -lcxxstd -lcxx -lexc -cxxsyms
/usr/lib/cmplrs/cc/ld -cxxsyms -g2 -O1 -call_shared
/usr/lib/cmplrs/cc/crt0.o /usr/lib/cmplrs/cxx/_main.o test1.o -lcxxstd
-lcxx  -lexc -lc
/usr/lib/cmplrs/cxx/cc -G 8 -g2 -call_shared /usr/lib/cmplrs/cxx/_main.o
test1.o -v -lcxxstd -lcxx -lexc |& /usr/lib/cmplrs/cxx/demangle
/usr/lib/cmplrs/cc/ld -g2 -O1 -call_shared /usr/lib/cmplrs/cc/crt0.o
/usr/lib/cmplrs/cxx/_main.o test1.o -lcxxstd -lcxx -lexc -lc
/usr/lib/cmplrs/cc/ld:
0.03u 0.04s 0:00 35% 0+9k 0+12io 0pf+0w 9stk+1272mem
0.05u 0.07s 0:00.2 50%
homer.datasci.co.uk> more test1.lis
12-Feb-1997 11:47:01    DEC C V5.2-023
Command Line
cc -noansi_alias -no_ansi_args -double -g0 -assume
notrusted_short_alignment
 -writable_strings -source_listing -member_alignment -object -O2
-preempt_symbol
 -tune generic -show expansion -show header -show include -show source
 -show statistics -signed -std0 -weak_volatile -D__LANGUAGE_C__
-D__unix__
 -D__osf__ -D__alpha -D_SYSTYPE_BSD -D_LONGLONG -DLANGUAGE_C -Dunix
-DSYSTYPE_BSD
 -I/usr/include
test1.lis: END
homer.datasci.co.uk> !la
ladebug a.out
Welcome to the Ladebug Debugger Version 4.0-19
 ------------------
object file name: a.out
Reading symbolic information ...done
(ladebug) list
(Can't find file DebugInformationStrippedFromFile2)
T.RTitleUserPersonal
Name
DateLines
3447.1seems like a bug to meDECCXX::MITCHELLThu Feb 13 1997 09:2217
When there's a .c file on the cxx command line, the
file is compiled by cc rather than the C++ compiler
(unless -x cxx is specified).

I think the problem you reported is a bug.  That is,
cxx should pass any -g options on the cxx command line
on to cc when compiling .c files.  (It already does
that for some options; e.g. -O.)  I've entered a bug 
report in our internal database for this.

In the meantime, the obvious workaround is to
invoke cc directly to compile the .c files and
then specify the resulting object files on the
cxx command line  For example,

cc -g2 -c -o test1.o test1.c
cxx -g2 ... test1.o
3447.2Other options gone missing tooGALVIA::STONESTom StonesFri Feb 14 1997 08:0458
The cxx driver doesn't seem to be passing linker options through either.
For example, -hidden option is ignored - see below.  
Also, with the -shared option, should it be including
/usr/lib/cmplrs/cxx/_main.o ??

zen> cxx -shared mcm.cxx -hidden mcm_internal.cxx cache.cxx -I. -o libmcm.so -v
>& junk


zen> more junk      (extra line breaks added)
mcm.cxx:

/usr/lib/cmplrs/cxx/gemc_cxx -g0 -O2 -thread_safe -Xirf./cxx_repository/zen.ilo.
dec.comaawbea -ptr./cxx_repository -ptsuf.cxx.CXX.C.cc.CC.cpp.c -I. -Xsd./ -o mc
m.o mcm.cxx 
0.80u 0.12s 0:01.4 66%

mcm_internal.cxx:
/usr/lib/cmplrs/cxx/gemc_cxx -g0 -O2 -thread_safe -Xirf./cxx_repository/zen.ilo.
dec.comaawbea -ptr./cxx_repository -ptsuf.cxx.CXX.C.cc.CC.cpp.c -I. -Xsd./ -o mc
m_internal.o mcm_internal.cxx 
1.38u 0.17s 0:01.9 80%

cache.cxx:
/usr/lib/cmplrs/cxx/gemc_cxx -g0 -O2 -thread_safe -Xirf./cxx_repository/zen.ilo.
dec.comaawbea -ptr./cxx_repository -ptsuf.cxx.CXX.C.cc.CC.cpp.c -I. -Xsd./ -o ca
che.o cache.cxx 
0.08u 0.05s 0:00.4 33%

/usr/lib/cmplrs/cxx/cc -o libmcm.so -G 8 -shared -g0 /usr/lib/cmplrs/cxx/_main.o
 mcm.o mcm_internal.o cache.o -v -lcxxstd -lcxx -lexc -cxxsyms 

/usr/lib/cmplrs/cc/ld -o libmcm.so -cxxsyms -g0 -O1 -shared /usr/lib/cmplrs/cxx/
_main.o mcm.o mcm_internal.o cache.o -lcxxstd -lcxx -lexc -lc 

/usr/lib/cmplrs/cxx/cc -o libmcm.so -G 8 -shared -g0 /usr/lib/cmplrs/cxx/_main.o
 ./cxx_repository/Cache_t__T14EpMcMapEntry_t.o ./cxx_repository/Cache_t__T15RxBu
fMapEntry_t.o ./cxx_repository/Cache_t__T15TxBufMapEntry_t.o mcm.o mcm_internal.
o cache.o -v -lcxxstd -lcxx -lexc -cxxsyms 

/usr/lib/cmplrs/cc/ld -o libmcm.so -cxxsyms -g0 -O1 -shared /usr/lib/cmplrs/cxx/
_main.o ./cxx_repository/Cache_t__T14EpMcMapEntry_t.o ./cxx_repository/Cache_t__
T15RxBufMapEntry_t.o ./cxx_repository/Cache_t__T15TxBufMapEntry_t.o mcm.o mcm_in
ternal.o cache.o -lcxxstd -lcxx -lexc -lc 

/usr/lib/cmplrs/cxx/cc -o libmcm.so -G 8 -shared -g0 /usr/lib/cmplrs/cxx/_main.o
 ./cxx_repository/Cache_t__T14EpMcMapEntry_t.o ./cxx_repository/Cache_t__T15RxBu
fMapEntry_t.o ./cxx_repository/Cache_t__T15TxBufMapEntry_t.o mcm.o mcm_internal.
o cache.o -v -lcxxstd -lcxx -lexc |& /usr/lib/cmplrs/cxx/demangle

/usr/lib/cmplrs/cc/ld -o libmcm.so -g0 -O1 -shared /usr/lib/cmplrs/cxx/_main.o .
/cxx_repository/Cache_t__T14EpMcMapEntry_t.o ./cxx_repository/Cache_t__T15RxBufM
apEntry_t.o ./cxx_repository/Cache_t__T15TxBufMapEntry_t.o mcm.o mcm_internal.o 
cache.o -lcxxstd -lcxx -lexc -lc 

/usr/lib/cmplrs/cc/ld: 
0.06u 0.04s 0:00 23% 0+10k 7+12io 2pf+0w 10stk+1352mem
0.08u 0.08s 0:00.5 36%
3447.3GALVIA::STONESTom StonesFri Feb 14 1997 08:084
Could you explain what's going on with the multiple cc and ld calls?

Ta,
Tom.
3447.4DECCXL::OUELLETTEWed Feb 19 1997 17:0618
> Could you explain what's going on with the multiple cc and ld calls?

Very approximately:

The way that cc automatically instantiates template classes and template
functions is via trial and error.  The first pass compiles all of the
objects and then tries to link them.  Unresolved references are then
collected and examined to find as yet uninstantiated template things.
Creating objects with the missing template things accounts for the extra
compiles.  The reason why you may have more than two link trials is that
newly instantiated templates may need more templates (transitive closure).
The compiler uses the repository to avoid excessive compiles and links
in subsequent builds.

I don't think we want to document this in any more detail, since we're
considering changes to optimize the process in later compiler versions.

Roland.