public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
* Re: ARM hard-float ABI: add ldconfig flag value
       [not found] ` <20120802165658.GG24537@linaro.org>
@ 2012-08-02 17:28   ` Roland McGrath
  2012-08-02 17:49     ` Steve McIntyre
  2012-08-02 20:50     ` Joseph S. Myers
  0 siblings, 2 replies; 19+ messages in thread
From: Roland McGrath @ 2012-08-02 17:28 UTC (permalink / raw)
  To: Steve McIntyre; +Cc: libc-alpha, libc-ports

libc-ports@sourceware.org is the right list for discussing ARM.

OSABI is used in a generic way and should not be used for machine-specific
purposes.  An e_flags (EF_*) bit is probably a better choice.  There are
already these bits (among others):
	#define EF_ARM_SOFT_FLOAT	0x200
	#define EF_ARM_VFP_FLOAT	0x400
	#define EF_ARM_MAVERICK_FLOAT	0x800
But I don't know the history of their use.  Off hand EF_ARM_VFP_FLOAT seems
like it's already what you want, but maybe it has a different meaning (like
just that it uses VFP, not that the ABI specifies using VFP registers in
the calling convention).


Thanks,
Roland

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

* Re: ARM hard-float ABI: add ldconfig flag value
  2012-08-02 17:28   ` ARM hard-float ABI: add ldconfig flag value Roland McGrath
@ 2012-08-02 17:49     ` Steve McIntyre
  2012-08-02 17:55       ` Roland McGrath
  2012-08-02 20:50     ` Joseph S. Myers
  1 sibling, 1 reply; 19+ messages in thread
From: Steve McIntyre @ 2012-08-02 17:49 UTC (permalink / raw)
  To: Roland McGrath; +Cc: libc-alpha, libc-ports

Hi Roland,

On Thu, Aug 02, 2012 at 10:28:43AM -0700, Roland McGrath wrote:
>libc-ports@sourceware.org is the right list for discussing ARM.

Ah, OK. I'd seen the mergeback of ports and guessed wrong for the
mailing list. Apologies for that.

>OSABI is used in a generic way and should not be used for machine-specific
>purposes.

Are you sure? Various docs say that values above 64 are specifically
set aside for machine-specific values, hence why I'm looking at using
65 and 66 here.

>An e_flags (EF_*) bit is probably a better choice.  There are
>already these bits (among others):
>	#define EF_ARM_SOFT_FLOAT	0x200
>	#define EF_ARM_VFP_FLOAT	0x400
>	#define EF_ARM_MAVERICK_FLOAT	0x800
>But I don't know the history of their use.  Off hand EF_ARM_VFP_FLOAT seems
>like it's already what you want, but maybe it has a different meaning (like
>just that it uses VFP, not that the ABI specifies using VFP registers in
>the calling convention).

Exactly, those values are describing needed/used hardware, not ABI.

Cheers,
-- 
Steve McIntyre                                steve.mcintyre@linaro.org
<http://www.linaro.org/> Linaro.org | Open source software for ARM SoCs

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

* Re: ARM hard-float ABI: add ldconfig flag value
  2012-08-02 17:49     ` Steve McIntyre
@ 2012-08-02 17:55       ` Roland McGrath
  2012-08-02 18:14         ` Steve McIntyre
  0 siblings, 1 reply; 19+ messages in thread
From: Roland McGrath @ 2012-08-02 17:55 UTC (permalink / raw)
  To: Steve McIntyre; +Cc: libc-alpha, libc-ports

> >OSABI is used in a generic way and should not be used for machine-specific
> >purposes.
> 
> Are you sure? Various docs say that values above 64 are specifically
> set aside for machine-specific values, hence why I'm looking at using
> 65 and 66 here.

That may have been the original intent of the ELF spec.  But on GNU systems
this field has been coopted for purposes that are specific only to the GNU
dynamic linker (and linker), not to any machine or operating system.

> Exactly, those values are describing needed/used hardware, not ABI.

Then a new bit in that field seems like the best option to me.


Thanks,
Roland

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

* Re: ARM hard-float ABI: add ldconfig flag value
  2012-08-02 17:55       ` Roland McGrath
@ 2012-08-02 18:14         ` Steve McIntyre
  2012-08-02 18:26           ` Roland McGrath
  0 siblings, 1 reply; 19+ messages in thread
From: Steve McIntyre @ 2012-08-02 18:14 UTC (permalink / raw)
  To: Roland McGrath; +Cc: libc-alpha, libc-ports

On Thu, Aug 02, 2012 at 10:54:30AM -0700, Roland McGrath wrote:
>> >OSABI is used in a generic way and should not be used for machine-specific
>> >purposes.
>> 
>> Are you sure? Various docs say that values above 64 are specifically
>> set aside for machine-specific values, hence why I'm looking at using
>> 65 and 66 here.
>
>That may have been the original intent of the ELF spec.  But on GNU systems
>this field has been coopted for purposes that are specific only to the GNU
>dynamic linker (and linker), not to any machine or operating system.

Can you point me at any docs or code for that, please? I can see
existing code already in glibc that uses the ELF-defined
machine-specific space, hence I'm a little surprised to see you say
this. OSABI is exactly what's been suggested by the ABI folks in ARM.

Cheers,
-- 
Steve McIntyre                                steve.mcintyre@linaro.org
<http://www.linaro.org/> Linaro.org | Open source software for ARM SoCs

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

* Re: ARM hard-float ABI: add ldconfig flag value
  2012-08-02 18:14         ` Steve McIntyre
@ 2012-08-02 18:26           ` Roland McGrath
  2012-08-03 16:46             ` Steve McIntyre
  0 siblings, 1 reply; 19+ messages in thread
From: Roland McGrath @ 2012-08-02 18:26 UTC (permalink / raw)
  To: Steve McIntyre; +Cc: libc-alpha, libc-ports

> >That may have been the original intent of the ELF spec.  But on GNU systems
> >this field has been coopted for purposes that are specific only to the GNU
> >dynamic linker (and linker), not to any machine or operating system.
> 
> Can you point me at any docs or code for that, please? 

Search around for ELFOSABI_GNU (previously called ELFOSABI_LINUX)
in libc and binutils.

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

* Re: ARM hard-float ABI: add ldconfig flag value
  2012-08-02 17:28   ` ARM hard-float ABI: add ldconfig flag value Roland McGrath
  2012-08-02 17:49     ` Steve McIntyre
@ 2012-08-02 20:50     ` Joseph S. Myers
  2012-08-03 17:04       ` Steve McIntyre
  1 sibling, 1 reply; 19+ messages in thread
From: Joseph S. Myers @ 2012-08-02 20:50 UTC (permalink / raw)
  To: Roland McGrath; +Cc: Steve McIntyre, libc-alpha, libc-ports

On Thu, 2 Aug 2012, Roland McGrath wrote:

> libc-ports@sourceware.org is the right list for discussing ARM.

Only for ports patches; the original posting was a patch to a libc file 
(sysdeps/generic/ldconfig.h).  It could have done with more background 
explanation of what these flag values are and how they are used, and 
whether and why they do need to be in a single global place rather than 
each architecture having its own definitions in sysdeps.

> OSABI is used in a generic way and should not be used for machine-specific
> purposes.  An e_flags (EF_*) bit is probably a better choice.  There are
> already these bits (among others):
> 	#define EF_ARM_SOFT_FLOAT	0x200
> 	#define EF_ARM_VFP_FLOAT	0x400
> 	#define EF_ARM_MAVERICK_FLOAT	0x800
> But I don't know the history of their use.  Off hand EF_ARM_VFP_FLOAT seems
> like it's already what you want, but maybe it has a different meaning (like
> just that it uses VFP, not that the ABI specifies using VFP registers in
> the calling convention).

All those values are for obsolete ABI versions and not defined in AAELF.

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: ARM hard-float ABI: add ldconfig flag value
  2012-08-02 18:26           ` Roland McGrath
@ 2012-08-03 16:46             ` Steve McIntyre
  2012-08-08 13:41               ` Steve McIntyre
  0 siblings, 1 reply; 19+ messages in thread
From: Steve McIntyre @ 2012-08-03 16:46 UTC (permalink / raw)
  To: Roland McGrath; +Cc: libc-alpha, libc-ports

Hi Roland,

On Thu, Aug 02, 2012 at 11:26:02AM -0700, Roland McGrath wrote:
>> >That may have been the original intent of the ELF spec.  But on GNU systems
>> >this field has been coopted for purposes that are specific only to the GNU
>> >dynamic linker (and linker), not to any machine or operating system.
>> 
>> Can you point me at any docs or code for that, please? 
>
>Search around for ELFOSABI_GNU (previously called ELFOSABI_LINUX)
>in libc and binutils.

Thanks for that.

Right, I see the ifunc stuff. I'm a little surprised to see this field
being appropriated in this way, but OK... I understand it's not going
to fly with any other uses. I'm looking into adding some extra flags
for e_flags instead.

Cheers,
-- 
Steve McIntyre                                steve.mcintyre@linaro.org
<http://www.linaro.org/> Linaro.org | Open source software for ARM SoCs

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

