public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "tmsriram at google dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/63538] New: [X86_64] With -mcmodel=medium .lrodata accesses do not use 64-bit addresses Date: Tue, 14 Oct 2014 20:14:00 -0000 [thread overview] Message-ID: <bug-63538-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63538 Bug ID: 63538 Summary: [X86_64] With -mcmodel=medium .lrodata accesses do not use 64-bit addresses Product: gcc Version: 5.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 foo.cc ====== #include <stdio.h> const char *str = "Hello World"; int main() { printf("str = %p %s\n",str, str); return 0; } $ g++ --save-temps foo.cc -mcmodel=medium -mlarge-data-threshold=0 -O2 Linked with gold linker. Look at foo.s: =========== .section .lrodata,"a",@progbits .LC0: .string "str = %p %s\n" ..... main: ... movl $.LC0, %edi This is the problem, it treats .LC0 as a 32-bit address when it should a 64-bit address since it is placed in .lrodata Now this bug will not manifest until .lrodata exceeds the 2GB limit. That can be done by linking with -Wl,-Ttext=0x7ffff000 which moves the start address of .text to be very close to 2GB and enough to throw .lrodata out of the limit. Program segfaults.
next reply other threads:[~2014-10-14 20:14 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-10-14 20:14 tmsriram at google dot com [this message] 2014-11-03 20:46 ` [Bug target/63538] " ubizjak at gmail dot com 2014-11-05 21:00 ` uros at gcc dot gnu.org 2014-11-05 22:23 ` uros at gcc dot gnu.org 2014-11-05 22:25 ` ubizjak at gmail dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-63538-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).