public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/61599] New: [x86_64] With -mcmodel=medium, extern global arrays without size are not treated conservatively.
@ 2014-06-24 17:32 tmsriram at google dot com
  2014-07-09  0:51 ` [Bug target/61599] " tmsriram at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: tmsriram at google dot com @ 2014-06-24 17:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61599

            Bug ID: 61599
           Summary: [x86_64] With -mcmodel=medium, extern global arrays
                    without size are not treated conservatively.
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tmsriram at google dot com
                CC: davidxl at google dot com, ppluzhnikov at google dot com

foo.cc
======

char c[1*1024*1024*1024];

extern int bar();
int main()
{
  return bar() + c[225];
}

bar.cc
======
extern char c[];

int bar()
{
  return c[225];
}


$ g++ -mcmodel=medium foo.cc bar.cc -fdata-sections
BFD linker warns:
bar.cc:(.text+0x7): relocation truncated to fit: R_X86_64_PC32 against symbol
`c' defined in .lbss.c section in foo.o

Reason is the compiler does not treat 'c' conservatively as being in .lbss when
it does not know its size. Worse, adding -mlarge-data-threshold=0 still does
not solve the problem.

Changing the declaration "extern char c[]" to "extern char c[1*1024*1024*1024]"
solves the problem.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-01-30 20:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-24 17:32 [Bug target/61599] New: [x86_64] With -mcmodel=medium, extern global arrays without size are not treated conservatively tmsriram at google dot com
2014-07-09  0:51 ` [Bug target/61599] " tmsriram at gcc dot gnu.org
2014-09-16 17:51 ` tmsriram at google dot com
2015-01-30 20:00 ` ubizjak at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).