I have a number of things that I would like to see added to collect2.  If there
is interest in them, I'll volunteer to do the work.  I am not sure of the
process of making suggestions like this so if there is another format, please
let me know.  e.g. I've put all of my suggestions into one report -- perhaps
they should be split apart.

Changes to collect2:

1) Added the ability for collect2 to stop after the creation of the .c file
which also implies an option to give the .c file a name.   Maybe:
        --c-file-only=foo.c
I would only add this to collect2's argument processing so to use it from g++,
the user would do: -Wl,--c-file-only=foo.c

2) Same as #1 but with the object file.  Maybe:
        --o-file-only=foo.o

3) Right now collect2 looks at suffixes.  It would be nice to do one or both of
the following two things:
3a) An option to add suffixes used for object files.  Maybe:
                --object-suffix=.32o
        to add the .32o suffix.
3b) Look at the magic number in the files to determine if they are an object
file that needs to be looked at.  This could be an option as well.

The pitfall is that on AIX, an archive can have 32 bit object files and 64 bit
object files (in the same archive) and the linker pulls out the ones it needs. 
The way this is done usually is to have foo.c compile to foo.32o and foo.64o
and then put all the object files into one archive.  gcc instead has
path/libxxx.a and path/ppc64/libxxx.a  If the only difference is the 32/64
bitness, those could be combined.  This is what old farts like me are use to on
AIX.

This system confuses collect2 in two places. If I do g++ foo.32o -o foo,
collect2 never looks at foo.32o for constructors and destructors (or frame
tables).  The trick I did was to put my object files into an archive and then
collect2 scans them.  I am building a driver which means I need it in 32 bit
form as well as 64 bit form.  I assume if I had both my 32 bit object files and
my 64 bit object files in the same  archive, collect2 would scan all of them
which is not the right thing to have happen.  collect2 could look at the magic
numbers and resolve both of these short comings.  (collect2 knows if it is in
32 bit mode or in 64 bit mode.)

4) collect2 on AIX has two arguments that it passes to ld that can not be
removed.  I'm wondering if those should be added in only if -nostdlib is not
specified (or some other way to accomplish the same task).  There may be other
flags to ld like this as well but I don't think so.  Right now, to get around
this problem I have a script called ld in my path before the real ld and the
script strips out the two arguments that I don't want.


-- 
           Summary: Options added to collect2
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pedz at easesoftware dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25943

Reply via email to