From: Fujio Ikegami <ikegami@cs.fujitsu.co.jp>
To: linux-ia64@vger.kernel.org
Subject: [Linux-ia64] big endian code of NUE gcc
Date: Tue, 19 Sep 2000 00:54:49 +0000 [thread overview]
Message-ID: <marc-linux-ia64-105590678205500@msgid-missing> (raw)
Hi,
I tried to get big endian code by using NUE gcc under IA-32 Linux as follows:
gcc -mbig-endian -o endian endian.c
But the code I got was not big endian.
Question:
Is the compiler option of -mbig-endian effective?
Does Red Hat support big endian code?
Best Regards,
Fujio Ikegami
<attachement>
1. Operation
[ikegami@alfard hit]$ nue
bash$ gcc -mbig-endian -o endian endian.c
bash$ endian
u16\x1234 u32\x12345678 u64\x1234567890ABCDEF
u16
FFFFF98E 3412 |4 |
u32
FFFFF988 78563412 |xV4 |
u64
FFFFF980 EFCDAB90 78563412 | xV4 |
bash$
2. endian.c
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
void dump(char *title,void *vp,int len);
int main() {
unsigned short int u16;
unsigned int u32;
unsigned long long int u64;
u16=0x1234;
u32=0x12345678;
u64=0x1234567890abcdef;
printf("u16=%x u32=%x u64=%lX\n",u16,u32,u64);
dump("u16",&u16,2);
dump("u32",&u32,4);
dump("u64",&u64,8);
return 0;
}
void dump(char *title,void *vp,int len) {
// hex dump */
unsigned char *p;
int i,j,c;
char buf[32];
p=(unsigned char *)vp;
printf("%s\n",title);
for(i=j=0;i<len;i++) {
c=p[i];
if (i%16=0) {
if (i>0) printf(" |%s|\n",buf);
printf("%08X ",p+i);
j=0;
}
if (i%4=0) printf(" ");
printf("%02X",c);
sprintf(&buf[j++],"%c",to_char(c));
}
for(i=j;i<16;i++) {
if (i%4=0) printf(" ");
printf(" ");
}
printf(" |%s|\n",buf);
return;
}
int to_char(int c) {
if (c<' ' || c>0x7f) return ' ';
return c;
}
next reply other threads:[~2000-09-19 0:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-09-19 0:54 Fujio Ikegami [this message]
2000-09-19 1:21 ` [Linux-ia64] big endian code of NUE gcc Jim Wilson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=marc-linux-ia64-105590678205500@msgid-missing \
--to=ikegami@cs.fujitsu.co.jp \
--cc=linux-ia64@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox