Bug 24827 - FAIL: gcc.dg/attr-weakref-1.c
Summary: FAIL: gcc.dg/attr-weakref-1.c
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.1.0
: P3 normal
Target Milestone: ---
Assignee: Alexandre Oliva
URL:
Keywords:
Depends on:
Blocks: 24829
  Show dependency treegraph
 
Reported: 2005-11-12 22:43 UTC by John David Anglin
Modified: 2009-01-15 23:23 UTC (History)
2 users (show)

See Also:
Host: hppa*-*-hpux11.11
Target: hppa*-*-hpux11.11
Build: hppa*-*-hpux11.11
Known to work:
Known to fail:
Last reconfirmed: 2005-11-14 13:58:53


Attachments
.s output (1.39 KB, text/plain)
2005-12-10 21:48 UTC, John David Anglin
Details
.s file (301 bytes, text/plain)
2005-12-10 21:48 UTC, John David Anglin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description John David Anglin 2005-11-12 22:43:17 UTC
Executing on host: /test/gnu/gcc-3.3/objdir/gcc/xgcc -B/test/gnu/gcc-3.3/objdir/
gcc/ /test/gnu/gcc-3.3/gcc/gcc/testsuite/gcc.dg/attr-weakref-1.c   -O2 -fno-show
-column  /test/gnu/gcc-3.3/gcc/gcc/testsuite/gcc.dg/attr-weakref-1a.c  -lm   -o
./attr-weakref-1.exe    (timeout = 300)
ld: Unsatisfied symbol "wf1" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wf6" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wf9" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wv1" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wv6" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wv9" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wf10" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wf11" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wf12" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wf13" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wf14" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wv10" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wv11" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wv12" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wv13" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wv14" in file /var/tmp//ccNG756H.o
16 errors.
collect2: ld returned 1 exit status
compiler exited with status 1
output is:
ld: Unsatisfied symbol "wf1" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wf6" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wf9" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wv1" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wv6" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wv9" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wf10" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wf11" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wf12" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wf13" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wf14" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wv10" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wv11" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wv12" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wv13" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wv14" in file /var/tmp//ccNG756H.o
16 errors.
collect2: ld returned 1 exit status

FAIL: gcc.dg/attr-weakref-1.c (test for excess errors)
Excess errors:
ld: Unsatisfied symbol "wf1" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wf6" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wf9" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wv1" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wv6" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wv9" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wf10" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wf11" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wf12" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wf13" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wf14" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wv10" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wv11" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wv12" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wv13" in file /var/tmp//ccNG756H.o
ld: Unsatisfied symbol "wv14" in file /var/tmp//ccNG756H.o

WARNING: gcc.dg/attr-weakref-1.c compilation failed to produce executable
Comment 1 John David Anglin 2005-11-13 03:46:36 UTC
Also fails on hppa2.0w-hp-hpux11.11.  So, probably fails on all hppa*-*-hpux*
targets.
Comment 2 Andrew Pinski 2005-11-13 04:10:07 UTC
This blocks PR 24829.
Comment 3 Alexandre Oliva 2005-11-14 13:58:53 UTC
Mine
Comment 4 Alexandre Oliva 2005-11-14 14:19:09 UTC
Does this target actually support weak declarations?  It appears to me that it only does when the assembler supports .weak, but even then, the linker will object to undefined weak symbols, which is something this test relies on.  I suppose we'd have to mark it as an XFAIL on hpux, or use some alternate dg-require to indicate we need the ability to refer to undefined weak symbols.
Comment 5 dave 2005-11-14 19:40:46 UTC
Subject: Re:  FAIL: gcc.dg/attr-weakref-1.c

> Does this target actually support weak declarations?  It appears to me that it
> only does when the assembler supports .weak, but even then, the linker will
> object to undefined weak symbols, which is something this test relies on.  I
> suppose we'd have to mark it as an XFAIL on hpux, or use some alternate
> dg-require to indicate we need the ability to refer to undefined weak symbols.

See PR 23387.  The HP linkers and dynamic loaders don't like undefined weak
symbols.  GAS provides support for ".weak" using SOM secondary definition
symbols on the 32-bit port.  We use this under HP-UX 11 and it is good
enough for most purposes.  However, the semantics differ from that defined
in the sysv ABI.  The 64-bit support is a little better supported by the
linker, but the dynamic linker still doesn't like undefined weak symbols.

We don't support ".weak' under HP-UX 10 due to linker bugs.

Either XFAIL or dg-require would be ok.  If more tests are likely to be 
added, maybe dg-require would be better.

Dave
Comment 6 dave 2005-11-19 02:36:48 UTC
Subject: Re:  FAIL: gcc.dg/attr-weakref-1.c

