Skip to content

Instantly share code, notes, and snippets.

@asiekierka
Created November 30, 2022 22:34
Show Gist options
  • Save asiekierka/bb5b43d3926035414b9a7b2b1a576397 to your computer and use it in GitHub Desktop.
Save asiekierka/bb5b43d3926035414b9a7b2b1a576397 to your computer and use it in GitHub Desktop.
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 2bc40c879e..87c5bcb779 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -3051,6 +3051,7 @@ i386_mach (void)
return bfd_mach_x64_32;
}
else if (!strncmp (default_arch, "i386", 4)
+ || !strncmp (default_arch, "ia16", 4)
|| !strcmp (default_arch, "iamcu"))
{
if (cpu_arch_isa == PROCESSOR_IAMCU)
@@ -3215,6 +3216,11 @@ md_begin (void)
#endif
x86_cie_data_alignment = -8;
}
+ else if (flag_code == CODE_16BIT)
+ {
+ x86_dwarf2_return_column = 8;
+ x86_cie_data_alignment = -2;
+ }
else
{
x86_dwarf2_return_column = 8;
@@ -13294,6 +13300,7 @@ const char *md_shortopts = "qnO::";
#define OPTION_MLFENCE_BEFORE_RET (OPTION_MD_BASE + 33)
#define OPTION_MUSE_UNALIGNED_VECTOR_MOVE (OPTION_MD_BASE + 34)
#define OPTION_32_SEGELF (OPTION_MD_BASE + 35)
+#define OPTION_16_SEGELF (OPTION_MD_BASE + 36)
struct option md_longopts[] =
{
@@ -13305,6 +13312,7 @@ struct option md_longopts[] =
#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
# ifdef ENABLE_X86_HPA_SEGELF
{"32-segelf", no_argument, NULL, OPTION_32_SEGELF},
+ {"16-segelf", no_argument, NULL, OPTION_16_SEGELF},
# endif
{"x32", no_argument, NULL, OPTION_X32},
{"mshared", no_argument, NULL, OPTION_MSHARED},
@@ -13449,6 +13457,9 @@ md_parse_option (int c, const char *arg)
case OPTION_32_SEGELF:
default_arch = "i386:segelf";
break;
+ case OPTION_16_SEGELF:
+ default_arch = "ia16:segelf";
+ break;
# endif
#endif
@@ -14176,6 +14187,14 @@ i386_target_format (void)
# ifdef ENABLE_X86_HPA_SEGELF
if (default_arch[4] != 0)
x86_elf_abi = I386_SEGELF_ABI;
+# endif
+ }
+ else if (!strncmp (default_arch, "ia16", 4))
+ {
+ update_code_flag (CODE_16BIT, 1);
+# ifdef ENABLE_X86_HPA_SEGELF
+ if (default_arch[4] != 0)
+ x86_elf_abi = I386_SEGELF_ABI;
# endif
}
else if (!strcmp (default_arch, "iamcu"))
diff --git a/gas/configure.tgt b/gas/configure.tgt
index a9825d577e..bbfc6d05c6 100644
--- a/gas/configure.tgt
+++ b/gas/configure.tgt
@@ -62,7 +62,7 @@ case ${cpu} in
fido) cpu_type=m68k ;;
hppa*) cpu_type=hppa ;;
i[3-7]86) cpu_type=i386 arch=i386;;
- ia16) cpu_type=i386 arch=i386;;
+ ia16) cpu_type=i386 arch=ia16;;
ia64) cpu_type=ia64 ;;
ip2k) cpu_type=ip2k endian=big ;;
iq2000) cpu_type=iq2000 endian=big ;;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment