This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: -O or -g on gcc linker frontend?


On Thu, 2006-06-22 at 11:37 -0700, Ian Lance Taylor wrote:
> Gerhard Theurich <gtheurich@sgi.com> writes:
> 
> > For a while now I have been wondering if the gcc linker frontend cares
> > knowing about -g or -O flags. Let's say I have an object file a.o and
> > I want to link it into an executable a.out using gcc I can just say:
> >      gcc a.o
> > But I can also use debug or optimization flags:
> >      gcc -g a.o
> >      gcc -O2 a.o
> >      ....
> > Does the gcc linker frontend care about these flags or are they simply
> > ignored? Is it generally advisable to use some consistent set of -g/-O
> > flags during linkage compared to what was used during compilation of
> > the objects (what if the objects where compiled with different
> > options)?
> 
> The -g and -O options are used only when generating .o files, and are
> ignored when linking .o files.
> 
> Ian

Isn't the -g option used by the linker to put the debug information into
the executable image or in the shared object library?


-- 
Charlie Farbstein
L-3 Communications/ Titan Group
e-mail: charles.farbstein@L-3Com.com
phone:  (619) 278-2053
fax:    (619) 278-2070


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]