Re: [Mingw-w64-public] Duplicate symbols definition in between uuid.c and extra-uuid.c

2017-05-02 Thread Kai Tietz
Ok, thanks for trying to get the reasoning, why we didn't marked it as
selectany.  So I think it is time to add this selectany to our master,
and see if we get really any issues reported for it.
The only scenario I am concerned about is user-defined, library
defined.  As prototypes are changing, and it might be that gcc sees
selectany to some extend as ABI-relevant and errors out.

Regards,
Kai

2017-05-02 7:57 GMT+02:00 Liu Hao :
> On 2017/5/2 12:04, David Grayson wrote:
>> Thanks for the info.
>>
>> I used "git blame" on guiddef.h and it looks like the logic has been the
>> same since 2007.  I don't see any sign that Kai removed the
>> DECLSPEC_SELECTANY from the GUID declarations, as far as I know it was just
>> always missing.
>>
>> So the code has been the same for 10 years, but then two people have
>> complained about it on the mailing list in the last week.  Perhaps there
>> was a change in GCC that made it start ignoring certain attributes on
>> variable definitions if the attributes were not present on the declaration.
>>
>> Tomay: are you able to apply my patch, rebuild your mingw-w64 libraries,
>> and see if it fixes your issue?  If you can't do that, could you tell me
>> what the steps are to reproduce your issue so I can see whether the patch
>> helps?
>>
>> Will the patch get merged if I try to reproduce the problem Kai mentioned
>> about having a GUID collision and I fail to reproduce it?
> Again, I am considering about removing duplicate definitions of
> UUIDs/GUIDs as the 'real' resolution. But before doing that I _have to_
> understand why those duplicates have been there.
>
>
> --
> Best regards,
> LH_Mouse
>
>
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Duplicate symbols definition in between uuid.c and extra-uuid.c

2017-05-02 Thread Liu Hao
On 2017/5/2 12:04, David Grayson wrote:
> Thanks for the info.
>
> I used "git blame" on guiddef.h and it looks like the logic has been the
> same since 2007.  I don't see any sign that Kai removed the
> DECLSPEC_SELECTANY from the GUID declarations, as far as I know it was just
> always missing.
>
> So the code has been the same for 10 years, but then two people have
> complained about it on the mailing list in the last week.  Perhaps there
> was a change in GCC that made it start ignoring certain attributes on
> variable definitions if the attributes were not present on the declaration.
>
> Tomay: are you able to apply my patch, rebuild your mingw-w64 libraries,
> and see if it fixes your issue?  If you can't do that, could you tell me
> what the steps are to reproduce your issue so I can see whether the patch
> helps?
>
> Will the patch get merged if I try to reproduce the problem Kai mentioned
> about having a GUID collision and I fail to reproduce it?
Again, I am considering about removing duplicate definitions of 
UUIDs/GUIDs as the 'real' resolution. But before doing that I _have to_ 
understand why those duplicates have been there.


-- 
Best regards,
LH_Mouse


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Duplicate symbols definition in between uuid.c and extra-uuid.c

2017-05-01 Thread David Grayson
Thanks for the info.

I used "git blame" on guiddef.h and it looks like the logic has been the
same since 2007.  I don't see any sign that Kai removed the
DECLSPEC_SELECTANY from the GUID declarations, as far as I know it was just
always missing.

So the code has been the same for 10 years, but then two people have
complained about it on the mailing list in the last week.  Perhaps there
was a change in GCC that made it start ignoring certain attributes on
variable definitions if the attributes were not present on the declaration.

Tomay: are you able to apply my patch, rebuild your mingw-w64 libraries,
and see if it fixes your issue?  If you can't do that, could you tell me
what the steps are to reproduce your issue so I can see whether the patch
helps?

Will the patch get merged if I try to reproduce the problem Kai mentioned
about having a GUID collision and I fail to reproduce it?

--David Grayson

On Mon, May 1, 2017 at 6:41 PM, Liu Hao  wrote:

> On 2017/5/2 3:08, David Grayson wrote:
> > Oops, I should have learned my lesson.  Well, here it is again.  I think
> my
> > original email 6 days ago was good though.
> I did see the patch and we had a discussion on irc. That attribute
> seemed to have been removed for a reason, which otherwise caused errors.
>
> ```plaintext
> [23:04:42]  jacek ping
> [23:07:02]  do you recall why we removed that selectany from
> GUID definitions?  I remember we did together some time ago, but I can't
> recall it right
> [23:08:33]  as we have a suggestion in ML thread
> "[Mingw-w64-public] [PATCH] guiddef.h: Use __declspec(selectany) on GUID
> declarations."" about adding it
> [23:22:17]  try `git blame` ?
> [23:22:30]  maybe you can find the commit that removed it.
> [23:24:43]  AFAIR this happened already on svn ... in general I
> have to admit that annotation of declspec(selectany) is the right thing,
> but we had some reason for not doing it.
> [23:25:31]  scenario I could think about is, that op code
> defines its own guids without selectany, which would then collide with
> that one with selectany
> ```
>
> --
> Best regards,
> LH_Mouse
>
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Duplicate symbols definition in between uuid.c and extra-uuid.c

