467
468 /* low-level bfd and arch stuff that binutils doesn't do for us */
469
470 static const bfd_arch_info_type* find_arch_info(const char* arch_name) {
471 const bfd_arch_info_type* arch_info = bfd_scan_arch(arch_name);
472 if (arch_info == NULL) {
473 extern const bfd_arch_info_type bfd_default_arch_struct;
474 arch_info = &bfd_default_arch_struct;
475 }
476 return arch_info;
477 }
478
479 static const char* native_arch_name() {
480 const char* res = NULL;
481 #ifdef LIBARCH_i386
482 res = "i386";
483 #endif
484 #ifdef LIBARCH_amd64
485 res = "i386:x86-64";
486 #endif
487 #ifdef LIBARCH_sparc
488 res = "sparc:v8plusb";
489 #endif
490 #ifdef LIBARCH_sparcv9
491 res = "sparc:v9b";
492 #endif
493 #if defined(LIBARCH_ppc64) || defined(LIBARCH_ppc64le)
494 res = "powerpc:common64";
495 #endif
496 #ifdef LIBARCH_arm
497 res = "arm";
498 #endif
499 #ifdef LIBARCH_aarch64
500 res = "aarch64";
501 #endif
502 #ifdef LIBARCH_s390x
503 res = "s390:64-bit";
504 #endif
505 if (res == NULL)
506 res = "architecture not set in Makefile!";
507 return res;
508 }
509
510 static enum bfd_endian native_endian() {
511 int32_t endian_test = 'x';
512 if (*(const char*) &endian_test == 'x')
|
467
468 /* low-level bfd and arch stuff that binutils doesn't do for us */
469
470 static const bfd_arch_info_type* find_arch_info(const char* arch_name) {
471 const bfd_arch_info_type* arch_info = bfd_scan_arch(arch_name);
472 if (arch_info == NULL) {
473 extern const bfd_arch_info_type bfd_default_arch_struct;
474 arch_info = &bfd_default_arch_struct;
475 }
476 return arch_info;
477 }
478
479 static const char* native_arch_name() {
480 const char* res = NULL;
481 #ifdef LIBARCH_i386
482 res = "i386";
483 #endif
484 #ifdef LIBARCH_amd64
485 res = "i386:x86-64";
486 #endif
487 #if defined(LIBARCH_ppc64) || defined(LIBARCH_ppc64le)
488 res = "powerpc:common64";
489 #endif
490 #ifdef LIBARCH_arm
491 res = "arm";
492 #endif
493 #ifdef LIBARCH_aarch64
494 res = "aarch64";
495 #endif
496 #ifdef LIBARCH_s390x
497 res = "s390:64-bit";
498 #endif
499 if (res == NULL)
500 res = "architecture not set in Makefile!";
501 return res;
502 }
503
504 static enum bfd_endian native_endian() {
505 int32_t endian_test = 'x';
506 if (*(const char*) &endian_test == 'x')
|