This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH/RFC] Fix LD test FAIL: weak symbols on Cygwin
Aaron W. LaFramboise wrote:
> H.J. Lu wrote:
>
>> "weak symbols" also failed for i386-pc-mingw32 and it never worked.
>
> OK, you are completely correct. I'm very sorry for the wild goose
> chase. This is <http://sources.redhat.com/bugzilla/show_bug.cgi?id=977>.
>
> I am boggled that I did not fix this issue at the time, but I'll take a
> look at it and try to figure out what I know about it and why I didn't
> fix it.
Possibly just not noticing it in general usage, because I think it'll only
show up with absolute .long references as we saw in the testcase, and not with
PIC or PC-relative branches or lea-style address calculations, so in general
it might not show up often. There aren't a lot of testcases in the GCC suite
that are affected by this bug, either, so I think it must only crop up
sporadically in real-world situations.
I got the results of my C++ testing back in. Not immediately excellent, but
instructive.
=== libstdc++ tests ===
@@ -630,13 +631,13 @@ PASS: 20_util/shared_ptr/requirements/ex
PASS: 20_util/shared_ptr/requirements/explicit_instantiation/2.cc (test for
excess errors)
PASS: 20_util/shared_ptr/requirements/explicit_instantiation/2.cc (test for
excess errors)
PASS: 20_util/shared_ptr/thread/default_weaktoshared.cc (test for excess errors)
-PASS: 20_util/shared_ptr/thread/default_weaktoshared.cc execution test
+FAIL: 20_util/shared_ptr/thread/default_weaktoshared.cc execution test
PASS: 20_util/shared_ptr/thread/default_weaktoshared.cc (test for excess errors)
-PASS: 20_util/shared_ptr/thread/default_weaktoshared.cc execution test
-PASS: 20_util/shared_ptr/thread/mutex_weaktoshared.cc (test for excess errors)
-FAIL: 20_util/shared_ptr/thread/mutex_weaktoshared.cc execution test
+FAIL: 20_util/shared_ptr/thread/default_weaktoshared.cc execution test
PASS: 20_util/shared_ptr/thread/mutex_weaktoshared.cc (test for excess errors)
PASS: 20_util/shared_ptr/thread/mutex_weaktoshared.cc execution test
+PASS: 20_util/shared_ptr/thread/mutex_weaktoshared.cc (test for excess errors)
+FAIL: 20_util/shared_ptr/thread/mutex_weaktoshared.cc execution test
PASS: 20_util/specialized_algorithms/uninitialized_copy/move_iterators/1.cc
(test for excess errors)
PASS: 20_util/specialized_algorithms/uninitialized_copy/move_iterators/1.cc
execution test
PASS: 20_util/specialized_algorithms/uninitialized_copy/move_iterators/1.cc
(test for excess errors)
@@ -7895,15 +7896,15 @@ PASS: tr1/2_general_utilities/shared_ptr
PASS: tr1/2_general_utilities/shared_ptr/thread/default_weaktoshared.cc (test
for excess errors)
PASS: tr1/2_general_utilities/shared_ptr/thread/default_weaktoshared.cc
execution test
PASS: tr1/2_general_utilities/shared_ptr/thread/default_weaktoshared.cc (test
for excess errors)
-FAIL: tr1/2_general_utilities/shared_ptr/thread/default_weaktoshared.cc
execution test
-PASS: tr1/2_general_utilities/shared_ptr/thread/default_weaktoshared.cc (test
for excess errors)
PASS: tr1/2_general_utilities/shared_ptr/thread/default_weaktoshared.cc
execution test
+PASS: tr1/2_general_utilities/shared_ptr/thread/default_weaktoshared.cc (test
for excess errors)
+FAIL: tr1/2_general_utilities/shared_ptr/thread/default_weaktoshared.cc
execution test
PASS: tr1/2_general_utilities/shared_ptr/thread/mutex_weaktoshared.cc (test
for excess errors)
-PASS: tr1/2_general_utilities/shared_ptr/thread/mutex_weaktoshared.cc
execution test
+FAIL: tr1/2_general_utilities/shared_ptr/thread/mutex_weaktoshared.cc
execution test
PASS: tr1/2_general_utilities/shared_ptr/thread/mutex_weaktoshared.cc (test
for excess errors)
FAIL: tr1/2_general_utilities/shared_ptr/thread/mutex_weaktoshared.cc
execution test
PASS: tr1/2_general_utilities/shared_ptr/thread/mutex_weaktoshared.cc (test
for excess errors)
-PASS: tr1/2_general_utilities/shared_ptr/thread/mutex_weaktoshared.cc
execution test
+FAIL: tr1/2_general_utilities/shared_ptr/thread/mutex_weaktoshared.cc
execution test
PASS: tr1/2_general_utilities/weak_ptr/lock/1.cc (test for excess errors)
PASS: tr1/2_general_utilities/weak_ptr/lock/1.cc (test for excess errors)
PASS: tr1/2_general_utilities/weak_ptr/lock/1.cc (test for excess errors)
@@ -10040,8 +10041,8 @@ PASS: tr1/headers/using_namespace_std_tr
=== libstdc++ Summary ===
-# of expected passes 9258
-# of unexpected failures 40
+# of expected passes 9254
+# of unexpected failures 44
# of unexpected successes 2
# of expected failures 121
# of unsupported tests 556
@@ -10119,7 +10120,7 @@ test -d testsuite/g++ || mkdir testsuite
GCC_EXEC_PREFIX="/usr/lib/gcc/" ; export GCC_EXEC_PREFIX ; \
runtest --tool g++ -all)
WARNING: Couldn't find the global config file.
-Test Run By DKAdmin on Tue Mar 17 01:20:39 2009
+Test Run By DKAdmin on Tue Mar 17 17:18:21 2009
Native configuration is i686-pc-cygwin
=== g++ tests ===
@@ -23455,7 +23456,7 @@ PASS: g++.old-deja/g++.ext/attrib4.C (t
PASS: g++.old-deja/g++.ext/attrib4.C (test for warnings, line 23)
PASS: g++.old-deja/g++.ext/attrib4.C (test for excess errors)
PASS: g++.old-deja/g++.ext/attrib5.C (test for excess errors)
-XPASS: g++.old-deja/g++.ext/attrib5.C execution test
+XFAIL: g++.old-deja/g++.ext/attrib5.C execution test
PASS: g++.old-deja/g++.ext/attrib6.C (test for excess errors)
PASS: g++.old-deja/g++.ext/bound1.C (test for excess errors)
PASS: g++.old-deja/g++.ext/constructor.C (test for excess errors)
@@ -28698,8 +28699,7 @@ PASS: g++.old-deja/g++.warn/virt1.C (tes
# of expected passes 18230
# of unexpected failures 15
-# of unexpected successes 1
-# of expected failures 83
+# of expected failures 84
# of unsupported tests 214
/win/i/FSF-Gcc/package/gcc4-4.3.2-2/build/gcc/testsuite/g++/../../g++
version 4.3.2 20080827 (beta) 2 (GCC)
Now, the various *weaktoshared* tests have always been intermittent on
Cygwin (perhaps expose a race condition in the DLL's pthreads support or
something similar, haven't had time to look yet), so I looked at the attrib5.C
test, and saw what I had thought would probably happen in my first post: there
was an offset in the in-place field that I /didn't/ want to zero out. Here's
what the testcase looks like:
/gnu/gcc/package/gcc4-4.3.2-2/src/gcc-4.3.2/gcc/testsuite $ cat
g++.old-deja/g++.ext/attrib5.C
// { dg-do run { xfail alpha*-dec-osf* *-*-hms i?86-pc-cygwin *-*-coff } }
// Test that attributes weak and alias coexist.
// { dg-require-weak "" }
// { dg-require-alias "" }
extern "C" {
void _f () { }
void f () __attribute__((weak, alias ("_f")));
}
int main ()
{
f ();
}
... and here's the difference in the generated object file; 'badobj.txt' is
the objdump output from the version of attrib5.o generated by my patched
assembler, 'goodobj.txt' from a clean build of gas:
/gnu/gcc/package/gcc4-4.3.2-2/build/gcc/testsuite/g++ $ diff -pu badobj.txt
goodobj.txt
--- badobj.txt 2009-03-17 20:52:08.812500000 +0000
+++ goodobj.txt 2009-03-17 20:53:07.234375000 +0000
@@ -1,6 +1,6 @@
-attrib5.o: file format pe-i386
-attrib5.o
+attrib5good.o: file format pe-i386
+attrib5good.o
architecture: i386, flags 0x00000039:
HAS_RELOC, HAS_DEBUG, HAS_SYMS, HAS_LOCALS
start address 0x00000000
@@ -92,7 +92,7 @@ AUX lnno 1 size 0x0 tagndx 13
Contents of section .text:
0000 5589e55d c38d4c24 0483e4f0 ff71fc55 U..]..L$.....q.U
- 0010 89e55183 ec04e800 000000e8 e4ffffff ..Q.............
+ 0010 89e55183 ec04e800 000000e8 00000000 ..Q.............
0020 b8000000 0083c404 595d8d61 fcc39090 ........Y].a....
Contents of section .eh_frame:
0000 18000000 00000000 017a5000 017c0805 .........zP..|..
@@ -119,7 +119,7 @@ Disassembly of section .text:
13: 83 ec 04 sub $0x4,%esp
16: e8 00 00 00 00 call 1b <_main+0x16>
17: DISP32 ___main
- 1b: e8 e4 ff ff ff call 4 <__f+0x4>
+ 1b: e8 00 00 00 00 call 20 <_main+0x1b>
1c: DISP32 _f
20: b8 00 00 00 00 mov $0x0,%eax
25: 83 c4 04 add $0x4,%esp
@_______. .
( /"\
||--||(___)
'" '"'---'
/gnu/gcc/package/gcc4-4.3.2-2/build/gcc/testsuite/g++ $
DOH! Zeroing out the in-place field and letting BFD add back in the symbol
value at link time does not work with a relative branch. I'll think more
about what to do next later, but it's half four and I need some sleep.
Oh, happy St. Patrick's, all :)
cheers,
DaveK