2017-05-01 Thread Liu Hao
On 2017/5/2 3:08, David Grayson wrote:
> Oops, I should have learned my lesson.  Well, here it is again.  I think my
> original email 6 days ago was good though.
I did see the patch and we had a discussion on irc. That attribute 
seemed to have been removed for a reason, which otherwise caused errors.

```plaintext
[23:04:42]  jacek ping
[23:07:02]  do you recall why we removed that selectany from 
GUID definitions?  I remember we did together some time ago, but I can't 
recall it right
[23:08:33]  as we have a suggestion in ML thread 
"[Mingw-w64-public] [PATCH] guiddef.h: Use __declspec(selectany) on GUID 
declarations."" about adding it
[23:22:17]  try `git blame` ?
[23:22:30]  maybe you can find the commit that removed it.
[23:24:43]  AFAIR this happened already on svn ... in general I 
have to admit that annotation of declspec(selectany) is the right thing, 
but we had some reason for not doing it.
[23:25:31]  scenario I could think about is, that op code 
defines its own guids without selectany, which would then collide with 
that one with selectany
```

-- 
Best regards,
LH_Mouse


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Duplicate symbols definition in between uuid.c and extra-uuid.c

2017-05-01 Thread David Grayson
Oops, I should have learned my lesson.  Well, here it is again.  I think my
original email 6 days ago was good though.

--David

On Mon, May 1, 2017 at 11:47 AM, Ruben Van Boxem 
wrote:

> Your attachment was eaten by the Sourceforge cookie monster :)
>
>
>
> 2017-05-01 18:55 GMT+02:00 David Grayson :
>
> > I sent a patch to this list 6 days ago that fixes a problem with the way
> we
> > use the selectany attribute.  If you're getting multiple definition
> errors
> > for GUIDs, this will probably fix it.  I'll attach it again.
> >
> > --David
> >
> > On Mon, May 1, 2017 at 9:34 AM, Mateusz Mikuła 
> wrote:
> >
> > > Symbols in libuuid.a are definitely duplicated, tested on MSYS2,
> Ubuntu,
> > > Arch:
> > >
> > > nm '/usr/x86_64-w64-mingw32/lib/libuuid.a' | grep FileProtocol
> > >  R CLSID_FileProtocol
> > >  r .rdata$CLSID_FileProtocol
> > > 00f0 R CLSID_FileProtocol
> > >
> > > Here is disassembly of first duplicated symbol from Ubuntu:
> > > https://paste.ubuntu.com/24493619/
> > >
> > >
> > > 2017-05-01 18:03 GMT+02:00 Liu Hao :
> > >
> > > > On 2017/5/1 21:27, Tomay wrote:
> > > > > The following UUIDs are defined in both *uuid.c* and *extra-uuid.c*
> > > > source
> > > > > files, whitch leads to linking errors with duplicate symbols when
> > using
> > > > > *libuuid.a*
> > > > >
> > > > In my opinion it is practically incorrect, but you shouldn't get
> linker
> > > > errors because the macro `INITGUID` is defined in both files hence
> each
> > > > GUID definition is marked with the `selectany` attribute (see
> > definition
> > > > of the macro `DEFINE_GUID` in [guiddef.h]).
> > > >
> > > > --
> > > > Best regards,
> > > > LH_Mouse
> > > >
> > > >
> > > > 
> > > > --
> > > > Check out the vibrant tech community on one of the world's most
> > > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > > > ___
> > > > Mingw-w64-public mailing list
> > > > Mingw-w64-public@lists.sourceforge.net
> > > > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
> > > >
> > > 
> > > --
> > > Check out the vibrant tech community on one of the world's most
> > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > > ___
> > > Mingw-w64-public mailing list
> > > Mingw-w64-public@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
> > >
> >
> > 
> > --
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > ___
> > Mingw-w64-public mailing list
> > Mingw-w64-public@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
> >
> >
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
From 7ce782720ce2190442bd835518ebc63e246b0050 Mon Sep 17 00:00:00 2001
From: David Grayson 
Date: Tue, 25 Apr 2017 07:41:45 -0700
Subject: [PATCH] guiddef.h: Use __declspec(selectany) on GUID declarations.

