public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/11817] New: vargs produce 32 bit signed reference with -mcmodel=medium
@ 2003-08-06  1:03 hoffman at cray dot com
  2003-08-07  3:04 ` [Bug target/11817] " pinskia at physics dot uc dot edu
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: hoffman at cray dot com @ 2003-08-06  1:03 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11817

           Summary: vargs produce 32 bit signed reference with -
                    mcmodel=medium
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hoffman at cray dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu

the following snippet of code:

void foo(int a,...)
{
}

produces relocation entries as:

Relocation section '.rela.text' at offset 0x4f8 contains 1 entries:
  Offset          Info           Type           Sym. Value    Sym. Name + Addend
00000000004b  00020000000b R_X86_64_32S      0000000000000000 .text + 83

Relocation section '.rela.eh_frame' at offset 0x510 contains 1 entries:
  Offset          Info           Type           Sym. Value    Sym. Name + Addend
000000000020  000200000001 R_X86_64_64       0000000000000000 .text + 0

which defeats the purpose of using -mcmodel=medium. the intent here
is to link an executable at text=0x80000000, and the signed 32 bit relocation
causes the linker to puke.

-mcmodel=medium does express all other relocations as R_X86_64_64
(except .debug)


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

* [Bug target/11817] vargs produce 32 bit signed reference with -mcmodel=medium
  2003-08-06  1:03 [Bug c/11817] New: vargs produce 32 bit signed reference with -mcmodel=medium hoffman at cray dot com
@ 2003-08-07  3:04 ` pinskia at physics dot uc dot edu
  2003-08-07 21:53 ` hoffman at cray dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-07  3:04 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11817


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |target


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

* [Bug target/11817] vargs produce 32 bit signed reference with -mcmodel=medium
  2003-08-06  1:03 [Bug c/11817] New: vargs produce 32 bit signed reference with -mcmodel=medium hoffman at cray dot com
  2003-08-07  3:04 ` [Bug target/11817] " pinskia at physics dot uc dot edu
@ 2003-08-07 21:53 ` hoffman at cray dot com
  2003-08-08  0:07 ` hoffman at cray dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: hoffman at cray dot com @ 2003-08-07 21:53 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11817



------- Additional Comments From hoffman at cray dot com  2003-08-07 21:53 -------
the following assembly (which is trimmed down from the mmx spill code 
inserted into the routine using varargs) fed into the x86_64 assembler
results in the unwanted relocation:

	   movq    $.L2, -192(%rbp)
   .L2:

so this seems a gas/binutils issue


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

* [Bug target/11817] vargs produce 32 bit signed reference with -mcmodel=medium
  2003-08-06  1:03 [Bug c/11817] New: vargs produce 32 bit signed reference with -mcmodel=medium hoffman at cray dot com
  2003-08-07  3:04 ` [Bug target/11817] " pinskia at physics dot uc dot edu
  2003-08-07 21:53 ` hoffman at cray dot com
@ 2003-08-08  0:07 ` hoffman at cray dot com
  2003-08-23 18:32 ` pinskia at gcc dot gnu dot org
  2003-09-01  5:24 ` hubicka at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: hoffman at cray dot com @ 2003-08-08  0:07 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11817



------- Additional Comments From hoffman at cray dot com  2003-08-08 00:07 -------

  -mcmodel changes the way that all references requiring 
   relocation are coded, causing the assembler to produce
   the correct code. 'medium' mode introduces an intermediate
   64 bit register to store the address

  the presence of varargs in a function on 64 bit causes a spill 
  of the mmx registers, conditional on another register being
  nonzero (as defined in the x86_64 abi)

  this spill is handled by ix86_setup_incoming_varags in
  gcc/config/i386/i386.c

  this calls a pseudo-instruction, see_prologue_save_insn
  in gcc/config/i386/i386.md

  the generation of the computed target at the end of the
  jump doesn't follow the game generation rule as normal
  references, and forces the compiler to issue the signed
  32 bit reference, which screws up our link


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

* [Bug target/11817] vargs produce 32 bit signed reference with -mcmodel=medium
  2003-08-06  1:03 [Bug c/11817] New: vargs produce 32 bit signed reference with -mcmodel=medium hoffman at cray dot com
                   ` (2 preceding siblings ...)
  2003-08-08  0:07 ` hoffman at cray dot com
@ 2003-08-23 18:32 ` pinskia at gcc dot gnu dot org
  2003-09-01  5:24 ` hubicka at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-23 18:32 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11817


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4                         |---


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

* [Bug target/11817] vargs produce 32 bit signed reference with -mcmodel=medium
  2003-08-06  1:03 [Bug c/11817] New: vargs produce 32 bit signed reference with -mcmodel=medium hoffman at cray dot com
                   ` (3 preceding siblings ...)
  2003-08-23 18:32 ` pinskia at gcc dot gnu dot org
@ 2003-09-01  5:24 ` hubicka at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: hubicka at gcc dot gnu dot org @ 2003-09-01  5:24 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11817


hubicka at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


------- Additional Comments From hubicka at gcc dot gnu dot org  2003-09-01 05:24 -------
-mcmodel=medium is not supposed to allow linking of code into upper addresses.  As defined in the psABI document, it allows only data segment to contain references in upper places.  For linking on such addresses use either -mcmodel=kernel or -fPIC


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

end of thread, other threads:[~2003-09-01  5:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-06  1:03 [Bug c/11817] New: vargs produce 32 bit signed reference with -mcmodel=medium hoffman at cray dot com
2003-08-07  3:04 ` [Bug target/11817] " pinskia at physics dot uc dot edu
2003-08-07 21:53 ` hoffman at cray dot com
2003-08-08  0:07 ` hoffman at cray dot com
2003-08-23 18:32 ` pinskia at gcc dot gnu dot org
2003-09-01  5:24 ` hubicka at gcc dot gnu dot org

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).