public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/66457] New: gcc generates an extra "mov ??, %edx" before "call mcount" when "-pg" is enabled in cross compilation
@ 2015-06-08  9:51 leedypku at gmail dot com
  2015-06-08  9:55 ` [Bug target/66457] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: leedypku at gmail dot com @ 2015-06-08  9:51 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 66457
           Summary: gcc generates an extra "mov ??, %edx" before "call
                    mcount" when "-pg" is enabled in cross compilation
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: leedypku at gmail dot com
  Target Milestone: ---

# On Darwin, with cross compilation, some code omitted
$ echo 'int main(){}' | i386-jos-elf-gcc -pg -m32 -S -x c -o - -
main:
        pushl   %ebp
        movl    %esp, %ebp
.LP0:
        movl    $.LP0,%edx  # this line
        call    _mcount
        popl    %ebp
        ret
        .ident  "GCC: (GNU) 4.9.2"

# On Linux, some code omitted
$ echo 'int main(){}' | gcc -pg -S -m32 -x c -o - -
main:
        pushl   %ebp
        movl    %esp, %ebp
        call    mcount
        popl    %ebp
        ret
        .ident  "GCC: (Ubuntu 4.8.2-19ubuntu1) 4.8.2"


1. It happens only in cross compilation.
2. The target is i386-jos-elf and the host is Darwin.
3. I've tested with GCC version 4.6.1, 4.6.4 and 4.9.2.
4. How can I disable it?


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

* [Bug target/66457] gcc generates an extra "mov ??, %edx" before "call mcount" when "-pg" is enabled in cross compilation
  2015-06-08  9:51 [Bug c/66457] New: gcc generates an extra "mov ??, %edx" before "call mcount" when "-pg" is enabled in cross compilation leedypku at gmail dot com
@ 2015-06-08  9:55 ` pinskia at gcc dot gnu.org
  2015-06-08  9:59 ` leedypku at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-06-08  9:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Which compiler are you using to compile the cross compiler on Darwin?  I can't
tell if you have tried a cross compiler to elf under linux either, only the
native one.


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

* [Bug target/66457] gcc generates an extra "mov ??, %edx" before "call mcount" when "-pg" is enabled in cross compilation
  2015-06-08  9:51 [Bug c/66457] New: gcc generates an extra "mov ??, %edx" before "call mcount" when "-pg" is enabled in cross compilation leedypku at gmail dot com
  2015-06-08  9:55 ` [Bug target/66457] " pinskia at gcc dot gnu.org
@ 2015-06-08  9:59 ` leedypku at gmail dot com
  2015-06-08 10:20 ` leedypku at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: leedypku at gmail dot com @ 2015-06-08  9:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Dangyi Liu <leedypku at gmail dot com> ---
