Bug#944380: GDC generates duplicate symbols when using mixins/interfaces
- To: 944380@bugs.debian.org
- Cc: Matthias Klose <doko@debian.org>, mak@debian.org
- Subject: Bug#944380: GDC generates duplicate symbols when using mixins/interfaces
- From: Iain Buclaw <ibuclaw@gdcproject.org>
- Date: Mon, 16 Mar 2020 22:43:24 +0100
- Message-id: <[🔎] bb242e4f-892d-eedc-b145-65648935111b@gdcproject.org>
- Reply-to: Iain Buclaw <ibuclaw@gdcproject.org>, 944380@bugs.debian.org
- In-reply-to: <7493b253-983e-2e20-5f2a-657dae7fced1@debian.org>
- References: <CAKNHny8cn8_Mutwa3ni6m1de-yBRmMrvrWzjBmSZpPgEvpZBfQ@mail.gmail.com> <002afd6c-7e6c-a75d-1ac3-1b29a8ad68e5@debian.org> <CAKNHny_m6LFJxS+i5E+uXLRyKQ+z09JsE+0JQr54a38cSTRhqw@mail.gmail.com> <CAKNHny8cn8_Mutwa3ni6m1de-yBRmMrvrWzjBmSZpPgEvpZBfQ@mail.gmail.com> <v_OjlkV1tCk1ymbqoRsXLoflsAZQ7C_omRj6OAzFGKryfKPpmsDTO8DSbt5pPGKY5Qbr0eKTw5OilNlA9yv45Q==@protonmail.internalid> <KmaUe0NVixtq20fT6X_TiDibgx8lI3grA1wkGpHCHwcnw3BQmfr5nYe-Zj8tcyYCoXwUoGRTmSwhvIB_ZDg24g==@protonmail.conversationid> <7493b253-983e-2e20-5f2a-657dae7fced1@debian.org> <CAKNHny8cn8_Mutwa3ni6m1de-yBRmMrvrWzjBmSZpPgEvpZBfQ@mail.gmail.com>
On 09/11/2019 17:05, Matthias Klose wrote:
>
> On 09.11.19 16:53, Matthias Klumpp wrote:
>> Am Sa., 9. Nov. 2019 um 16:04 Uhr schrieb Matthias Klose <doko@debian.org>:
>>>
>>> Control: found -1 9.2.1-16
>>> Control: severity -1 important
>>>
>>> according to the upstream report, also with 9.2.0.
>>>
>>> On 08.11.19 23:18, Matthias Klumpp wrote:
>>>> Package: gdc-9
>>>> Version: 9.2.1-17
>>>> Severity: serious
>>>>
>>>> Hi!
>>>> Currently, GDC can't build package like gtk-d because it generates
>>>> duplicate non-weak symbols in object files, causing a collision when
>>>> linking. This seems to happen when using mixins / interfaces.
>>>> For more information and a workaround, please check the upstream bug report.
>>>
>>> if there's a workaround, please don't set the severity to serious.
>>
>> The workaround needs to be applied to GDC, there is nothing we can do
>> in the affected packages. I also haven't tested the workaround and it
>> doesn't look like a good solution to me.
>> So, since this is breaking other packages, a high severity seemed justified.
>
> Ahh, ok, that wasn't clear to me from the initial report. Anyway, the issue is
> present in testing as well, so lets wait for a reply from upstream.
>
Hi, this patch is fine for the reduced test raised in gcc-bugzilla.
I'll commit it to mainline, but would be interested to know if it addresses the wider gtk-d problem.
diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc
index 3824060feb9..7afb1aa0292 100644
--- a/gcc/d/decl.cc
+++ b/gcc/d/decl.cc
@@ -1803,8 +1803,11 @@ make_thunk (FuncDeclaration *decl, int offset)
DECL_CONTEXT (thunk) = d_decl_context (decl);
- /* Thunks inherit the public access of the function they are targetting. */
- TREE_PUBLIC (thunk) = TREE_PUBLIC (function);
+ /* Thunks inherit the public access of the function they are targetting.
+ When the function is outside the current compilation unit however, then the
+ thunk must be kept private to not conflict. */
+ TREE_PUBLIC (thunk) = TREE_PUBLIC (function) && !DECL_EXTERNAL (function);
+
DECL_EXTERNAL (thunk) = 0;
/* Thunks are always addressable. */
Reply to: