public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13150] New: WEAK symbols not exported by collect2
@ 2003-11-21 16:03 greed at pobox dot com
  2003-11-21 16:04 ` [Bug c++/13150] " greed at pobox dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: greed at pobox dot com @ 2003-11-21 16:03 UTC (permalink / raw)
  To: gcc-bugs

GCC 3.3 and up on AIX 5.2 correctly detect that the native assembler and linker
finally support weak symbols (though there are still issues...).

But collect2 doesn't recognize any weak exported symbol as being exported, so
GCC's C++ libraries, wind up with Important Things inaccessible.  Here's a
simple testcase, using only C, to show the problem:

% cat >lib.c <<'EOF'
int __attribute__ ((weak)) a = 20;
int foo (void) { return a; }
EOF
% cat >prog.c <<'EOF'
extern int a;
int main(int argc,char ** argv) { return a; }
EOF

Compiled using:
% gcc -shared -o liblib.so lib.c
% gcc -Wl,-brtl,-bnortllib -o prog prog.c -L. -llib
ld: 0711-317 ERROR: Undefined symbol: a
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: ld returned 8 exit status

If we examine the static symbol table of liblib.so, we see 'a' is present and
marked weak as expected:

% dump -tv liblib.so | grep ' a'
[2]     m   0x20000340     .data     1  unamex                    a
[14]    m   0x20000290     .data     1    weak                    a

But the dynamic symbol table does not have 'a':
% dump -Tv liblib.so | grep ' a'
[no output]

I have updated collect2.c to recognize AIX's C_WEAKEXT and consider such symbols
candidates for exporting.  The patch will be attached after I open this.

With the patch, the dynamic symbol table becomes:
[1]     0x20000290    .data     wEXP     RW   Ldef        [noIMid] a

(Also, the unused function foo is no longer required to fool linker into keeping
'a'.)

-- 
           Summary: WEAK symbols not exported by collect2
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: greed at pobox dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-ibm-aix5.2.0.0
  GCC host triplet: powerpc-ibm-aix5.2.0.0
GCC target triplet: powerpc-ibm-aix5.2.0.0


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/13150] WEAK symbols not exported by collect2
  2003-11-21 16:03 [Bug c++/13150] New: WEAK symbols not exported by collect2 greed at pobox dot com
@ 2003-11-21 16:04 ` greed at pobox dot com
  2003-11-21 16:08 ` [Bug other/13150] " pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: greed at pobox dot com @ 2003-11-21 16:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From greed at pobox dot com  2003-11-21 16:04 -------
Created an attachment (id=5181)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5181&action=view)
Patch to teach collect2.c to recognize AIX C_WEAKEXT symbols.


-- 


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug other/13150] WEAK symbols not exported by collect2
  2003-11-21 16:03 [Bug c++/13150] New: WEAK symbols not exported by collect2 greed at pobox dot com
  2003-11-21 16:04 ` [Bug c++/13150] " greed at pobox dot com
@ 2003-11-21 16:08 ` pinskia at gcc dot gnu dot org
  2003-12-06 19:10 ` [Bug target/13150] " dje at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-21 16:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-11-21 16:08 -------
Patches should go to gcc-patches@gcc.gnu.org as not every maintainer reads bugs (do not know 
why), also patches need to be from the head of the tree of the cvs.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|c++                         |other
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-11-21 16:08:42
               date|                            |
   Target Milestone|---                         |3.4


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/13150] WEAK symbols not exported by collect2
  2003-11-21 16:03 [Bug c++/13150] New: WEAK symbols not exported by collect2 greed at pobox dot com
  2003-11-21 16:04 ` [Bug c++/13150] " greed at pobox dot com
  2003-11-21 16:08 ` [Bug other/13150] " pinskia at gcc dot gnu dot org
@ 2003-12-06 19:10 ` dje at gcc dot gnu dot org
  2003-12-08  4:26 ` dje at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dje at gcc dot gnu dot org @ 2003-12-06 19:10 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2003-11-21 16:08:42         |2003-12-06 19:10:16
               date|                            |


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/13150] WEAK symbols not exported by collect2
  2003-11-21 16:03 [Bug c++/13150] New: WEAK symbols not exported by collect2 greed at pobox dot com
                   ` (2 preceding siblings ...)
  2003-12-06 19:10 ` [Bug target/13150] " dje at gcc dot gnu dot org
@ 2003-12-08  4:26 ` dje at gcc dot gnu dot org
  2003-12-08 19:02 ` cvs-commit at gcc dot gnu dot org
  2003-12-08 19:48 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: dje at gcc dot gnu dot org @ 2003-12-08  4:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dje at gcc dot gnu dot org  2003-12-08 04:25 -------
http://gcc.gnu.org/ml/gcc-patches/2003-12/msg00731.html

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/13150] WEAK symbols not exported by collect2
  2003-11-21 16:03 [Bug c++/13150] New: WEAK symbols not exported by collect2 greed at pobox dot com
                   ` (3 preceding siblings ...)
  2003-12-08  4:26 ` dje at gcc dot gnu dot org
@ 2003-12-08 19:02 ` cvs-commit at gcc dot gnu dot org
  2003-12-08 19:48 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-12-08 19:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2003-12-08 19:02 -------
Subject: Bug 13150

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	dje@gcc.gnu.org	2003-12-08 19:02:43

Modified files:
	gcc            : ChangeLog collect2.c 

Log message:
	PR target/13150
	* collect2.c (GCC_OK_SYMBOL): Add support for AIX C_WEAKEXT.
	(GCC_UNDEF_SYMBOL): Same.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.831&r2=1.16114.2.832
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/collect2.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.142.4.2&r2=1.142.4.3



-- 


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/13150] WEAK symbols not exported by collect2
  2003-11-21 16:03 [Bug c++/13150] New: WEAK symbols not exported by collect2 greed at pobox dot com
                   ` (4 preceding siblings ...)
  2003-12-08 19:02 ` cvs-commit at gcc dot gnu dot org
@ 2003-12-08 19:48 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-08 19:48 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4                         |3.3.3


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-12-08 19:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-21 16:03 [Bug c++/13150] New: WEAK symbols not exported by collect2 greed at pobox dot com
2003-11-21 16:04 ` [Bug c++/13150] " greed at pobox dot com
2003-11-21 16:08 ` [Bug other/13150] " pinskia at gcc dot gnu dot org
2003-12-06 19:10 ` [Bug target/13150] " dje at gcc dot gnu dot org
2003-12-08  4:26 ` dje at gcc dot gnu dot org
2003-12-08 19:02 ` cvs-commit at gcc dot gnu dot org
2003-12-08 19:48 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).