native-elf-format (282918) | native-elf-format (295577) |
---|---|
1#!/bin/sh 2# | 1#!/bin/sh 2# |
3# $Id: native-elf-format 3186 2015-04-16 22:16:40Z emaste $ | 3# $Id: native-elf-format 3293 2016-01-07 19:26:27Z emaste $ |
4# 5# Find the native ELF format for a host platform by compiling a 6# test object and examining the resulting object. 7# 8# This script is used if there is no easy way to determine this 9# information statically at compile time. 10 11program=`basename $0` --- 16 unchanged lines hidden (view full) --- 28 elfdata = "LSB"; 29 } else { 30 elfdata = "MSB"; 31 } 32 } 33$1 ~ "Machine:" { 34 if (match($0, "Intel.*386")) { 35 elfarch = "EM_386"; | 4# 5# Find the native ELF format for a host platform by compiling a 6# test object and examining the resulting object. 7# 8# This script is used if there is no easy way to determine this 9# information statically at compile time. 10 11program=`basename $0` --- 16 unchanged lines hidden (view full) --- 28 elfdata = "LSB"; 29 } else { 30 elfdata = "MSB"; 31 } 32 } 33$1 ~ "Machine:" { 34 if (match($0, "Intel.*386")) { 35 elfarch = "EM_386"; |
36 } else if (match($0, "MIPS")) { 37 elfarch = "EM_MIPS"; |
|
36 } else if (match($0, ".*[xX]86-64")) { 37 elfarch = "EM_X86_64"; 38 } else { 39 elfarch = "unknown"; 40 } 41 } 42END { 43 printf("#define ELFTC_CLASS ELFCLASS%s\n", elfclass); 44 printf("#define ELFTC_ARCH %s\n", elfarch); 45 printf("#define ELFTC_BYTEORDER ELFDATA2%s\n", elfdata); 46}' 47 | 38 } else if (match($0, ".*[xX]86-64")) { 39 elfarch = "EM_X86_64"; 40 } else { 41 elfarch = "unknown"; 42 } 43 } 44END { 45 printf("#define ELFTC_CLASS ELFCLASS%s\n", elfclass); 46 printf("#define ELFTC_ARCH %s\n", elfarch); 47 printf("#define ELFTC_BYTEORDER ELFDATA2%s\n", elfdata); 48}' 49 |