Bug#691371: marked as done (Broken COPY relocation with UNIQUE symbols (upstream #12510))
Your message dated Thu, 17 Dec 2015 19:47:47 +0100
with message-id <20151217184747.GA16848@aurel32.net>
and subject line Re: Bug#691371: Broken COPY relocation with UNIQUE symbols (upstream #12510)
has caused the Debian Bug report #691371,
regarding Broken COPY relocation with UNIQUE symbols (upstream #12510)
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)
--
691371: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=691371
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
- To: submit@bugs.debian.org
- Subject: Broken COPY relocation with UNIQUE symbols (upstream #12510)
- From: James Y Knight <foom@fuhm.net>
- Date: Wed, 24 Oct 2012 16:12:15 -0400
- Message-id: <6CBF35AB-D5CC-48D9-90E1-C384646EEBF2@fuhm.net>
Package: libc6
Version: 2.13-35
I just rediscovered http://sourceware.org/bugzilla/show_bug.cgi?id=12510 in my application. Fixed by http://sourceware.org/git/?p=glibc.git;a=commit;h=028478fa40d85a73b19638dbe3f83b1acebf370c
Attached is the test-case I came up with before I found the commit that fixes it, and then the upstream bug.
This is a regression in wheezy vs squeeze; gcc in squeeze didn't generate UNIQUE symbols (at least for this case), AND the old dynamic linker seems to not have this bug.
The actual code part of that upstream patch applies cleanly to wheezy's libc and fixes the problem. ISTM that it'd be a good idea to backport, given that wheezy isn't going to upgrade to a new upstream release.
==== test.h ====
template<typename X>
class Foo {
public:
static const char foo[];
};
==== test1.cpp ====
#include "test.h"
// Creates a UNIQUE symbol (and thus hits dynamic linker bug), used to
// create a WEAK symbol instead.
template<typename X>
const char Foo<X>::foo[] = "string";
template class Foo<int>;
const char * getone() {
// Creates a R_X86_64_GLOB_DAT relocation
return Foo<int>::foo;
}
==== test2.cpp ====
#include "test.h"
#include <stdio.h>
#include <string.h>
int main() {
// Reference creates a R_X86_64_COPY relocation
if (strcmp(Foo<int>::foo, "string")) {
printf("'%s'\n", Foo<int>::foo);
return 1;
}
return 0;
}
==== test.sh ====
g++ -fPIC -shared -o test.so test1.cpp
g++ -o test test2.cpp ./test.so
./test
--- End Message ---
--- Begin Message ---
- To: James Y Knight <foom@fuhm.net>, 691371-done@bugs.debian.org
- Subject: Re: Bug#691371: Broken COPY relocation with UNIQUE symbols (upstream #12510)
- From: Aurelien Jarno <aurelien@aurel32.net>
- Date: Thu, 17 Dec 2015 19:47:47 +0100
- Message-id: <20151217184747.GA16848@aurel32.net>
- In-reply-to: <6CBF35AB-D5CC-48D9-90E1-C384646EEBF2@fuhm.net>
- References: <6CBF35AB-D5CC-48D9-90E1-C384646EEBF2@fuhm.net>
Version: 2.17-1
On 2012-10-24 16:12, James Y Knight wrote:
> Package: libc6
> Version: 2.13-35
>
> I just rediscovered http://sourceware.org/bugzilla/show_bug.cgi?id=12510 in my application. Fixed by http://sourceware.org/git/?p=glibc.git;a=commit;h=028478fa40d85a73b19638dbe3f83b1acebf370c
>
> Attached is the test-case I came up with before I found the commit that fixes it, and then the upstream bug.
>
> This is a regression in wheezy vs squeeze; gcc in squeeze didn't generate UNIQUE symbols (at least for this case), AND the old dynamic linker seems to not have this bug.
>
> The actual code part of that upstream patch applies cleanly to wheezy's libc and fixes the problem. ISTM that it'd be a good idea to backport, given that wheezy isn't going to upgrade to a new upstream release.
>
> ==== test.h ====
> template<typename X>
> class Foo {
> public:
> static const char foo[];
> };
>
> ==== test1.cpp ====
> #include "test.h"
>
> // Creates a UNIQUE symbol (and thus hits dynamic linker bug), used to
> // create a WEAK symbol instead.
> template<typename X>
> const char Foo<X>::foo[] = "string";
> template class Foo<int>;
>
> const char * getone() {
> // Creates a R_X86_64_GLOB_DAT relocation
> return Foo<int>::foo;
> }
>
> ==== test2.cpp ====
> #include "test.h"
> #include <stdio.h>
> #include <string.h>
>
> int main() {
> // Reference creates a R_X86_64_COPY relocation
> if (strcmp(Foo<int>::foo, "string")) {
> printf("'%s'\n", Foo<int>::foo);
> return 1;
> }
> return 0;
> }
>
>
> ==== test.sh ====
> g++ -fPIC -shared -o test.so test1.cpp
> g++ -o test test2.cpp ./test.so
> ./test
This bug has been fixed in upstream glibc 2.14. I am therefore closing
the bug.
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
aurelien@aurel32.net http://www.aurel32.net
--- End Message ---
Reply to: