This is the mail archive of the gcc@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: C++ Frontend and combining files


Ian Lance Taylor wrote:
> Brendon Costa <bcosta@avdat.com.au> writes:
> 
>> Then GCC (SOMEWHERE I CANT SEEM TO FIND THIS PART OF THE CODE) links
>> these objects by calling ld with /tmp/foo1.o and /tmp/foo2.o combining
>> these into: blah
> 
> It's done in the driver, gcc.c.  Look for link_command_spec.
> 
> Ian
> 

Mike Stump wrote:
>
> Additionally, see -save-temps for additional hints.  This avoids
> /tmp/temp234.s as an intermediate file and generates ext_test.s
> instead.  Run with -v, and you can see how the compiler is called
> from
> the driver as well.  If the command line has all the information you
> need, you then can just change the compiler.  If it doesn't, change
> the
> specs to ensure that the information you need is on the command
> line.
> cp/lang-specs.h has those specs that you'd probably need to change.
>
>

Thanks for the info. I just read the comments in gcc.c on the spec
language and a few web-pages which basically have the same information
and it is all quite confusing...

Unfortunately the command line for cc1plus does not have all the
information I need. It has enough in order to create a .edc file for
each .cpp file compiled, but the problem comes when linking all these
results together as cc1plus is not used for this at all.

After looking at the spec files information I would probably change my
code so that the output would be like:

test.cpp : /tmp/foo1.s /tmp/foo1.s.edc
ext_test.cpp : /tmp/foo2.s /tmp/foo2.s.edc

and I would also change the method I was planning on doing things so
that I would need to do the following:


* Modify the ASM spec used for compiling .s files into .o files so
that it will somehow rename the /tmp/foo1.s.edc files to
/tmp/gah1.o.edc files where /tmp/gah1.o is the name of the output .o
file that comes from the assembler.

* Write a wrapper for ld, that looks for .edc files for each .o file
given and merges them before calling the real ld. This would also look
for .edc files associated with any libraries being statically linked
with and merge those as well.


--- Question/Request ---

I have no idea how I could go about achieving this. Would someone be
able to help me with any information on how I could modify the ASM
command spec in the GCC driver to do this?


Some simple questions that might help me in doing it:

1) Is it possible for a spec to execute more than 1 program?
I.e. can i call as and rm with the same spec?

2) If so, how could I add a new command to the spec?



I assume I would be modifying the contents of the "invoke_as" string
in gcc.c. If I did so would this also work when compiling with debug
mode enabled? (It seems there is a special ASM case for compiling with
debug)


Again, thanks a lot for any help you can provide. I am really looking
forward to having this tool completed.

Brendon.


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