Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Crash Utility (http://www.linux-archive.org/crash-utility/)
-   -   PPC64 compiler question (http://www.linux-archive.org/crash-utility/677318-ppc64-compiler-question.html)

Dave Anderson 06-26-2012 01:22 PM

PPC64 compiler question
 
While doing some testing I ran into a surprising crash-build
bug on ppc64, where on a RHEL5 ppc64 host, a simple "make"
command would build a 32-bit PPC crash utility. But on RHEL6,
it built as 64-bit PPC64 crash utility as expected. (This was due
to a crash-6.0.3 change to support "make target=PPC" on
a ppc64 host).

Anyway, the reason is that in the RHEL5 environment, if an
application is compiled without specifying -m32 or -m64,
it builds a 32-bit binary, whereas on RHEL6 it builds a
64-bit binary by default:

RHEL5:

# cat doit.c
main() {}
# gcc doit.c
# file a.out
a.out: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), not stripped
# gcc --version
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-52)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# uname -r
2.6.18-308.el5
#

RHEL6:

# cat doit.c
main() {}
# gcc doit.c
# file a.out
a.out: ELF 64-bit MSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped
# gcc --version
gcc (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# uname -r
2.6.32-220.el6.ppc64
#

What controls that? Is it the compiler, some environment setting, or what?

Dave

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility

"Seymour, Shane M" 06-27-2012 12:25 AM

PPC64 compiler question
 
The default for RHEL5 is 32bit:

http://www.ibm.com/developerworks/wikis/display/LinuxP/Performance+FAQs#PerformanceFAQs-WhyistheRHEL5defaultforapplications32bitandtheSLES 11default64bit%3F

The default for RHEL6 presumably changed to be 64bit like SLES11. To quote big blue (when talking about RHEL5): "It is logical that the next version of RHEL would likely move to a 64-bit default."

-----Original Message-----
From: crash-utility-bounces@redhat.com [mailto:crash-utility-bounces@redhat.com] On Behalf Of Dave Anderson
Sent: Tuesday, June 26, 2012 11:23 PM
To: Discussion list for crash utility usage, maintenance and development
Subject: [Crash-utility] PPC64 compiler question


While doing some testing I ran into a surprising crash-build
bug on ppc64, where on a RHEL5 ppc64 host, a simple "make"
command would build a 32-bit PPC crash utility. But on RHEL6,
it built as 64-bit PPC64 crash utility as expected. (This was due
to a crash-6.0.3 change to support "make target=PPC" on
a ppc64 host).

Anyway, the reason is that in the RHEL5 environment, if an
application is compiled without specifying -m32 or -m64,
it builds a 32-bit binary, whereas on RHEL6 it builds a
64-bit binary by default:

RHEL5:

# cat doit.c
main() {}
# gcc doit.c
# file a.out
a.out: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), not stripped
# gcc --version
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-52)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# uname -r
2.6.18-308.el5
#

RHEL6:

# cat doit.c
main() {}
# gcc doit.c
# file a.out
a.out: ELF 64-bit MSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped
# gcc --version
gcc (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# uname -r
2.6.32-220.el6.ppc64
#

What controls that? Is it the compiler, some environment setting, or what?

Dave

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility

Haren Myneni 06-27-2012 04:25 AM

PPC64 compiler question
 
Yes, The default user space for RHEL 5 and SLES10 is 32bit, but we always build 64bit crash since PPC64 support is added. Top level makefile should have something like:



*ifeq (${TARGET}, PPC64)

CONF_FLAGS = -m64

endif



So, this change has to be modified to support cross-compile.



Thanks

Haren









"Seymour, Shane M" ---06/26/2012 05:32:47 PM---"Seymour, Shane M" <shane.seymour@hp.com>






"Seymour, Shane M" <shane.seymour@hp.com>*

Sent by: crash-utility-bounces@redhat.com

06/26/2012 05:25 PM

Please respond to

"Discussion list for crash utility usage, maintenance and development" <crash-utility@redhat.com>






To


"Discussion list for crash utility usage, maintenance and development" <crash-utility@redhat.com>




cc





Subject


Re: [Crash-utility] PPC64 compiler question










The default for RHEL5 is 32bit:



http://www.ibm.com/developerworks/wikis/display/LinuxP/Performance+FAQs#PerformanceFAQs-WhyistheRHEL5defaultforapplications32bitandtheSLES 11default64bit%3F



The default for RHEL6 presumably changed to be 64bit like SLES11. To quote big blue (when talking about RHEL5): "It is logical that the next version of RHEL would likely move to a 64-bit default."



-----Original Message-----

From: crash-utility-bounces@redhat.com [mailto:crash-utility-bounces@redhat.com] On Behalf Of Dave Anderson

Sent: Tuesday, June 26, 2012 11:23 PM

To: Discussion list for crash utility usage, maintenance and development

Subject: [Crash-utility] PPC64 compiler question





While doing some testing I ran into a surprising crash-build

bug on ppc64, where on a RHEL5 ppc64 host, a simple "make"

command would build a 32-bit PPC crash utility. *But on RHEL6,

it built as 64-bit PPC64 crash utility as expected. *(This was due

to a crash-6.0.3 change to support "make target=PPC" on

a ppc64 host).



Anyway, the reason is that in the RHEL5 environment, if an

application is compiled without specifying -m32 or -m64,

it builds a 32-bit binary, whereas on RHEL6 it builds a

64-bit binary by default:



RHEL5:



# cat doit.c

main() {}

# gcc doit.c

# file a.out

a.out: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), not stripped

