public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Add support for ia16
@ 2017-04-01 16:50 Andrew Jenner
  2017-04-03  7:37 ` Jan Beulich
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Andrew Jenner @ 2017-04-01 16:50 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 755 bytes --]

I've posted patches to gcc-patches for adding an ia16 (16-bit x86) port 
to GCC (see https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00009.html). 
Some binutils changes are required to make this work, attached.

When the port was originally created by Rask Ingemann Lambertsen 10 
years ago, he made it work by symlinking the ia16-* binutils programs to 
the corresponding i386-* programs. With this patch, this hack is not 
necessary - real ia16-* binutils programs are built using the same 
sources as i386.

Okay to commit?

Thanks,

Andrew


2017-04-01  Andrew Jenner  <andrew@codesourcery.com>

	* config.sub: Handle ia16 in $basic_machine.

	bfd/
	* config.bfd: Handle ia16.

	gas/
	* configure.tgt: Handle ia16.

	ld/
	* configure.tgt: Handle ia16.


[-- Attachment #2: binutils_ia16.patch --]
[-- Type: text/x-patch, Size: 2779 bytes --]

Index: gas/configure.tgt
===================================================================
--- gas/configure.tgt	(revision 475333)
+++ gas/configure.tgt	(revision 475423)
@@ -62,6 +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;;
   ia64)			cpu_type=ia64 ;;
   ip2k)			cpu_type=ip2k endian=big ;;
   iq2000)		cpu_type=iq2000 endian=big ;;
@@ -289,6 +290,8 @@ case ${generic_target} in

   i960-*-elf*)				fmt=elf ;;

+  ia16-*-elf*)				fmt=elf ;;
+
   ia64-*-elf*)				fmt=elf ;;
   ia64-*-*vms*)				fmt=elf em=vms ;;
   ia64-*-aix*)				fmt=elf em=ia64aix ;;
Index: config.sub
===================================================================
--- config.sub	(revision 475333)
+++ config.sub	(revision 475423)
@@ -2,7 +2,7 @@
 # Configuration validation subroutine script.
 #   Copyright 1992-2016 Free Software Foundation, Inc.

-timestamp='2016-01-11'
+timestamp='2017-03-28'

 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -263,7 +263,7 @@ case $basic_machine in
 	| fido | fr30 | frv | ft32 \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| hexagon \
-	| i370 | i860 | i960 | ia64 \
+	| i370 | i860 | i960 | ia64 | ia16 \
 	| ip2k | iq2000 \
 	| k1om \
 	| le32 | le64 \
Index: ld/configure.tgt
===================================================================
--- ld/configure.tgt	(revision 475333)
+++ ld/configure.tgt	(revision 475423)
@@ -399,6 +399,7 @@ i960-intel-nindy)	targ_emul=gld960 ;;
 i960-*-rtems*)		targ_emul=gld960coff ;;
 i960-*-elf*)		targ_emul=elf32_i960
 			;;
+ia16-*-elf*)		targ_emul=elf_i386 targ_extra_emuls=i386msdos ;;
 ia64-*-elf*)		targ_emul=elf64_ia64 ;;
 ia64-*-freebsd* | ia64-*-kfreebsd*-gnu)
 		        targ_emul=elf64_ia64_fbsd
Index: bfd/config.bfd
===================================================================
--- bfd/config.bfd	(revision 475333)
+++ bfd/config.bfd	(revision 475423)
@@ -108,6 +108,7 @@ fido*)		 targ_archs=bfd_m68k_arch ;;
 hppa*)		 targ_archs=bfd_hppa_arch ;;
 i[3-7]86)	 targ_archs=bfd_i386_arch ;;
 i370)		 targ_archs=bfd_i370_arch ;;
+ia16)		 targ_archs=bfd_i386_arch ;;
 lm32)	         targ_archs=bfd_lm32_arch ;;
 m6811*|m68hc11*) targ_archs="bfd_m68hc11_arch bfd_m68hc12_arch bfd_m9s12x_arch bfd_m9s12xg_arch" ;;
 m6812*|m68hc12*) targ_archs="bfd_m68hc12_arch bfd_m68hc11_arch bfd_m9s12x_arch bfd_m9s12xg_arch" ;;
@@ -823,6 +824,11 @@ case "${targ}" in
     targ_selvecs="icoff_le_vec icoff_be_vec"
     ;;

+  ia16-*-elf)
+    targ_defvec=i386_elf32_vec
+    targ_selvecs="i386_msdos_vec i386_aout_vec"
+    ;;
+
   ip2k-*-elf)
     targ_defvec=ip2k_elf32_vec
     ;;



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Add support for ia16
  2017-04-01 16:50 [PATCH] Add support for ia16 Andrew Jenner
@ 2017-04-03  7:37 ` Jan Beulich
  2017-04-03 16:14   ` Andrew Jenner
  2017-04-03 11:19 ` [PATCH] Add support for ia16 Nick Clifton
  2017-04-05 10:57 ` Joseph Myers
  2 siblings, 1 reply; 8+ messages in thread
From: Jan Beulich @ 2017-04-03  7:37 UTC (permalink / raw)
  To: Andrew Jenner; +Cc: binutils

>>> On 01.04.17 at 18:49, <andrew@codesourcery.com> wrote:
> 2017-04-01  Andrew Jenner  <andrew@codesourcery.com>
> 
> 	* config.sub: Handle ia16 in $basic_machine.
> 
> 	bfd/
> 	* config.bfd: Handle ia16.
> 
>>+  ia16-*-elf)
>>+    targ_defvec=i386_elf32_vec

So how would a consumer of the ELF binary recognize the 16bit-ness?
I.e. shouldn't there first be an extension to the i386 ELF ABI to mark
either the whole object or (preferred) individual sections as 16bit?

>>+    targ_selvecs="i386_msdos_vec i386_aout_vec"

Why force aout in for everyone?

Jan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Add support for ia16
  2017-04-01 16:50 [PATCH] Add support for ia16 Andrew Jenner
  2017-04-03  7:37 ` Jan Beulich
@ 2017-04-03 11:19 ` Nick Clifton
  2017-04-05 10:57 ` Joseph Myers
  2 siblings, 0 replies; 8+ messages in thread
From: Nick Clifton @ 2017-04-03 11:19 UTC (permalink / raw)
  To: Andrew Jenner, binutils

Hi Andrew,

> 2017-04-01  Andrew Jenner  <andrew@codesourcery.com>
> 
>     * config.sub: Handle ia16 in $basic_machine.
> 
>     bfd/
>     * config.bfd: Handle ia16.
> 
>     gas/
>     * configure.tgt: Handle ia16.
> 
>     ld/
>     * configure.tgt: Handle ia16.

Approved - please apply.

Cheers
  Nick


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Add support for ia16
  2017-04-03  7:37 ` Jan Beulich
@ 2017-04-03 16:14   ` Andrew Jenner
  2017-04-04  7:52     ` Jan Beulich
  2017-04-13  9:35     ` Commit: sync config.sub Andrew Jenner
  0 siblings, 2 replies; 8+ messages in thread
From: Andrew Jenner @ 2017-04-03 16:14 UTC (permalink / raw)
  To: Jan Beulich, Nick Clifton; +Cc: binutils

Hi Jan,

On 03/04/2017 08:37, Jan Beulich wrote:
> So how would a consumer of the ELF binary recognize the 16bit-ness?
> I.e. shouldn't there first be an extension to the i386 ELF ABI to mark
> either the whole object or (preferred) individual sections as 16bit?

There probably should. I'll take a look at adding this. Do you know if 
other architectures have similar extensions that I could look at to see 
how they do it?

>>> +    targ_selvecs="i386_msdos_vec i386_aout_vec"
>
> Why force aout in for everyone?

It seems to be a prerequisite for i386_msdos_vec - without it, I get 
"undefined reference to `aout_32_mkobject'" in i386msdos.o.


On 03/04/2017 12:19, Nick Clifton wrote:
 > Approved - please apply.

Committed - thanks!

Andrew

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Add support for ia16
  2017-04-03 16:14   ` Andrew Jenner
@ 2017-04-04  7:52     ` Jan Beulich
  2017-04-05 15:53       ` Maciej W. Rozycki
  2017-04-13  9:35     ` Commit: sync config.sub Andrew Jenner
  1 sibling, 1 reply; 8+ messages in thread
From: Jan Beulich @ 2017-04-04  7:52 UTC (permalink / raw)
  To: Andrew Jenner; +Cc: Nick Clifton, binutils

>>> On 03.04.17 at 18:14, <andrew@codesourcery.com> wrote:
> On 03/04/2017 08:37, Jan Beulich wrote:
>> So how would a consumer of the ELF binary recognize the 16bit-ness?
>> I.e. shouldn't there first be an extension to the i386 ELF ABI to mark
>> either the whole object or (preferred) individual sections as 16bit?
> 
> There probably should. I'll take a look at adding this. Do you know if 
> other architectures have similar extensions that I could look at to see 
> how they do it?

x86-64 has the x32 sub-mode, but that is (bogusly imo) indicated
by using a 32-bit ELF instead of the default 64-bit ELF one. IA-64
uses a bit in e_flags (and it looks like some other architectures,
like MIPS, do too), which is the approach I'd expect to be used
everywhere when mixed bitness in a single executable is not
intended to be permitted. I can't seem to find examples of section
flags indicating bitness - ARM's Thumb mode, for example, works
by inserting special marker labels instead (thus allowing mixed
code inside a section).

>>>> +    targ_selvecs="i386_msdos_vec i386_aout_vec"
>>
>> Why force aout in for everyone?
> 
> It seems to be a prerequisite for i386_msdos_vec - without it, I get 
> "undefined reference to `aout_32_mkobject'" in i386msdos.o.

