LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > AIX
User Name
Password
AIX This forum is for the discussion of IBM AIX.
eserver and other IBM related questions are also on topic.

Notices


Reply
  Search this Thread
Old 09-19-2014, 09:19 AM   #1
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,862
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
Overly zealous collect2 on AIX


It seems to me that when linking on AIX an executable (via g++/collect2/ld) from a *.a archive, 'collect2' fetches every constructors and destructors from the archive, not only the ones actually linked into the executable.

Example main program:
Code:
/* collect2_main.cc */

#include <cstdio>

int main ()
{
    fprintf (stderr, "Main program nothing special\n");
    fflush (stderr);
}
Example program to put into a *.a library:
Code:
/* collect2_bait.cc */

#include <cstdio>

class HibaProvokalo {
public:
    HibaProvokalo ();
};

HibaProvokalo::HibaProvokalo ()
{
    fprintf (stderr, "HibaProvokalo: Why am I called?\n");
    fflush (stderr);
}

HibaProvokalo hp;
Linkage:
Code:
g++ -c -o collect2_bait.o collect2_bait.cc
ar crs collect2_bait.a collect2_bait.o
g++ -c -o collect2_main.o collect2_main.cc
g++ -Wl,-debug -o collect2_prob_a collect2_main.o collect2_bait.a
./collect2_prob_a
HibaProvokalo: Why am I called?
Main program nothing special
Note: I detected this problem when I couldn't build mysql-5.5.38 on AIX 6.1 with g++ 4.6.4

Last edited by NevemTeve; 09-19-2014 at 09:23 AM.
 
Old 09-19-2014, 09:21 AM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,862

Original Poster
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
An earlier report of this problem:

https://www.ibm.com/developerworks/c...0-000014412986

And another:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=17480

Yet another:
http://unix.derkeiler.com/Newsgroups...4-09/0506.html

Last edited by NevemTeve; 09-20-2014 at 06:02 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Greetings from overly humid FL horton LinuxQuestions.org Member Intro 1 07-08-2014 04:41 PM
To be or not to be zealous Dave_P General 29 12-17-2011 12:54 PM
Fedora Core 6 overly secure dmcmahon Linux - Security 8 11-06-2006 12:20 PM
Overly sensitive trackball Lord Zoltar Linux - Hardware 12 07-23-2005 01:31 PM
Overly bright video? Pathian Linux - Software 1 03-24-2004 03:21 PM

LinuxQuestions.org > Forums > Other *NIX Forums > AIX

All times are GMT -5. The time now is 09:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration