48 */
49 private static String osName;
50
51 static {
52 // Find the target arch details
53 String archStr = System.getProperty("os.arch").toLowerCase();
54 if (ByteOrder.nativeOrder() != ByteOrder.LITTLE_ENDIAN) {
55 System.out.println("Only Little Endian byte order supported!");
56 }
57
58 if (archStr.equals("amd64") || archStr.equals("x86_64")) {
59 arch = Elf64_Ehdr.EM_X86_64;
60 } else if (archStr.equals("aarch64")) {
61 arch = Elf64_Ehdr.EM_AARCH64;
62 } else {
63 System.out.println("Unsupported architecture " + archStr);
64 arch = Elf64_Ehdr.EM_NONE;
65 }
66
67 osName = System.getProperty("os.name").toLowerCase();
68 if (!osName.equals("linux") && !osName.equals("sunos")) {
69 System.out.println("Unsupported Operating System " + osName);
70 osName = "Unknown";
71 }
72 }
73
74 static char getElfArch() {
75 return arch;
76 }
77
78 static int getElfEndian() {
79 return endian;
80 }
81
82 static String getOsName() {
83 return osName;
84 }
85 }
|
48 */
49 private static String osName;
50
51 static {
52 // Find the target arch details
53 String archStr = System.getProperty("os.arch").toLowerCase();
54 if (ByteOrder.nativeOrder() != ByteOrder.LITTLE_ENDIAN) {
55 System.out.println("Only Little Endian byte order supported!");
56 }
57
58 if (archStr.equals("amd64") || archStr.equals("x86_64")) {
59 arch = Elf64_Ehdr.EM_X86_64;
60 } else if (archStr.equals("aarch64")) {
61 arch = Elf64_Ehdr.EM_AARCH64;
62 } else {
63 System.out.println("Unsupported architecture " + archStr);
64 arch = Elf64_Ehdr.EM_NONE;
65 }
66
67 osName = System.getProperty("os.name").toLowerCase();
68 if (!osName.equals("linux")) {
69 System.out.println("Unsupported Operating System " + osName);
70 osName = "Unknown";
71 }
72 }
73
74 static char getElfArch() {
75 return arch;
76 }
77
78 static int getElfEndian() {
79 return endian;
80 }
81
82 static String getOsName() {
83 return osName;
84 }
85 }
|