Re: GCC/G++ will not compile i686 binaries when asked.
[EMAIL PROTECTED] wrote: That may indeed be it. Is there any known way short of looking a the asm dump of a binary for telling what CPU instructions are used? When asked I was directed to readelf and file and they work great for SPARC based development, I wouldn't bet on that either:-) Seems to me your observations may have confirmed your expectations. However, I don't feel like firing up my {,ultra}sparcs to do any testing atm. -- Cheers John -- spambait [EMAIL PROTECTED] [EMAIL PROTECTED] Tourist pics http://portgeographe.environmentaldisasters.cds.merseine.nu/ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: GCC/G++ will not compile i686 binaries when asked.
On Thu, Aug 26, 2004 at 01:32:21PM -0700, [EMAIL PROTECTED] wrote: > That may indeed be it. Is there any known way short of looking a the > asm dump of a binary for telling what CPU instructions are used? When > asked I was directed to readelf and file and they work great for > SPARC based development, so I had assumed them to be correct for pc > development as well. > > Thanks in advance for the enlightenment. Nope. Just wrote a tiny unoptimizable program (true clone), compile for 386 and PII, and they cmp the same... I'd likely go for a pipeline, this works on my system: objdump --disassemble -j.text testC | grep '^ ' | perl -pe 's/.{32}//; s/ .*//' | sort -u -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: GCC/G++ will not compile i686 binaries when asked.
That may indeed be it. Is there any known way short of looking a the asm dump of a binary for telling what CPU instructions are used? When asked I was directed to readelf and file and they work great for SPARC based development, so I had assumed them to be correct for pc development as well. Thanks in advance for the enlightenment. On 25 Aug 2004 at 18:23, Stefan O'Rear wrote: > On Wed, Aug 25, 2004 at 05:48:45PM -0700, [EMAIL PROTECTED] wrote: > > For the past few weeks I have been co-working on a private project. I > > have done allot of work on it and I would hate to have to start over. > > > > The makefile I created for this project explicitly tells the compiler > > (g++) to compile the binary using i686 (-march=pentiumpro) assembly > > instructions and internal timeings. Yet for some [explitive] > > [explitive] reason it refuses to do so and both ?file? amd ?readelf? > > tell me it always compiles for a bare i386 despite my explicit > > commands otherwise. > > > > Two questions: > > Why the [explitive] does this [explitive] thing not compile the end > > result into a i686 only binary as I asked it to? > > How the [explitive] do I fix it? > > > > I have read the gcc/g++ manual pages. I have googled. I have spent > > the past hour dedicating myself to this problem, and nothing seems to > > work. > > > > This is [b]really[/b] getting to me. Please help. > > C file: > > int main(int argc) { > int sam = 0; > if (argc > 1) sam = argc; > return sam; > } > > Compile: > > ~ %% gcc -o testC test.c -mcpu=pentiumpro -march=pentiumpro -O3 > > Dissassembly Excerpt: > > 08048320 : > 8048320: 55 push %ebp > 8048321: 31 c0 xor%eax,%eax > 8048323: 89 e5 mov%esp,%ebp > 8048325: 83 ec 08sub$0x8,%esp > 8048328: 8b 4d 08mov0x8(%ebp),%ecx > 804832b: 83 e4 f0and$0xfff0,%esp > 804832e: 83 f9 02cmp$0x2,%ecx > 8048331: 0f 4d c1cmovge %ecx,%eax > 8048334: 89 ec mov%ebp,%esp > 8048336: 5d pop%ebp > 8048337: c3 ret > > See that cmovge - that's a Pentium ONLY insn. > > And readelf says: > Machine: Intel 80386 > > Is that ^^^ why you thing gcc won't make 686 programs? > > > 1. A PPro exec is the same as a 386 exec except for the insns. ReadELF >will tell you it's a 386 exec even if you have a PPro exec. > > Please comment. If it doesn't have 686 asm and could benefit from it, we > (atleast I) need more info. > > P.S. I use woody with a GCC-3.3 from unstable and the ness. libs. > > > -- > To UNSUBSCRIBE, email to [EMAIL PROTECTED] > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] > > -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: GCC/G++ will not compile i686 binaries when asked.
On Wed, Aug 25, 2004 at 05:48:45PM -0700, [EMAIL PROTECTED] wrote: > For the past few weeks I have been co-working on a private project. I > have done allot of work on it and I would hate to have to start over. > > The makefile I created for this project explicitly tells the compiler > (g++) to compile the binary using i686 (-march=pentiumpro) assembly > instructions and internal timeings. Yet for some [explitive] > [explitive] reason it refuses to do so and both ?file? amd ?readelf? > tell me it always compiles for a bare i386 despite my explicit > commands otherwise. > > Two questions: > Why the [explitive] does this [explitive] thing not compile the end > result into a i686 only binary as I asked it to? > How the [explitive] do I fix it? > > I have read the gcc/g++ manual pages. I have googled. I have spent > the past hour dedicating myself to this problem, and nothing seems to > work. > > This is [b]really[/b] getting to me. Please help. C file: int main(int argc) { int sam = 0; if (argc > 1) sam = argc; return sam; } Compile: ~ %% gcc -o testC test.c -mcpu=pentiumpro -march=pentiumpro -O3 Dissassembly Excerpt: 08048320 : 8048320: 55 push %ebp 8048321: 31 c0 xor%eax,%eax 8048323: 89 e5 mov%esp,%ebp 8048325: 83 ec 08sub$0x8,%esp 8048328: 8b 4d 08mov0x8(%ebp),%ecx 804832b: 83 e4 f0and$0xfff0,%esp 804832e: 83 f9 02cmp$0x2,%ecx 8048331: 0f 4d c1cmovge %ecx,%eax 8048334: 89 ec mov%ebp,%esp 8048336: 5d pop%ebp 8048337: c3 ret See that cmovge - that's a Pentium ONLY insn. And readelf says: Machine: Intel 80386 Is that ^^^ why you thing gcc won't make 686 programs? 1. A PPro exec is the same as a 386 exec except for the insns. ReadELF will tell you it's a 386 exec even if you have a PPro exec. Please comment. If it doesn't have 686 asm and could benefit from it, we (atleast I) need more info. P.S. I use woody with a GCC-3.3 from unstable and the ness. libs. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: GCC/G++ will not compile i686 binaries when asked.
[EMAIL PROTECTED] wrote: For the past few weeks I have been co-working on a private project. I have done allot of work on it and I would hate to have to start over. The makefile I created for this project explicitly tells the compiler (g++) to compile the binary using i686 (-march=pentiumpro) assembly instructions and internal timeings. Yet for some [explitive] [explitive] reason it refuses to do so and both ?file? amd ?readelf? tell me it always compiles for a bare i386 despite my explicit commands otherwise. Two questions: Why the [explitive] does this [explitive] thing not compile the end result into a i686 only binary as I asked it to? How the [explitive] do I fix it? I have read the gcc/g++ manual pages. I have googled. I have spent the past hour dedicating myself to this problem, and nothing seems to work. This is [b]really[/b] getting to me. Please help. I'm curious about why it's particularly important to you? For sure gcc will do what you want: I have been caught booting a kernel that trapped on a Pentium because it was built for 686, and when I redeployed a Pentium II (it was running RHL 7.3) I replaced the kernel and (I think glibc) but got caught on the ssl libraries - it's a mazing how many programs won't run with broken openssl!. So the Q is, how do you know it's not working for you? Have you tried building for an Athlon and running on your target? Do you have a small test program that illustrates your problem? If you come up with (say) ten lines of C, probablly people here will check it out for you on a variety of software. -- Cheers John -- spambait [EMAIL PROTECTED] [EMAIL PROTECTED] Tourist pics http://portgeographe.environmentaldisasters.cds.merseine.nu/ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
re: gcc / g++
Michael -- Thanks for your reply. I had not tried that. I must admit I've been a bit confused about the differences between gcc, g++, egcs, libc5 and libc6. The program I was trying to compile worked on Slackware 3.5 (libc5, I suspect) with gcc, and I seem to recall compiling it on Red Hat 5.1 (glibc/libc6). I have a much better feeling about things, now that I've gotten C and C++ to compile on my debian system. Thanks again! CSS On Mon, 28 Dec 1998, Michael Procario wrote: > > Have you tried > > g++ -o hello hello.cc > > g++ is the egcs c++ compiler It know waht libraries it needs. > -- Christopher S. Swingley International Arctic Research Center University of Alaska Fairbanks [EMAIL PROTECTED] mercury.bio.uaf.edu/~cswingle.grad -- An evil mind is a great comfort.
Re: gcc & g++
Hi, > Since g++ is now seperate from gcc, I noticed after installing both of > these that I have two directories under /usr/lib/gcc-lib/i486-linux. > One is 2.7.2.3 from gcc and the other is egcs-2.90.26. Other than a few > differences they seem to have the same files each taking almost 3M. I'm > running on a 486 laptop with a 120M hardrive and was wondering if I can > combine the files in these directories to use less space. No, you cannot. gcc and g++ are are not the same version. g++ is from the egcs-1.0.x distribution (the same for g77). gcc was not updated to the egcs version since there are still some problems with egcs gcc, which is why you have 2.7.2.3 and egcs-2.90.26 directories. Both gcc and g++ expect those certain subdirectories that depend on the version of the compiler. For this reason, you cannot combine the 2.7.2.3 and egcs-2.90.26 subdirectory. -Ossama -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]