* Re: ARM hard-float ABI: add ldconfig flag value
  2012-08-02 20:50     ` Joseph S. Myers
@ 2012-08-03 17:04       ` Steve McIntyre
  0 siblings, 0 replies; 19+ messages in thread
From: Steve McIntyre @ 2012-08-03 17:04 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: Roland McGrath, libc-alpha, libc-ports

On Thu, Aug 02, 2012 at 08:50:41PM +0000, Joseph S. Myers wrote:
>On Thu, 2 Aug 2012, Roland McGrath wrote:
>
>> libc-ports@sourceware.org is the right list for discussing ARM.
>
>Only for ports patches; the original posting was a patch to a libc file 
>(sysdeps/generic/ldconfig.h).  It could have done with more background 
>explanation of what these flag values are and how they are used,

OK, I assumed possibly more knowledge of that area than was fair. :-)

>and whether and why they do need to be in a single global place
>rather than each architecture having its own definitions in sysdeps.

Pass, this is just existing code where I'm trying to follow existing
conventions. The ldconfig cache code covers variations for a number of
architectures, for example.

Cheers,
-- 
Steve McIntyre                                steve.mcintyre@linaro.org
<http://www.linaro.org/> Linaro.org | Open source software for ARM SoCs

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

* Re: ARM hard-float ABI: add ldconfig flag value
  2012-08-03 16:46             ` Steve McIntyre
@ 2012-08-08 13:41               ` Steve McIntyre
  2012-08-08 16:31                 ` Roland McGrath
  2012-08-08 20:02                 ` Joseph S. Myers
  0 siblings, 2 replies; 19+ messages in thread
From: Steve McIntyre @ 2012-08-08 13:41 UTC (permalink / raw)
  To: Roland McGrath; +Cc: libc-alpha, libc-ports

On Fri, Aug 03, 2012 at 05:45:26PM +0100, Steve McIntyre wrote:
>Hi Roland,
>
>On Thu, Aug 02, 2012 at 11:26:02AM -0700, Roland McGrath wrote:
>>> >That may have been the original intent of the ELF spec.  But on GNU systems
>>> >this field has been coopted for purposes that are specific only to the GNU
>>> >dynamic linker (and linker), not to any machine or operating system.
>>> 
>>> Can you point me at any docs or code for that, please? 
>>
>>Search around for ELFOSABI_GNU (previously called ELFOSABI_LINUX)
>>in libc and binutils.
>
>Thanks for that.
>
>Right, I see the ifunc stuff. I'm a little surprised to see this field
>being appropriated in this way, but OK... I understand it's not going
>to fly with any other uses. I'm looking into adding some extra flags
>for e_flags instead.

Hi again,

How about the following patch? I've discussed this approach with the
ARM ABI folks and they're happy to go with it, I hope you are
too. Rather than use up any more of the e_flags flag space, I'm
proposing to re-use some of the older flags as Roland suggested. The
old flags

#define EF_ARM_SOFT_FLOAT       0x200
#define EF_ARM_VFP_FLOAT        0x400

are only valid for really old versions of the ARM ABI, so for EABI v5
(the current ABI) I'm proposing to add new names for the same values:

#define EF_ARM_EABI_FLOAT_SOFT  0x200
#define EF_ARM_EABI_FLOAT_HARD  0x400

which will specifically only be used with that ABI version.

With a similar patch to binutils to generate the new flags when
desired, the following code makes ld.so DTRT for me: rejecting new
binaries with the wrong ABI flag but accepting either new binaries
with the right ABI flag and older binaries that have neither flag set.

Assuming this code is acceptable, I'll next submit a patch for
ldconfig to also use the new flags for distinguishing ABIs when adding
libraries to ld.so.cache, using FLAG_ARM_HFABI as previously posted.

diff --git a/elf/elf.h b/elf/elf.h
index 71cfdb8..d143447 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -2250,6 +2250,9 @@ typedef Elf32_Addr Elf32_Conflict;
 #define EF_ARM_VFP_FLOAT       0x400
 #define EF_ARM_MAVERICK_FLOAT  0x800
 
+#define EF_ARM_EABI_FLOAT_SOFT  0x200   /* NB conflicts with EF_ARM_SOFT_FLOAT.  */
+#define EF_ARM_EABI_FLOAT_HARD  0x400   /* NB conflicts with EF_ARM_VFP_FLOAT.  */
+
 
 /* Other constants defined in the ARM ELF spec. version B-01.  */
 /* NB. These conflict with values defined above.  */