(In reply to Andrew Pinski from comment #1)
> Which compiler are you using to compile the cross compiler on Darwin?  I
> can't tell if you have tried a cross compiler to elf under linux either,
> only the native one.

I compiled the cross compiler using clang. Now I'm trying to reproduce this bug
under Linux.


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

* [Bug target/66457] gcc generates an extra "mov ??, %edx" before "call mcount" when "-pg" is enabled in cross compilation
  2015-06-08  9:51 [Bug c/66457] New: gcc generates an extra "mov ??, %edx" before "call mcount" when "-pg" is enabled in cross compilation leedypku at gmail dot com
  2015-06-08  9:55 ` [Bug target/66457] " pinskia at gcc dot gnu.org
  2015-06-08  9:59 ` leedypku at gmail dot com
@ 2015-06-08 10:20 ` leedypku at gmail dot com
  2015-06-08 10:27 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: leedypku at gmail dot com @ 2015-06-08 10:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Dangyi Liu <leedypku at gmail dot com> ---
This still happens on Linux.

$ echo 'int main(){}' | ./i386-jos-elf-gcc -pg -m32 -S -x c -o - -
main:
        pushl   %ebp
        movl    %esp, %ebp
.LP0:
        movl    $.LP0,%edx
        call    _mcount
        popl    %ebp
.LCFI2:
        ret
        .ident  "GCC: (GNU) 4.8.4"

$ ./i386-jos-elf-gcc -v
Using built-in specs.
COLLECT_GCC=./i386-jos-elf-gcc
COLLECT_LTO_WRAPPER=/home/leedy/gcc-4.8.4/bin/libexec/gcc/i386-jos-elf/4.8.4/lto-wrapper
Target: i386-jos-elf
Configured with: ../configure --prefix=/home/leedy/gcc-4.8.4/bin
--target=i386-jos-elf --disable-werror --disable-libssp --disable-libmudflap
--disable-multilib --disable-nls --without-headers --enable-languages=c
Thread model: single
gcc version 4.8.4 (GCC) 


Did I do something wrong during with the configuration?


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

* [Bug target/66457] gcc generates an extra "mov ??, %edx" before "call mcount" when "-pg" is enabled in cross compilation
  2015-06-08  9:51 [Bug c/66457] New: gcc generates an extra "mov ??, %edx" before "call mcount" when "-pg" is enabled in cross compilation leedypku at gmail dot com
                   ` (2 preceding siblings ...)
  2015-06-08 10:20 ` leedypku at gmail dot com
@ 2015-06-08 10:27 ` pinskia at gcc dot gnu.org
  2015-06-08 10:28 ` pinskia at gcc dot gnu.org
  2015-06-08 13:41 ` leedypku at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-06-08 10:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Yes you don't define  NO_PROFILE_COUNTERS .  That is the default i386-elf
target defaults to NO_PROFILE_COUNTERS not being defined.


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

* [Bug target/66457] gcc generates an extra "mov ??, %edx" before "call mcount" when "-pg" is enabled in cross compilation
  2015-06-08  9:51 [Bug c/66457] New: gcc generates an extra "mov ??, %edx" before "call mcount" when "-pg" is enabled in cross compilation leedypku at gmail dot com
                   ` (3 preceding siblings ...)
  2015-06-08 10:27 ` pinskia at gcc dot gnu.org
@ 2015-06-08 10:28 ` pinskia at gcc dot gnu.org
  2015-06-08 13:41 ` leedypku at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-06-08 10:28 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Invalid as explained.


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

* [Bug target/66457] gcc generates an extra "mov ??, %edx" before "call mcount" when "-pg" is enabled in cross compilation
  2015-06-08  9:51 [Bug c/66457] New: gcc generates an extra "mov ??, %edx" before "call mcount" when "-pg" is enabled in cross compilation leedypku at gmail dot com
                   ` (4 preceding siblings ...)
  2015-06-08 10:28 ` pinskia at gcc dot gnu.org
@ 2015-06-08 13:41 ` leedypku at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: leedypku at gmail dot com @ 2015-06-08 13:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Dangyi Liu <leedypku at gmail dot com> ---
(In reply to Andrew Pinski from comment #4)
> Yes you don't define  NO_PROFILE_COUNTERS .  That is the default i386-elf
> target defaults to NO_PROFILE_COUNTERS not being defined.

Thank you very much!!! But I don't know how to define this macro during
building phase, and I can't find any useful information using Google. Could you
help me ?


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

end of thread, other threads:[~2015-06-08 13:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-08  9:51 [Bug c/66457] New: gcc generates an extra "mov ??, %edx" before "call mcount" when "-pg" is enabled in cross compilation leedypku at gmail dot com
2015-06-08  9:55 ` [Bug target/66457] " pinskia at gcc dot gnu.org
2015-06-08  9:59 ` leedypku at gmail dot com
2015-06-08 10:20 ` leedypku at gmail dot com
2015-06-08 10:27 ` pinskia at gcc dot gnu.org
2015-06-08 10:28 ` pinskia at gcc dot gnu.org
2015-06-08 13:41 ` leedypku 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).