Page 2 of 2

Re: translate offsets to library calls

Posted: Tue Sep 13, 2011 3:55 pm
by tonyw
@JosDuchit:

I think you have to perform the final link with -g as well. Certainly I have -g in both the gcc -c command line and the link line.
eg:

CFLAGS = -mcrt=newlib -O2 -fomit-frame-pointer -fno-builtin -fstrength-reduce -c\
-D__NOGLOBALIFACE__ -D$(DBUG) -D$(ENV) -mmultiple \
-Iinc/ -I../../../include \
-Wall -W -Wundef -Wshadow -Wpointer-arith \
-Wsign-compare -Wmissing-prototypes \
-Wmissing-declarations \
-Waggregate-return -Wwrite-strings -Werror -g
LDFLAGS = -mcrt=newlib -nostartfiles -g

Re: translate offsets to library calls

Posted: Tue Sep 13, 2011 4:49 pm
by ssolie
When using debugging it is best to use -gstabs on both the compiler and linker lines. Just using "-g" may not always work when binaries get large.

Re: translate offsets to library calls

Posted: Wed Sep 14, 2011 10:00 pm
by JosDuchIt
@TonyW

Till now i just compile and link directly.
gcc guis:Dev/G4C_2011/guiNotCleaned.c -xc -gstabs -lm -lauto -o guis:G4T11nco
gcc guis:Dev/G4C_2011/guiIFace.c -xc -gstabs -lm -o guis:G4T11if

Both those sources do the same job , in the last i have opened all 9 libraries explicitly.
Both "include" a large number of "header files" eg window.h that in fact contain specific funtions.

I looked at your CFLAGS and was rather puzzled : are you suggesting i should use them? I looked through the gcc handbook to know what they mean. Frankly for some of them i still don't see the light.

At this stage i surely am not interested in optimizing, and the use of -Werror would prevent the source from compiling since i have not yet cleaned up deprecated functions (Seek, Examone, ..) most of the time.
Could you explain your -D options (which are not found in the gcc handbook ) ? Thanks

Re: translate offsets to library calls

Posted: Wed Sep 14, 2011 10:44 pm
by ChrisH
ssolie wrote:When using debugging it is best to use -gstabs on both the compiler and linker lines. Just using "-g" may not always work when binaries get large.
I recall that either -gstabs or -ggdb (not sure if I tried both) did not work with a particularly large C++ program (about 80k lines, 3MB stripped executable). I think the intermediate assembler didn't like some long names in the (artificially generated) source code.

So I ended-up using just -g , which seemed to work fine in my large program. Why might it not?