diff --git a/ports/sysdeps/unix/sysv/linux/arm/ldsodefs.h b/ports/sysdeps/unix/sysv/linux/arm/ldsodefs.h
index 8980bb1..adb99ac 100644
--- a/ports/sysdeps/unix/sysv/linux/arm/ldsodefs.h
+++ b/ports/sysdeps/unix/sysv/linux/arm/ldsodefs.h
@@ -27,10 +27,22 @@
 
 #define EXTRA_OSABI ELFOSABI_ARM_AEABI
 
+#ifdef __ARM_PCS_VFP
+#define VALID_FLOAT_ABI(x) \
+  ((EF_ARM_EABI_VERSION((x)) != EF_ARM_EABI_VER5)      \
+   || ! ((x) & EF_ARM_EABI_FLOAT_SOFT))
+#else
+#define VALID_FLOAT_ABI(x) \
+  ((EF_ARM_EABI_VERSION((x)) != EF_ARM_EABI_VER5)      \
+   || ! ((x) & EF_ARM_EABI_FLOAT_HARD))
+#endif
+
+#undef VALID_ELF_HEADER
 #define VALID_ELF_HEADER(hdr,exp,size)         \
-  (memcmp (hdr, exp, size) == 0                \
+  ((memcmp (hdr, exp, size) == 0               \
    || memcmp (hdr, expected2, size) == 0       \
-   || memcmp (hdr, expected3, size) == 0)
+    || memcmp (hdr, expected3, size) == 0)     \
+   && VALID_FLOAT_ABI(ehdr->e_flags))
 #define VALID_ELF_OSABI(osabi)         (osabi == ELFOSABI_SYSV         \
                                         || osabi == EXTRA_OSABI        \
                                         || osabi == ELFOSABI_LINUX)

Cheers,
-- 
Steve McIntyre                                steve.mcintyre@linaro.org
<http://www.linaro.org/> Linaro.org | Open source software for ARM SoCs

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

* Re: ARM hard-float ABI: add ldconfig flag value
  2012-08-08 13:41               ` Steve McIntyre
@ 2012-08-08 16:31                 ` Roland McGrath
  2012-08-08 20:02                 ` Joseph S. Myers
  1 sibling, 0 replies; 19+ messages in thread
From: Roland McGrath @ 2012-08-08 16:31 UTC (permalink / raw)
  To: Steve McIntyre; +Cc: libc-alpha, libc-ports

I don't have an opinion about the reuse of old bits.
The code changes look fine to me aside from some trivial style bits.
But it's up to Joseph as ARM maintainer to approve or disapprove.


Thanks,
Roland

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

* Re: ARM hard-float ABI: add ldconfig flag value
  2012-08-08 13:41               ` Steve McIntyre
  2012-08-08 16:31                 ` Roland McGrath
@ 2012-08-08 20:02                 ` Joseph S. Myers
  2012-08-09  0:34                   ` Steve McIntyre
  1 sibling, 1 reply; 19+ messages in thread
From: Joseph S. Myers @ 2012-08-08 20:02 UTC (permalink / raw)
  To: Steve McIntyre; +Cc: Roland McGrath, libc-alpha, libc-ports

On Wed, 8 Aug 2012, Steve McIntyre wrote:

> How about the following patch? I've discussed this approach with the
> ARM ABI folks and they're happy to go with it, I hope you are
> too. Rather than use up any more of the e_flags flag space, I'm
> proposing to re-use some of the older flags as Roland suggested. The
> old flags
> 
> #define EF_ARM_SOFT_FLOAT       0x200
> #define EF_ARM_VFP_FLOAT        0x400
> 
> are only valid for really old versions of the ARM ABI, so for EABI v5
> (the current ABI) I'm proposing to add new names for the same values:
> 
> #define EF_ARM_EABI_FLOAT_SOFT  0x200
> #define EF_ARM_EABI_FLOAT_HARD  0x400
> 
> which will specifically only be used with that ABI version.

Could you please point to a public statement from the ARM ABI maintainers 
about the reservation of these values for the next ABI revision, and the 
semantics being assigned to them?

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: ARM hard-float ABI: add ldconfig flag value
  2012-08-08 20:02                 ` Joseph S. Myers
@ 2012-08-09  0:34                   ` Steve McIntyre
  2012-08-09 11:10                     ` Joseph S. Myers
  0 siblings, 1 reply; 19+ messages in thread
From: Steve McIntyre @ 2012-08-09  0:34 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: Roland McGrath, libc-alpha, libc-ports

Hi Joseph,

On Wed, Aug 08, 2012 at 08:01:57PM +0000, Joseph S. Myers wrote:
>On Wed, 8 Aug 2012, Steve McIntyre wrote:
>
>> How about the following patch? I've discussed this approach with the
>> ARM ABI folks and they're happy to go with it, I hope you are
>> too. Rather than use up any more of the e_flags flag space, I'm
>> proposing to re-use some of the older flags as Roland suggested. The
>> old flags
>> 
>> #define EF_ARM_SOFT_FLOAT       0x200
>> #define EF_ARM_VFP_FLOAT        0x400
>> 
>> are only valid for really old versions of the ARM ABI, so for EABI v5
>> (the current ABI) I'm proposing to add new names for the same values:
>> 
>> #define EF_ARM_EABI_FLOAT_SOFT  0x200
>> #define EF_ARM_EABI_FLOAT_HARD  0x400
>> 
>> which will specifically only be used with that ABI version.
>
>Could you please point to a public statement from the ARM ABI maintainers 
>about the reservation of these values for the next ABI revision, and the 
>semantics being assigned to them?

There isn't one *yet*, we're waiting on your review before going
ahead. If you're happy with the approach here then we'll make that
happen ASAP.

Cheers,
-- 
Steve McIntyre                                steve.mcintyre@linaro.org
<http://www.linaro.org/> Linaro.org | Open source software for ARM SoCs

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

* Re: ARM hard-float ABI: add ldconfig flag value
  2012-08-09  0:34                   ` Steve McIntyre
@ 2012-08-09 11:10                     ` Joseph S. Myers
  2012-08-09 13:21                       ` Steve McIntyre
  0 siblings, 1 reply; 19+ messages in thread
From: Joseph S. Myers @ 2012-08-09 11:10 UTC (permalink / raw)
  To: Steve McIntyre; +Cc: Roland McGrath, libc-alpha, libc-ports

On Thu, 9 Aug 2012, Steve McIntyre wrote:

> >Could you please point to a public statement from the ARM ABI maintainers 
> >about the reservation of these values for the next ABI revision, and the 
> >semantics being assigned to them?
> 
> There isn't one *yet*, we're waiting on your review before going
> ahead. If you're happy with the approach here then we'll make that
> happen ASAP.

The approach of using ELF header flags and testing them in this way is 
fine; as Roland notes some coding style fixes are needed in the patch 
(e.g. spaces before the open parenthesis when calling a function-like 
macro).  I just think there should be an actual statement of the ABI 
before the patch goes in.  (Such a statement would include the values, the 
types of ELF files for which they may be used (I guess ET_EXEC and EY_DYN 
but not ET_REL) and the semantics of each value.)

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: ARM hard-float ABI: add ldconfig flag value
  2012-08-09 11:10                     ` Joseph S. Myers
@ 2012-08-09 13:21                       ` Steve McIntyre
  2012-08-22 15:41                         ` Steve McIntyre
  0 siblings, 1 reply; 19+ messages in thread
From: Steve McIntyre @ 2012-08-09 13:21 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: Roland McGrath, libc-alpha, libc-ports

On Thu, Aug 09, 2012 at 11:10:28AM +0000, Joseph S. Myers wrote:
>On Thu, 9 Aug 2012, Steve McIntyre wrote:
>
>> >Could you please point to a public statement from the ARM ABI maintainers 
>> >about the reservation of these values for the next ABI revision, and the 
>> >semantics being assigned to them?
>> 
>> There isn't one *yet*, we're waiting on your review before going
>> ahead. If you're happy with the approach here then we'll make that
>> happen ASAP.
>
>The approach of using ELF header flags and testing them in this way is 
>fine; as Roland notes some coding style fixes are needed in the patch 
>(e.g. spaces before the open parenthesis when calling a function-like 
>macro).

OK, easily fixed. :-)

>I just think there should be an actual statement of the ABI before
>the patch goes in.  (Such a statement would include the values, the
>types of ELF files for which they may be used (I guess ET_EXEC and
>EY_DYN but not ET_REL) and the semantics of each value.)

ACK. I've forwarded that onto the ABI folks in ARM and they're working
on it. Actually formally publishing a new version of the ABI spec will
likely take a few weeks to go through the system, but hoping to get
some agreed wording and a commitment to publish out long before then.

Cheers,
-- 
Steve McIntyre                                steve.mcintyre@linaro.org
<http://www.linaro.org/> Linaro.org | Open source software for ARM SoCs

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