That seems strange to me, but then again I know next to nothing
about this setting up of target vectors. Generally I'd expect
dependencies to be taken care of without having to list them
explicitly. Nor can I see any reasonable connection between
MS-DOS executables and a.out ones. But anyway ...

Jan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Add support for ia16
  2017-04-01 16:50 [PATCH] Add support for ia16 Andrew Jenner
  2017-04-03  7:37 ` Jan Beulich
  2017-04-03 11:19 ` [PATCH] Add support for ia16 Nick Clifton
@ 2017-04-05 10:57 ` Joseph Myers
  2 siblings, 0 replies; 8+ messages in thread
From: Joseph Myers @ 2017-04-05 10:57 UTC (permalink / raw)
  To: Andrew Jenner; +Cc: binutils

On Sat, 1 Apr 2017, Andrew Jenner wrote:

> 2017-04-01  Andrew Jenner  <andrew@codesourcery.com>
> 
> 	* config.sub: Handle ia16 in $basic_machine.

Local patches to config.sub and config.guess are inappropriate; the files 
should always be an unmodified copy from upstream config.git. The changes 
should first be got into config.git upstream, then the upstream versions 
of config.sub and config.guess copied, verbatim, into binutils / GCC / 
newlib.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Add support for ia16
  2017-04-04  7:52     ` Jan Beulich
@ 2017-04-05 15:53       ` Maciej W. Rozycki
  0 siblings, 0 replies; 8+ messages in thread
From: Maciej W. Rozycki @ 2017-04-05 15:53 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Andrew Jenner, Nick Clifton, binutils

On Tue, 4 Apr 2017, Jan Beulich wrote:

> x86-64 has the x32 sub-mode, but that is (bogusly imo) indicated
> by using a 32-bit ELF instead of the default 64-bit ELF one.

 FWIW I find the choice of ELF32 correct for an ABI (such as the x86-64 
target's x32 ABI I believe is) that has a 32-bit pointer size, as all ELF 
structures are then consistently 32-bit as well; and as a side effect you 
also have no technical means to request an invalid address space mapping.  
The same choice has been also earlier made for the MIPS target's n32 ABI.

  Maciej

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Commit: sync config.sub
  2017-04-03 16:14   ` Andrew Jenner
  2017-04-04  7:52     ` Jan Beulich
@ 2017-04-13  9:35     ` Andrew Jenner
  1 sibling, 0 replies; 8+ messages in thread
From: Andrew Jenner @ 2017-04-13  9:35 UTC (permalink / raw)
  To: Jan Beulich, Nick Clifton; +Cc: binutils

On 03/04/2017 17:14, Andrew Jenner wrote:
> On 03/04/2017 12:19, Nick Clifton wrote:
>> Approved - please apply.
>
> Committed - thanks!

Further to this, I've committed the patch below to sync config.sub with 
the latest version from the config project (the change committed to the 
config project was slightly different than the one I committed to the 
binutils project).

Thanks,

Andrew


./ChangeLog
2017-04-13  Andrew Jenner  <andrew@codesourcery.com>

	* config.sub: Sync with master version in config project.

diff --git a/config.sub b/config.sub
index b3ed1f0..40ea5df 100755
--- a/config.sub
+++ b/config.sub
@@ -2,7 +2,7 @@
  # Configuration validation subroutine script.
  #   Copyright 1992-2017 Free Software Foundation, Inc.

-timestamp='2017-03-22'
+timestamp='2017-04-02'

  # This file is free software; you can redistribute it and/or modify it
  # under the terms of the GNU General Public License as published by
@@ -263,7 +263,7 @@ case $basic_machine in
         | fido | fr30 | frv | ft32 \
         | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | 
hppa64 \
         | hexagon \
-       | i370 | i860 | i960 | ia64 | ia16 \
+       | i370 | i860 | i960 | ia16 | ia64 \
         | ip2k | iq2000 \
         | k1om \
         | le32 | le64 \
@@ -389,7 +389,7 @@ case $basic_machine in
         | h8300-* | h8500-* \
         | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
         | hexagon-* \
-       | i*86-* | i860-* | i960-* | ia64-* \
+       | i*86-* | i860-* | i960-* | ia16-* | ia64-* \
         | ip2k-* | iq2000-* \
         | k1om-* \
         | le32-* | le64-* \

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-04-13  9:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-01 16:50 [PATCH] Add support for ia16 Andrew Jenner
2017-04-03  7:37 ` Jan Beulich
2017-04-03 16:14   ` Andrew Jenner
2017-04-04  7:52     ` Jan Beulich
2017-04-05 15:53       ` Maciej W. Rozycki
2017-04-13  9:35     ` Commit: sync config.sub Andrew Jenner
2017-04-03 11:19 ` [PATCH] Add support for ia16 Nick Clifton
2017-04-05 10:57 ` Joseph Myers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).