If __declspec(selectany) is not used on the prototype but later used
on a definition, GCC seems to ignore it, and you can get
multiple-definition errors at link time.

That situation can arise in code like Microsoft's usbview utility that
has multiple translation units including the following headers in this
order:  windows.h, initguid.h, winioctl.h.
---
 mingw-w64-headers/include/guiddef.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mingw-w64-headers/include/guiddef.h 
b/mingw-w64-headers/include/guiddef.h
index 8d0af1ed..6c9444cf 100644
--- a/mingw-w64-headers/include/guiddef.h
+++ b/mingw-w64-headers/include/guiddef.h
@@ -55,13 +55,13 @@ __extension__ template const GUID 
&__mingw_uuidof();
 #ifdef __cplusplus
 #define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) EXTERN_C const GUID 
DECLSPEC_SELECTANY name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
 #else
 #define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) const GUID 
DECLSPEC_SELECTANY name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
 #endif
 #else
-#define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) EXTERN_C const GUID 
name
+#define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) EXTERN_C const 

Re: [Mingw-w64-public] Duplicate symbols definition in between uuid.c and extra-uuid.c

2017-05-01 Thread Ruben Van Boxem
Your attachment was eaten by the Sourceforge cookie monster :)



2017-05-01 18:55 GMT+02:00 David Grayson :

> I sent a patch to this list 6 days ago that fixes a problem with the way we
> use the selectany attribute.  If you're getting multiple definition errors
> for GUIDs, this will probably fix it.  I'll attach it again.
>
> --David
>
> On Mon, May 1, 2017 at 9:34 AM, Mateusz Mikuła  wrote:
>
> > Symbols in libuuid.a are definitely duplicated, tested on MSYS2, Ubuntu,
> > Arch:
> >
> > nm '/usr/x86_64-w64-mingw32/lib/libuuid.a' | grep FileProtocol
> >  R CLSID_FileProtocol
> >  r .rdata$CLSID_FileProtocol
> > 00f0 R CLSID_FileProtocol
> >
> > Here is disassembly of first duplicated symbol from Ubuntu:
> > https://paste.ubuntu.com/24493619/
> >
> >
> > 2017-05-01 18:03 GMT+02:00 Liu Hao :
> >
> > > On 2017/5/1 21:27, Tomay wrote:
> > > > The following UUIDs are defined in both *uuid.c* and *extra-uuid.c*
> > > source
> > > > files, whitch leads to linking errors with duplicate symbols when
> using
> > > > *libuuid.a*
> > > >
> > > In my opinion it is practically incorrect, but you shouldn't get linker
> > > errors because the macro `INITGUID` is defined in both files hence each
> > > GUID definition is marked with the `selectany` attribute (see
> definition
> > > of the macro `DEFINE_GUID` in [guiddef.h]).
> > >
> > > --
> > > Best regards,
> > > LH_Mouse
> > >
> > >
> > > 
> > > --
> > > Check out the vibrant tech community on one of the world's most
> > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > > ___
> > > Mingw-w64-public mailing list
> > > Mingw-w64-public@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
> > >
> > 
> > --
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > ___
> > Mingw-w64-public mailing list
> > Mingw-w64-public@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
> >
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Duplicate symbols definition in between uuid.c and extra-uuid.c

2017-05-01 Thread David Grayson
I sent a patch to this list 6 days ago that fixes a problem with the way we
use the selectany attribute.  If you're getting multiple definition errors
for GUIDs, this will probably fix it.  I'll attach it again.

--David

On Mon, May 1, 2017 at 9:34 AM, Mateusz Mikuła  wrote:

> Symbols in libuuid.a are definitely duplicated, tested on MSYS2, Ubuntu,
> Arch:
>
> nm '/usr/x86_64-w64-mingw32/lib/libuuid.a' | grep FileProtocol
>  R CLSID_FileProtocol
>  r .rdata$CLSID_FileProtocol
> 00f0 R CLSID_FileProtocol
>
> Here is disassembly of first duplicated symbol from Ubuntu:
> https://paste.ubuntu.com/24493619/
>
>
> 2017-05-01 18:03 GMT+02:00 Liu Hao :
>
> > On 2017/5/1 21:27, Tomay wrote:
> > > The following UUIDs are defined in both *uuid.c* and *extra-uuid.c*
> > source
> > > files, whitch leads to linking errors with duplicate symbols when using
> > > *libuuid.a*
> > >
> > In my opinion it is practically incorrect, but you shouldn't get linker
> > errors because the macro `INITGUID` is defined in both files hence each
> > GUID definition is marked with the `selectany` attribute (see definition
> > of the macro `DEFINE_GUID` in [guiddef.h]).
> >
> > --
> > Best regards,
> > LH_Mouse
> >
> >
> > 
> > --
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > ___
> > Mingw-w64-public mailing list
> > Mingw-w64-public@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
> >
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Duplicate symbols definition in between uuid.c and extra-uuid.c

