[llvm] r219829 - Correctly handle references to section symbols.
Rui Ueyama
ruiu at google.com
Thu Oct 16 17:19:36 PDT 2014
Rafael,
This is a test case. Clang now miscompiles this code. As a result it will
print out "i=0 j=1" while it should be "i=1 j=1". Let me roll back this
change to fix the issue.
#include <iostream>
static int i = 0;
static int j = 0;
class C {
public:
C() { i++; }
};
template<typename T>
class D {
public:
D() { j++; }
C *f() { return &x; }
static C x;
};
template<typename T> C D<T>::x;
int main() {
D<void> d;
d.f();
std::cout << "i=" << i << " j=" << j << "\n";
}
On Thu, Oct 16, 2014 at 3:24 PM, Rui Ueyama <ruiu at google.com> wrote:
> Previously, relocations applied to .rela.ctors sections in an object file
> pointed to different .text.startup sections in the same file, but after
> this patch they point to the same .text.startup section. Because this patch
> handles section names, it's likely that there's something with that.
>
> Sorry for the frequent and incomplete updates. I'll let you know once I
> get a reproducible test case.
>
> On Thu, Oct 16, 2014 at 2:43 PM, Rui Ueyama <ruiu at google.com> wrote:
>
>> On Thu, Oct 16, 2014 at 2:40 PM, Rafael EspĂndola <
>> rafael.espindola at gmail.com> wrote:
>>
>>> > I compared the DSOs built with and without this patch, and found that
>>> > although the size of .ctor sections are the same, the bad DSO contains
>>> > repetition. So some constructors are called more than once (and
>>> probably
>>> > some are not called at all). That seems the direct cause of the issue.
>>> >
>>> > The test is gigantic and having a lot of dependencies. It takes a
>>> little bit
>>> > more time to understand what's going on there.
>>>
>>> Is it open source? I would be more than happy to help reduce it.
>>>
>>
>> Sorry, no it's not. I'll try to create a minimal test case to reproduce
>> the issue.
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141016/b2aaf34b/attachment.html>
More information about the llvm-commits
mailing list