* Re: ARM hard-float ABI: add ldconfig flag value
  2012-08-09 13:21                       ` Steve McIntyre
@ 2012-08-22 15:41                         ` Steve McIntyre
  2012-08-22 16:13                           ` Joseph S. Myers
  0 siblings, 1 reply; 19+ messages in thread
From: Steve McIntyre @ 2012-08-22 15:41 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: Roland McGrath, libc-alpha, libc-ports

On Thu, Aug 09, 2012 at 02:20:12PM +0100, Steve McIntyre wrote:
>On Thu, Aug 09, 2012 at 11:10:28AM +0000, Joseph S. Myers wrote:
>>
>>The approach of using ELF header flags and testing them in this way is 
>>fine; as Roland notes some coding style fixes are needed in the patch 
>>(e.g. spaces before the open parenthesis when calling a function-like 
>>macro).
>
>OK, easily fixed. :-)
>
>>I just think there should be an actual statement of the ABI before
>>the patch goes in.  (Such a statement would include the values, the
>>types of ELF files for which they may be used (I guess ET_EXEC and
>>EY_DYN but not ET_REL) and the semantics of each value.)
>
>ACK. I've forwarded that onto the ABI folks in ARM and they're working
>on it. Actually formally publishing a new version of the ABI spec will
>likely take a few weeks to go through the system, but hoping to get
>some agreed wording and a commitment to publish out long before then.

Hi Joseph,

Here's the text that we're planning to add for the next release of the
"ELF for the ARM Architecture" doc. I hope this covers what you're
asking for?

There's minor changes to the exact spelling of the new flags
(s/EABI/ABI/). I'll send an updated patch with that change and
whatever coding style issues you'd like fixed, just let me know
please.

I've also got a corresponding patch for binutils to generate the new
flags. I'll send that to the binutils list once we're done here.

Cheers,

Steve

----- Forwarded message from Lee Smith <Lee.Smith@arm.com> -----

Date: Tue, 14 Aug 2012 17:10:36 +0100
From: Lee Smith <Lee.Smith@arm.com>
To: Steve McIntyre <steve.mcintyre@arm.com>
CC: arm.eabi@arm.com
Subject: Resend: Proposal to further specify the e_flags field in IHI0044E_aaelf

Hi Steve,

Resending after detailed feedback from you.

I propose the following addition to ELF for the ARM Architecture,
IHI0044E_aaelf. Specifically, I propose that Table 4 2, ARM-specific
e_flags should be extended with three additional rows (the last three
here):

┌────────────────────────────────┬─────────────────────────────────────────────────────────────────┐
│             Value              │                             Meaning                             │
├────────────────────────────────┼─────────────────────────────────────────────────────────────────┤
│         EF_ARM_ABIMASK         │This masks an 8-bit version number, the version of the ABI to    │
│          (0xFF000000)          │which this ELF file conforms.  This ABI is version 5.  A value of│
│(current version is 0x05000000) │0 denotes unknown conformance.                                   │
├────────────────────────────────┼─────────────────────────────────────────────────────────────────┤
│           EF_ARM_BE8           │The ELF file contains BE-8 code, suitable for execution on an ARM│
│          (0x00800000)          │Architecture v6 processor.  This flag must only be set on an     │
│                                │executable file.                                                 │
├────────────────────────────────┼─────────────────────────────────────────────────────────────────┤
│         EF_ARM_GCCMASK         │Legacy code (ABI version 4 and earlier) generated by gcc-arm-xxx │
│          (0x00400FFF)          │might use these bits.                                            │
├────────────────────────────────┼─────────────────────────────────────────────────────────────────┤
│     EF_ARM_ABI_FLOAT_HARD      │Set in executable file headers (e_type = ET_EXEC or ET_DYN) to   │
│          (0x00000400)          │note that the executable file was built to conform to the        │
│   (ABI version 5 and later)    │hardware floating-point procedure-call standard.                 │
│                                │Compatible with legacy (pre version 5) gcc use as                │
│                                │EF_ARM_VFP_FLOAT.                                                │
├────────────────────────────────┼─────────────────────────────────────────────────────────────────┤
│     EF_ARM_ABI_FLOAT_SOFT      │Set in executable file headers (e_type = ET_EXEC or ET_DYN) to   │
│          (0x00000200)          │note explicitly that the executable file was built to conform to │
│   (ABI version 5 and later)    │the software floating-point procedure-call standard (the base    │
│                                │standard). If both EF_ARM_ABI_FLOAT_XXXX bits are clear,         │
│                                │conformance to the base procedure-call standard is implied.      │
│                                │Compatible with legacy (pre version 5) gcc use as                │
│                                │EF_ARM_SOFT_FLOAT.                                               │
└────────────────────────────────┴─────────────────────────────────────────────────────────────────┘

Please review the flag values and names to ensure that I have them exactly
correct and please review the text for precision of intended meaning.

Kind regards,

Lee

--
Lee Smith, ARM Fellow and Director of Technology, SDD
ARM Limited
110 Fulbourn Road
Cambridge CB1 9NJ UK

----- End Forwarded message from Lee Smith <Lee.Smith@arm.com> -----

Cheers,
-- 
Steve McIntyre                                steve.mcintyre@linaro.org
<http://www.linaro.org/> Linaro.org | Open source software for ARM SoCs

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

* Re: ARM hard-float ABI: add ldconfig flag value
  2012-08-22 15:41                         ` Steve McIntyre
