On 05 Nov 2014 12:37, Jeffrey Bastian wrote:
> If a missing readelf command becomes a problem, there are a number of
> other ways to check:
>   1. echo -n I | od -to2

`printf I` :)

>   2. lscpu | grep "Byte Order"
>   3. python -c "import sys;print sys.byteorder;"
>   4. perl -MConfig -e 'print $Config{byteorder};'
>   5. a small C helper program since we know at least the compiler
>      is installed

the way autoconf does it is to compile a data struct and grep the string:
$ cat test.c
short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
extern int foo(short *, short *);
int main(int argc, char *argv[]) {
    return foo(big_endian, little_endian);
}
$ gcc -c test.c
$ grep -q BiGeNdIaN test.o && echo big endian
$ grep -q LiTtLeEnDiAn test.o && echo little endian

> The patch below uses just the readelf command, and it uses your
> simplified code path, and it also updates the comments at the top of the
> test (I forgot that in my earlier patches).

Acked-by: Mike Frysinger <vap...@gentoo.org>
-mike

Attachment: signature.asc
Description: Digital signature

------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to