D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5774 - [64 bit] "relocation truncated to fit" with __gshared array, while(), and $
Summary: [64 bit] "relocation truncated to fit" with __gshared array, while(), and $
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Linux
: P2 normal
Assignee: No Owner
URL:
Keywords: link-failure, rejects-valid
Depends on:
Blocks:
 
Reported: 2011-03-23 14:40 UTC by Don
Modified: 2012-05-22 06:06 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Don 2011-03-23 14:40:09 UTC
Cut down from a failure in core.cpuid. With all of the build problems with druntime at the moment I'm not able to get any normal file to build on 64bits; but this is the relevant case from the runtime build. This probably needs -O -release, since it goes away if I replace 'while' with 'if'; but I haven't checked which flags are actually necessary.

=============
__gshared char[48] dish;
void foo()
{
 int end = 0;
 while (dish[$-end-1]==0) { ++end; }
}
===========
src/core/cpuid.d:(.text._D4core5cpuid3fooFZv+0x9): relocation truncated to fit: R_X86_64_PC32 against symbol `_D4core5cpuid4dishG48a' defined in .data section in obj/core/cpuid.o
Comment 1 Don 2012-05-22 06:06:01 UTC
I can no longer reproduce this bug. I can revert the workaround, and the code still links. I presume the root cause was fixed shortly after this bug was filed.