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]

AIX 4.3 and COLLECT_EXPORT_LIST


Hi,

(Talking about 2.95.1, but the code is the same in .2. Working under
AIX 4.3 (apparently .0, uname wouldn't say.))

I just dirty-hacked executable-linking collect2 (don't care about
shared libs yet). Collect2 somehow collected global ctors and dtors in
every object file in every library that was given on the command line
(which I dont want because I'm not interested in initializing global
objects in unreferenced object files). Essentially, what I've done is
to undefine COLLECT_EXPORT_LIST.

Now, there's some comments on this macro which make me suspect there's
more to it:

In config/rs6000/xm-rs6000.h:

>>>>>>>>
/* The AIX linker will discard static constructors in object files before
   collect has a chance to see them, so scan the object files directly.  */
#define COLLECT_EXPORT_LIST
<<<<<<<<

In collect2.c, before collecting the global (c|d)tors from the .o
input files (scan_prog_file(...,PASS_OBJ)). Ok, I want this to happen
because I like starting the reference chain from an explicitly
specified .o file when building a shared library:

>>>>>>>>
  /* The AIX linker will discard static constructors in object files if
     nothing else in the file is referenced, so look at them first.  */
<<<<<<<<

But in the next block (scan_prog_file(...,PASS_FIRST)) the libraries
are scanned for global ctors.

My dirty hack works well. What I don't really understand is that I
need an export list only when I am bulding a shared library. It seems
to me that this macro is somewhat (mis)used as something like #ifdef
AIX. But, on the other hand, if my hack works well, what's the reason
to apply it generally, regardless if we are building a shared library
or an executable. Have there been problems with other AIX ld versions
that are solved with the version that I use?

Thanks,
Joerg


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