bug-libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: HEAD fails stress test on darwin


From: Ralf Wildenhues
Subject: FYI: HEAD fails stress test on darwin
Date: Tue, 8 Mar 2005 14:39:44 +0100
User-agent: Mutt/1.4.1i

Hi Peter,

* Peter O'Gorman wrote on Wed, Feb 23, 2005 at 03:22:26PM CET:
> Ralf Wildenhues wrote:
> 
> |> ld: multiple definitions of symbol _v1
> |> .libs/main.o definition of _v1 in section (__DATA,__common)
> |> sub2/.libs/liba.a(a.o) definition of _v1 in section (__DATA,__common)
> |> ../../libtool/tests/stresstest.at:171: ./main
> |> Because both main.c and a.c have:
> |> int v1;
> |
> | .. but I'm not sure whether I wanted one of them to be extern or
> | whether I wanted to see if the linker can in fact skip unused objects
> | (which then may have extra instances of variables).
> | Err, no.  I actually thought this was supported by C (i.e., have COMMON
> | objects).  Since this may be an (infrequent) source of errors, we might
> | want to check specifically for this..
> | Will look closer later.
> | Ralf
> 
> Just to follow up, so I don't forget.

:)

> The common refers to the variable v1 not beint initialized.

ACK.  I know.

> i.e. it is "int v1;" rather than "int v1=0;" the latter would put it
> in a different section,

Yes, precisely.

> but would still trigger the multiple definition error, as v1 is declared in
> both main and as.c. I am almost certain that this is not supported by the
> standards, but would be happy enough to be proven wrong.

No, you are right on this (the C standard does not allow definitions in
several translation units).

> One or other needs
> an extern.

Oh well.  I was seduced by GNUish features here.  I just thought the
Fortran COMMON stuff (which I believe is supported by its standards)
would be what compiler would use for C's tentative definition stuff as
well (and so a cheap test for another feature here).

> If you intended to test this then we need to look at making this test
> conditional on OS.

Nope, removing this.  I've checked in the following trivial patch.

Thanks,
Ralf

        * tests/stresstest.at: Remove multiple variable definition.

Index: tests/stresstest.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/stresstest.at,v
retrieving revision 1.1
diff -u -r1.1 stresstest.at
--- tests/stresstest.at 4 Feb 2005 14:51:53 -0000       1.1
+++ tests/stresstest.at 8 Mar 2005 13:41:34 -0000
@@ -59,7 +59,7 @@
 ]])
 
 AT_DATA(main.c,
-[[int v1;
+[[extern int v1;
 extern int v3, v4;
 extern const int v5, v6;
 extern const char* v7;
@@ -82,7 +82,7 @@
 ]])
 
 AT_DATA(dlself.c,
-[[int v1;
+[[extern int v1;
 extern int v3, v4;
 extern const int v5, v6;
 extern const char* v7;
@@ -95,7 +95,7 @@
 typedef struct { int arr[1000]; } large;
 extern large v13, v14, v15;
 
-int w1;
+extern int w1;
 extern int w3, w4;
 extern const int w5, w6;
 extern const char* w7;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]