@ 2012-08-22 16:13                           ` Joseph S. Myers
  2012-08-23 15:37                             ` Steve McIntyre
  0 siblings, 1 reply; 19+ messages in thread
From: Joseph S. Myers @ 2012-08-22 16:13 UTC (permalink / raw)
  To: Steve McIntyre; +Cc: Roland McGrath, libc-alpha, libc-ports

On Wed, 22 Aug 2012, Steve McIntyre wrote:

> Here's the text that we're planning to add for the next release of the
> "ELF for the ARM Architecture" doc. I hope this covers what you're
> asking for?

Yes, I think this is sufficient.

> There's minor changes to the exact spelling of the new flags
> (s/EABI/ABI/). I'll send an updated patch with that change and
> whatever coding style issues you'd like fixed, just let me know
> please.

I don't know exactly what coding style issues Roland had in mind.  Apart 
from the spaces in function / macro calls that I already mentioned, I 
wouldn't use a space after "!" (but there's nothing specific in the GNU 
Coding Standards on that point, though for GCC avoiding space after "!" is 
a documented convention).

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: ARM hard-float ABI: add ldconfig flag value
  2012-08-22 16:13                           ` Joseph S. Myers
@ 2012-08-23 15:37                             ` Steve McIntyre
  2012-08-23 20:40                               ` Joseph S. Myers
  0 siblings, 1 reply; 19+ messages in thread
From: Steve McIntyre @ 2012-08-23 15:37 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: Roland McGrath, libc-alpha, libc-ports

On Wed, Aug 22, 2012 at 04:12:40PM +0000, Joseph S. Myers wrote:
>On Wed, 22 Aug 2012, Steve McIntyre wrote:
>
>> Here's the text that we're planning to add for the next release of the
>> "ELF for the ARM Architecture" doc. I hope this covers what you're
>> asking for?
>
>Yes, I think this is sufficient.

Awesome :-)

>> There's minor changes to the exact spelling of the new flags
>> (s/EABI/ABI/). I'll send an updated patch with that change and
>> whatever coding style issues you'd like fixed, just let me know
>> please.
>
>I don't know exactly what coding style issues Roland had in mind.  Apart 
>from the spaces in function / macro calls that I already mentioned, I 
>wouldn't use a space after "!" (but there's nothing specific in the GNU 
>Coding Standards on that point, though for GCC avoiding space after "!" is 
>a documented convention).

OK, here's the updated patch with the name change and tweaks to
style. All OK?

diff --git a/elf/elf.h b/elf/elf.h
index 1e67ef5..6c85f92 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -2250,6 +2250,9 @@ typedef Elf32_Addr Elf32_Conflict;
 #define EF_ARM_VFP_FLOAT	0x400
 #define EF_ARM_MAVERICK_FLOAT	0x800
 
+#define EF_ARM_ABI_FLOAT_SOFT	0x200   /* NB conflicts with EF_ARM_SOFT_FLOAT */
+#define EF_ARM_ABI_FLOAT_HARD	0x400   /* NB conflicts with EF_ARM_VFP_FLOAT */
+
 
 /* Other constants defined in the ARM ELF spec. version B-01.  */
 /* NB. These conflict with values defined above.  */
diff --git a/ports/sysdeps/unix/sysv/linux/arm/ldsodefs.h b/ports/sysdeps/unix/sysv/linux/arm/ldsodefs.h
index 8980bb1..77c3d8a 100644
--- a/ports/sysdeps/unix/sysv/linux/arm/ldsodefs.h
+++ b/ports/sysdeps/unix/sysv/linux/arm/ldsodefs.h
@@ -27,10 +27,22 @@
 
 #define EXTRA_OSABI ELFOSABI_ARM_AEABI
 
+#ifdef __ARM_PCS_VFP
+#define VALID_FLOAT_ABI(x) \
+  ((EF_ARM_EABI_VERSION ((x)) != EF_ARM_EABI_VER5)	\
+   || !((x) & EF_ARM_ABI_FLOAT_SOFT))
+#else
+#define VALID_FLOAT_ABI(x) \
+  ((EF_ARM_EABI_VERSION ((x)) != EF_ARM_EABI_VER5)	\
+   || !((x) & EF_ARM_ABI_FLOAT_HARD))
+#endif
+
+#undef VALID_ELF_HEADER
 #define VALID_ELF_HEADER(hdr,exp,size)		\
-  (memcmp (hdr, exp, size) == 0			\
+  ((memcmp (hdr, exp, size) == 0		\
    || memcmp (hdr, expected2, size) == 0	\
-   || memcmp (hdr, expected3, size) == 0)
+    || memcmp (hdr, expected3, size) == 0)	\
+   && VALID_FLOAT_ABI (ehdr->e_flags))
 #define VALID_ELF_OSABI(osabi)		(osabi == ELFOSABI_SYSV		\
 					 || osabi == EXTRA_OSABI	\
 					 || osabi == ELFOSABI_LINUX)


Cheers,
-- 
Steve McIntyre                                steve.mcintyre@linaro.org
<http://www.linaro.org/> Linaro.org | Open source software for ARM SoCs

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

* Re: ARM hard-float ABI: add ldconfig flag value
  2012-08-23 15:37                             ` Steve McIntyre
