static unsigned int current_mode_mask = 0;
/* Set to TRUE if the highgprs flag in the ELF header needs to be set
- for the output file. */
+ for the output file. The default is picked in init_default_arch(). */
static bool set_highgprs_p = false;
/* Whether to use user friendly register names. Default is TRUE. */
static void
init_default_arch (void)
{
+ /* Default architecture size. */
if (strcmp (default_arch, "s390") == 0)
{
if (s390_arch_size == 0)
else
as_fatal (_("Invalid default architecture, broken assembler."));
+ /* Default current architecture mode. */
if (current_mode_mask == 0)
{
/* Default to z/Architecture mode if the CPU supports it. */
else
current_mode_mask = 1 << S390_OPCODE_ZARCH;
}
+
+ /* Determine whether the highgprs flag in the ELF header needs to be set. */
+ if ((s390_arch_size == 32) && (current_mode_mask & (1 << S390_OPCODE_ZARCH)))
+ set_highgprs_p = true;
}
/* Called by TARGET_FORMAT. */
current_mode_mask = 1 << S390_OPCODE_ESA;
else if (arg != NULL && strcmp (arg, "zarch") == 0)
- {
- if (s390_arch_size == 32)
- set_highgprs_p = true;
- current_mode_mask = 1 << S390_OPCODE_ZARCH;
- }
+ current_mode_mask = 1 << S390_OPCODE_ZARCH;
else if (arg != NULL && startswith (arg, "arch="))
{
--- /dev/null
+#name: s390 highgprs 0
+#source: blank.s
+#readelf: -h
+
+ELF Header:
+ Magic: 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00
+ Class: ELF32
+ Data: 2's complement, big endian
+ Version: 1 \(current\)
+ OS/ABI: UNIX - System V
+ ABI Version: 0
+ Type: REL \(Relocatable file\)
+ Machine: IBM S/390
+ Version: 0x1
+ Entry point address: 0x0
+ Start of program headers: 0 \(bytes into file\)
+ Start of section headers: 164 \(bytes into file\)
+ Flags: 0x0
+ Size of this header: 52 \(bytes\)
+ Size of program headers: 0 \(bytes\)
+ Number of program headers: 0
+ Size of section headers: 40 \(bytes\)
+ Number of section headers: 7
+ Section header string table index: 6
--- /dev/null
+#name: s390 highgprs machinemode 0
+#readelf: -h
+
+ELF Header:
+ Magic: 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00
+ Class: ELF32
+ Data: 2's complement, big endian
+ Version: 1 \(current\)
+ OS/ABI: UNIX - System V
+ ABI Version: 0
+ Type: REL \(Relocatable file\)
+ Machine: IBM S/390
+ Version: 0x1
+ Entry point address: 0x0
+ Start of program headers: 0 \(bytes into file\)
+ Start of section headers: 164 \(bytes into file\)
+ Flags: 0x0
+ Size of this header: 52 \(bytes\)
+ Size of program headers: 0 \(bytes\)
+ Number of program headers: 0
+ Size of section headers: 40 \(bytes\)
+ Number of section headers: 7
+ Section header string table index: 6
--- /dev/null
+.text
+ .machinemode zarch_nohighgprs
--- /dev/null
+#name: s390 highgprs machinemode 1
+#readelf: -h
+
+ELF Header:
+ Magic: 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00
+ Class: ELF32
+ Data: 2's complement, big endian
+ Version: 1 \(current\)
+ OS/ABI: UNIX - System V
+ ABI Version: 0
+ Type: REL \(Relocatable file\)
+ Machine: IBM S/390
+ Version: 0x1
+ Entry point address: 0x0
+ Start of program headers: 0 \(bytes into file\)
+ Start of section headers: 164 \(bytes into file\)
+ Flags: 0x1, highgprs
+ Size of this header: 52 \(bytes\)
+ Size of program headers: 0 \(bytes\)
+ Number of program headers: 0
+ Size of section headers: 40 \(bytes\)
+ Number of section headers: 7
+ Section header string table index: 6
--- /dev/null
+.text
+ .machinemode zarch
+ .machinemode esa
run_dump_test "esa-z9-109" "{as -m31} {as -march=z9-109}"
run_dump_test "esa-reloc" "{as -m31}"
run_dump_test "esa-operands" "{as -m31}"
+ run_dump_test "esa-highgprs-0" "{as -m31} {as -mesa}"
+ run_dump_test "esa-highgprs-0" "{as -mesa} {as -m31}"
+ run_dump_test "esa-highgprs-0" "{as -m31} {as -march=g5}"
+ run_dump_test "zarch-highgprs-1" "{as -m31} {as -mzarch}"
+ run_dump_test "zarch-highgprs-1" "{as -mzarch} {as -m31}"
+ run_dump_test "zarch-highgprs-1" "{as -m31} {as -march=z900}"
+ run_dump_test "esa-highgprs-machinemode-0" "{as -m31} {as -mesa}"
+ run_dump_test "esa-highgprs-machinemode-0" "{as -mesa} {as -m31}"
+ run_dump_test "esa-highgprs-machinemode-1" "{as -m31} {as -mesa}"
+ run_dump_test "esa-highgprs-machinemode-1" "{as -mesa} {as -m31}"
}
# # PIC is only supported on ELF targets.
run_list_test "machine-parsing-4" ""
run_list_test "machine-parsing-5" ""
run_list_test "machine-parsing-6" ""
+ run_dump_test "zarch-highgprs-0" "{as -m64} {as -mzarch}"
+ run_dump_test "zarch-highgprs-0" "{as -mzarch} {as -m64}"
run_dump_test "zarch-omitted-base-index" "{as -m64}"
run_list_test "zarch-omitted-base-index-err" ""
}
--- /dev/null
+#name: s390x highgprs 0
+#source: blank.s
+#readelf: -h
+
+ELF Header:
+ Magic: 7f 45 4c 46 02 02 01 00 00 00 00 00 00 00 00 00
+ Class: ELF64
+ Data: 2's complement, big endian
+ Version: 1 \(current\)
+ OS/ABI: UNIX - System V
+ ABI Version: 0
+ Type: REL \(Relocatable file\)
+ Machine: IBM S/390
+ Version: 0x1
+ Entry point address: 0x0
+ Start of program headers: 0 \(bytes into file\)
+ Start of section headers: 208 \(bytes into file\)
+ Flags: 0x0
+ Size of this header: 64 \(bytes\)
+ Size of program headers: 0 \(bytes\)
+ Number of program headers: 0
+ Size of section headers: 64 \(bytes\)
+ Number of section headers: 7
+ Section header string table index: 6
--- /dev/null
+#name: s390x highgprs 0
+#source: blank.s
+#readelf: -h
+
+ELF Header:
+ Magic: 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00
+ Class: ELF32
+ Data: 2's complement, big endian
+ Version: 1 \(current\)
+ OS/ABI: UNIX - System V
+ ABI Version: 0
+ Type: REL \(Relocatable file\)
+ Machine: IBM S/390
+ Version: 0x1
+ Entry point address: 0x0
+ Start of program headers: 0 \(bytes into file\)
+ Start of section headers: 164 \(bytes into file\)
+ Flags: 0x1, highgprs
+ Size of this header: 52 \(bytes\)
+ Size of program headers: 0 \(bytes\)
+ Number of program headers: 0
+ Size of section headers: 40 \(bytes\)
+ Number of section headers: 7
+ Section header string table index: 6