[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/4646] New: TOC entries could be merged
From: |
pinskia at gcc dot gnu dot org |
Subject: |
[Bug ld/4646] New: TOC entries could be merged |
Date: |
15 Jun 2007 02:24:07 -0000 |
Take the two simple sources:
t.c:
extern int t;
int f1(void)
{
return t;
}
int main(void)
{
return f() + f1();
}
t1.c:
int t;
int f(void)
{
return t;
}
-------------------
When we compile (and link) them, we get:
00000000100004b0 <.f1>:
100004b0: e9 22 80 38 ld r9,-32712(r2)
100004b4: e8 69 00 02 lwa r3,0(r9)
100004b8: 4e 80 00 20 blr
....
0000000010000520 <.f>:
10000520: e9 22 80 40 ld r9,-32704(r2)
10000524: e8 69 00 02 lwa r3,0(r9)
10000528: 4e 80 00 20 blr
Notice how the offsets of r2 are different though they reference the
same variable? This is a problem only for across objects.
If I change main to use the global variable t also, I get:
100004f0: e9 22 80 38 ld r9,-32712(r2)
inside main
so main and f1 have the same TOC entry for the variable t.
GNU ld version 2.17.50 20070213
--
Summary: TOC entries could be merged
Product: binutils
Version: 2.18 (HEAD)
Status: NEW
Severity: normal
Priority: P2
Component: ld
AssignedTo: unassigned at sources dot redhat dot com
ReportedBy: pinskia at gcc dot gnu dot org
CC: bug-binutils at gnu dot org
GCC target triplet: powerpc64-linux-gnu
http://sourceware.org/bugzilla/show_bug.cgi?id=4646
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
- [Bug ld/4646] New: TOC entries could be merged,
pinskia at gcc dot gnu dot org <=