> Does this target actually support weak declarations?  It appears to me that it
> only does when the assembler supports .weak, but even then, the linker will
> object to undefined weak symbols, which is something this test relies on.  I
> suppose we'd have to mark it as an XFAIL on hpux, or use some alternate
> dg-require to indicate we need the ability to refer to undefined weak symbols.

I started looking at the weakref failures in GAS in order to see whether
this feature should be disabled in the assembler.

One issue that I see is weak local symbols.  These are being emitted
by GAS under linux and they cause testsuite fails under HP-UX as they
come out as global under HP-UX.  Weak local symbols are impossible on
the HP-UX SOM port and probably on the 64-bit ELF port.  On the SOM
port, the secondary definition symbols used for weak symbols are always
global in scope.  It would seem to me that GAS doesn't have to emit
undefined weak local symbols, and defined weak local symbols should
just be local.  If that were possible, it would definitely improve
the usefulness of weak references under HP-UX.  However, undefined
weak references with global scope will always be a problem under HP-UX.

I've tried in the past to see if it's possible to support undefined
weak symbols.  While it's possible to suppress the linker error, the
dynamic loader generates an error when it encounters an undefined
symbol.  As far as I know, there's no way to suppress this error.

Dave
Comment 7 John David Anglin 2005-11-29 23:55:52 UTC
The same errors occur on hppa2.0w-hp-hpux11.11 except that ld also dumps
core:

collect2: ld terminated with signal 10 [Bus error], core dumped
/usr/bin/ld: Unsatisfied symbols:
   wf1 (first referenced in /var/tmp//ccuQuqgk.o) (data)
   wf6 (first referenced in /var/tmp//ccuQuqgk.o) (data)
   wf9 (first referenced in /var/tmp//ccuQuqgk.o) (data)
   wf10 (first referenced in /var/tmp//ccuQuqgk.o) (data)
   wf11 (first referenced in /var/tmp//ccuQuqgk.o) (data)
   wf12 (first referenced in /var/tmp//ccuQuqgk.o) (code)
   wf13 (first referenced in /var/tmp//ccuQuqgk.o) (code)
   wf14 (first referenced in /var/tmp//ccuQuqgk.o) (data)
   wv1 (first referenced in /var/tmp//ccuQuqgk.o) (data)
   wv6 (first referenced in /var/tmp//ccuQuqgk.o) (data)
   wv9 (first referenced in /var/tmp//ccuQuqgk.o) (data)
   wv10 (first referenced in /var/tmp//ccuQuqgk.o) (data)
   wv11 (first referenced in /var/tmp//ccuQuqgk.o) (data)
   wv12 (first referenced in /var/tmp//ccuQuqgk.o) (data)
   wv13 (first referenced in /var/tmp//ccuQuqgk.o) (data)
   wv14 (first referenced in /var/tmp//ccuQuqgk.o) (data)

FAIL: gcc.dg/attr-weakref-1.c (test for excess errors)
Comment 8 John David Anglin 2005-12-10 21:48:04 UTC
Created attachment 10447 [details]
.s output
Comment 9 John David Anglin 2005-12-10 21:48:26 UTC
Created attachment 10448 [details]
.s file
Comment 10 John David Anglin 2005-12-10 22:22:49 UTC
GCC is generating incorrect assembler code for the target of weak references.
For example, this is the declaration for "wf1":

extern ftype wf1;

I.e., it is declared as a function.  However, there is no .IMPORT emitted
for wf1, or its aliases Wf1a, Wf1b or Wf1c.  As a result, the assembler
has no way of knowing whether the symbol is code or data.  So, it ends up
as a data symbol.  

00000000 00000000 Data  Unsat  0 ......S...  3 00000 wf1

This would seem to indicate that ASM_OUTPUT_EXTERNAL wasn't used for wf1.
Failure to type assembler symbols correctly can often cause HP ld to dump
core.
Comment 11 John David Anglin 2005-12-31 02:12:38 UTC
Subject: Bug 24827

Author: danglin
Date: Sat Dec 31 02:12:34 2005
New Revision: 109197

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109197
Log:
	PR middle-end/24827
	* gcc.dg/attr-weakref-1.c: Skip test on hppa*-*-hpux*.


Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/attr-weakref-1.c

Comment 12 John David Anglin 2005-12-31 02:18:52 UTC
Subject: Bug 24827

Author: danglin
Date: Sat Dec 31 02:18:49 2005
New Revision: 109198

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109198
Log:
	PR middle-end/24827
	* gcc.dg/attr-weakref-1.c: Skip test on hppa*-*-hpux*.


Modified:
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_1-branch/gcc/testsuite/gcc.dg/attr-weakref-1.c

Comment 13 Steve Ellcey 2009-01-15 23:23:55 UTC
It looks like the test was changed to fix this failure.  Marking as fixed.