@ 2012-08-23 20:40                               ` Joseph S. Myers
  2012-08-23 22:56                                 ` Steve McIntyre
  0 siblings, 1 reply; 19+ messages in thread
From: Joseph S. Myers @ 2012-08-23 20:40 UTC (permalink / raw)
  To: Steve McIntyre; +Cc: Roland McGrath, libc-alpha, libc-ports

On Thu, 23 Aug 2012, Steve McIntyre wrote:

> OK, here's the updated patch with the name change and tweaks to
> style. All OK?

I've fixed further coding style issues and added ChangeLog entries and 
committed the patch:

> +#ifdef __ARM_PCS_VFP
> +#define VALID_FLOAT_ABI(x) \
> +  ((EF_ARM_EABI_VERSION ((x)) != EF_ARM_EABI_VER5)	\
> +   || !((x) & EF_ARM_ABI_FLOAT_SOFT))

Space between "#" and "define" inside #if.

>     || memcmp (hdr, expected2, size) == 0	\
> -   || memcmp (hdr, expected3, size) == 0)
> +    || memcmp (hdr, expected3, size) == 0)	\

The first quoted line here also needs the extra indentation to adjust for 
the added parentheses.

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: ARM hard-float ABI: add ldconfig flag value
  2012-08-23 20:40                               ` Joseph S. Myers
@ 2012-08-23 22:56                                 ` Steve McIntyre
  0 siblings, 0 replies; 19+ messages in thread
From: Steve McIntyre @ 2012-08-23 22:56 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: Roland McGrath, libc-alpha, libc-ports

On Thu, Aug 23, 2012 at 08:40:18PM +0000, Joseph S. Myers wrote:
>On Thu, 23 Aug 2012, Steve McIntyre wrote:
>
>> OK, here's the updated patch with the name change and tweaks to
>> style. All OK?
>
>I've fixed further coding style issues and added ChangeLog entries and 
>committed the patch:

Great, thanks. :-)

Cheers,
-- 
Steve McIntyre                                steve.mcintyre@linaro.org
<http://www.linaro.org/> Linaro.org | Open source software for ARM SoCs

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

end of thread, other threads:[~2012-08-23 22:56 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20120727160941.GA13597@linaro.org>
     [not found] ` <20120802165658.GG24537@linaro.org>
2012-08-02 17:28   ` ARM hard-float ABI: add ldconfig flag value Roland McGrath
2012-08-02 17:49     ` Steve McIntyre
2012-08-02 17:55       ` Roland McGrath
2012-08-02 18:14         ` Steve McIntyre
2012-08-02 18:26           ` Roland McGrath
2012-08-03 16:46             ` Steve McIntyre
2012-08-08 13:41               ` Steve McIntyre
2012-08-08 16:31                 ` Roland McGrath
2012-08-08 20:02                 ` Joseph S. Myers
2012-08-09  0:34                   ` Steve McIntyre
2012-08-09 11:10                     ` Joseph S. Myers
2012-08-09 13:21                       ` Steve McIntyre
2012-08-22 15:41                         ` Steve McIntyre
2012-08-22 16:13                           ` Joseph S. Myers
2012-08-23 15:37                             ` Steve McIntyre
2012-08-23 20:40                               ` Joseph S. Myers
2012-08-23 22:56                                 ` Steve McIntyre
2012-08-02 20:50     ` Joseph S. Myers
2012-08-03 17:04       ` Steve McIntyre

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).