This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Question about strange register calling truncates to SImode on x86_64


Hello,

I am currently on to build the gcc target support for x86_64-pc-mingw64. 
While this porting I found a strange register truncation, I do not believe 
it is valid. For the c code:

        int foo(char *,...);
        int doo(char *h) { return foo("abc ",h); }

compiled result ->

        .file   ""
 doo    .section .rdata,"dr"
LC0:
        .ascii "abc \0"
        .text
.globl _doo
        .def    _doo;   .scl    2;      .type   32;     .endef
_doo:
LFB2:
        pushq   %rbp
LCFI0:
        movq    %rsp, %rbp
LCFI1:
        subq    $16, %rsp
LCFI2:
        movq    %rcx, -8(%rbp)
        movq    -8(%rbp), %rdx
        movl    $LC0, %ecx
        movl    $0, %eax
        call    _foo
...

It leads to a symbol ref to "abc", which is passed to function foo on 
calling via a 32 bit register. This behaviour seems to be wrong, because 
if the base adress of the code segment gets out-side of 2^32 the 
relocation will be incorrect for sure. May somebody can help if my 
thoughts are wrong or not ...

Regards,
 i.A. Kai Tietz


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]