# gcc --version

gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-52)

Copyright (C) 2006 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. *There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.



# uname -r

2.6.18-308.el5

#



RHEL6:



# cat doit.c

main() {}

# gcc doit.c

# file a.out

a.out: ELF 64-bit MSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped

# gcc --version

gcc (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3)

Copyright (C) 2010 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. *There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.



# uname -r

2.6.32-220.el6.ppc64

#



What controls that? *Is it the compiler, some environment setting, or what?



Dave



--

Crash-utility mailing list

Crash-utility@redhat.com

https://www.redhat.com/mailman/listinfo/crash-utility



--

Crash-utility mailing list

Crash-utility@redhat.com

https://www.redhat.com/mailman/listinfo/crash-utility






--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility

Dave Anderson 06-28-2012 03:57 PM

PPC64 compiler question
 
----- Original Message -----
> The default for RHEL5 is 32bit:
>
> http://www.ibm.com/developerworks/wikis/display/LinuxP/Performance+FAQs#PerformanceFAQs-WhyistheRHEL5defaultforapplications32bitandtheSLES 11default64bit%3F
>
> The default for RHEL6 presumably changed to be 64bit like SLES11. To
> quote big blue (when talking about RHEL5): "It is logical that the
> next version of RHEL would likely move to a 64-bit default."

Right -- but is the change built into the gcc binary? Or is there
some other file/environment-variable or whatever that gcc looks at?

Dave

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility

Dave Anderson 06-28-2012 04:10 PM

PPC64 compiler question
 
----- Original Message -----
>
>
>
> Yes, The default user space for RHEL 5 and SLES10 is 32bit, but we
> always build 64bit crash since PPC64 support is added. Top level
> makefile should have something like:
>
> ifeq (${TARGET}, PPC64)
> CONF_FLAGS = -m64
> endif
>
> So, this change has to be modified to support cross-compile.
>
> Thanks
> Haren

Actually the crash-6.0.3 Makefile change that set "ifeq (${TARGET}, PPC64)"
is the problem at hand. The very first time that "make" is run on a virgin
crash source tree the "TARGET" is not known/set. So on a RHEL5 system,
configure.c is compiled as a 32-bit binary, and therefore thinks it's
32-bit host. The Makefile needs to be restored to the way it used to
work -- by checking "ifeq (${ARCH}, ppc64)" -- where ARCH gets set in the
Makefile just above it based upon a "uname -m" shell call. When I originally
tested the crash-6.0.3 patches that were posted, I used a RHEL6 ppc64 host,
where it worked by luck.

For cross-compile, if the user enters "make target=PPC", then the configure
program will override the host ARCH. And upon subsequent builds, it will
override the host ARCH by checking the "gdb-7.3.1/crash.target" file
that was created by the first build. That way, the target is "sticky"
so that you don't have to keep entering "make target=PPC" after it
has been done the first time.

Dave

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility


All times are GMT. The time now is 03:06 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.