2017-05-01 Thread Mateusz Mikuła
Symbols in libuuid.a are definitely duplicated, tested on MSYS2, Ubuntu,
Arch:

nm '/usr/x86_64-w64-mingw32/lib/libuuid.a' | grep FileProtocol
 R CLSID_FileProtocol
 r .rdata$CLSID_FileProtocol
00f0 R CLSID_FileProtocol

Here is disassembly of first duplicated symbol from Ubuntu:
https://paste.ubuntu.com/24493619/


2017-05-01 18:03 GMT+02:00 Liu Hao :

> On 2017/5/1 21:27, Tomay wrote:
> > The following UUIDs are defined in both *uuid.c* and *extra-uuid.c*
> source
> > files, whitch leads to linking errors with duplicate symbols when using
> > *libuuid.a*
> >
> In my opinion it is practically incorrect, but you shouldn't get linker
> errors because the macro `INITGUID` is defined in both files hence each
> GUID definition is marked with the `selectany` attribute (see definition
> of the macro `DEFINE_GUID` in [guiddef.h]).
>
> --
> Best regards,
> LH_Mouse
>
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Duplicate symbols definition in between uuid.c and extra-uuid.c

2017-05-01 Thread Liu Hao
On 2017/5/1 21:27, Tomay wrote:
> The following UUIDs are defined in both *uuid.c* and *extra-uuid.c* source
> files, whitch leads to linking errors with duplicate symbols when using
> *libuuid.a*
>
In my opinion it is practically incorrect, but you shouldn't get linker 
errors because the macro `INITGUID` is defined in both files hence each 
GUID definition is marked with the `selectany` attribute (see definition 
of the macro `DEFINE_GUID` in [guiddef.h]).

-- 
Best regards,
LH_Mouse


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] Duplicate symbols definition in between uuid.c and extra-uuid.c

2017-05-01 Thread Tomay
The following UUIDs are defined in both *uuid.c* and *extra-uuid.c* source
files, whitch leads to linking errors with duplicate symbols when using
*libuuid.a*

// file: local: Asychronous Pluggable Protocol Handler CLSID
DEFINE_GUID(CLSID_FileProtocol,0x79eac9e7,0xbaf9,0x11ce,0x8c,0x82,0,0xaa,0,0x4b,0xa9,0xb);
// ftp: Asychronous Pluggable Protocol Handler CLSID
DEFINE_GUID(CLSID_FtpProtocol,0x79eac9e3,0xbaf9,0x11ce,0x8c,0x82,0,0xaa,0,0x4b,0xa9,0xb);
// gopher: Asychronous Pluggable Protocol Handler CLSID
DEFINE_GUID(CLSID_GopherProtocol,0x79eac9e4,0xbaf9,0x11ce,0x8c,0x82,0,0xaa,0,0x4b,0xa9,0xb);
// http: Asychronous Pluggable Protocol Handler CLSID
DEFINE_GUID(CLSID_HttpProtocol,0x79eac9e2,0xbaf9,0x11ce,0x8c,0x82,0,0xaa,0,0x4b,0xa9,0xb);
// https: Asychronous Pluggable Protocol Handler CLSID
DEFINE_GUID(CLSID_HttpSProtocol,0x79eac9e5,0xbaf9,0x11ce,0x8c,0x82,0,0xaa,0,0x4b,0xa9,0xb);
// mk: Asychronous Pluggable Protocol Handler CLSID
DEFINE_GUID(CLSID_MkProtocol,0x79eac9e6,0xbaf9,0x11ce,0x8c,0x82,0,0xaa,0,0x4b,0xa9,0xb);
// URLMoniker ProxyStub Factory CLSID
DEFINE_GUID(CLSID_PSUrlMonProxy,0x79eac9f1,0xbaf9,0x11ce,0x8c,0x82,0,0xaa,0,0x4b,0xa9,0xb);
// URL Moniker CLSID
DEFINE_GUID(CLSID_StdURLMoniker,0x79eac9e0,0xbaf9,0x11ce,0x8c,0x82,0,0xaa,0,0x4b,0xa9,0xb);
-
Thank you for your understanding.
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public