backends/ppc_attrs.c: Add PPC long double tags
Commit Message
When an explicit type of long double is specified in the ELF
GNU_Power_ABI_FP attribute, elflint and friends were erroring out:
section [36] '.gnu.attributes': offset 15: unrecognized GNU_Power_ABI_FP attribute value 9
Add the different long double tags to fp_kinds so that these values
are correctly recognised and printed.
Signed-off-by: A. Wilcox <AWilcox@Wilcox-Tech.com>
---
backends/ppc_attrs.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
Comments
Hi,
On Tue, 2025-05-27 at 00:05 -0500, A. Wilcox wrote:
> When an explicit type of long double is specified in the ELF
> GNU_Power_ABI_FP attribute, elflint and friends were erroring out:
>
> section [36] '.gnu.attributes': offset 15: unrecognized GNU_Power_ABI_FP attribute value 9
>
> Add the different long double tags to fp_kinds so that these values
> are correctly recognised and printed.
This is probably correct, but do you happen to have a reference where
these GNU_Power_ABI_FP attribute are defined? Then we can add that to
the source as comment so we can easily look them up in the future.
Cheers,
Mark
> Signed-off-by: A. Wilcox <AWilcox@Wilcox-Tech.com>
> ---
> backends/ppc_attrs.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/backends/ppc_attrs.c b/backends/ppc_attrs.c
> index 48d7129d..6b00bccd 100644
> --- a/backends/ppc_attrs.c
> +++ b/backends/ppc_attrs.c
> @@ -52,6 +52,18 @@ ppc_check_object_attribute (Ebl *ebl __attribute__ ((unused)),
> "Hard float",
> "Soft float",
> "Single-precision hard float",
> + "Hard or soft float (IBM style long doubles)",
> + "Hard float (IBM style long doubles)",
> + "Soft float (IBM style long doubles)",
> + "Single-precision hard float (IBM style long doubles)",
> + "Hard or soft float (64-bit long doubles)",
> + "Hard float (64-bit long doubles)",
> + "Soft float (64-bit long doubles)",
> + "Single-precision hard float (64-bit long doubles)",
> + "Hard or soft float (IEEE 128-bit long doubles)",
> + "Hard float (IEEE 128-bit long doubles)",
> + "Soft float (IEEE 128-bit long doubles)",
> + "Single-precision hard float (IEEE 128-bit long doubles)",
> };
> if (value < sizeof fp_kinds / sizeof fp_kinds[0])
> *value_name = fp_kinds[value];
Hi Mark,
Unfortunately, the only reference I am aware of for GNU attributes is
the GCC compiler source itself; these constants are defined in
gcc/config/rs6000/rs6000.cc in rs6000_elf_file_end.
Best,
-Anna
On May 27, 2025, at 8:19 AM, Mark Wielaard <mark@klomp.org> wrote:
> Hi,
>
> On Tue, 2025-05-27 at 00:05 -0500, A. Wilcox wrote:
>> When an explicit type of long double is specified in the ELF
>> GNU_Power_ABI_FP attribute, elflint and friends were erroring out:
>>
>> section [36] '.gnu.attributes': offset 15: unrecognized GNU_Power_ABI_FP attribute value 9
>>
>> Add the different long double tags to fp_kinds so that these values
>> are correctly recognised and printed.
>
> This is probably correct, but do you happen to have a reference where
> these GNU_Power_ABI_FP attribute are defined? Then we can add that to
> the source as comment so we can easily look them up in the future.
>
> Cheers,
>
> Mark
>
>> Signed-off-by: A. Wilcox <AWilcox@Wilcox-Tech.com>
>> ---
>> backends/ppc_attrs.c | 12 ++++++++++++
>> 1 file changed, 12 insertions(+)
>>
>> diff --git a/backends/ppc_attrs.c b/backends/ppc_attrs.c
>> index 48d7129d..6b00bccd 100644
>> --- a/backends/ppc_attrs.c
>> +++ b/backends/ppc_attrs.c
>> @@ -52,6 +52,18 @@ ppc_check_object_attribute (Ebl *ebl __attribute__ ((unused)),
>> "Hard float",
>> "Soft float",
>> "Single-precision hard float",
>> + "Hard or soft float (IBM style long doubles)",
>> + "Hard float (IBM style long doubles)",
>> + "Soft float (IBM style long doubles)",
>> + "Single-precision hard float (IBM style long doubles)",
>> + "Hard or soft float (64-bit long doubles)",
>> + "Hard float (64-bit long doubles)",
>> + "Soft float (64-bit long doubles)",
>> + "Single-precision hard float (64-bit long doubles)",
>> + "Hard or soft float (IEEE 128-bit long doubles)",
>> + "Hard float (IEEE 128-bit long doubles)",
>> + "Soft float (IEEE 128-bit long doubles)",
>> + "Single-precision hard float (IEEE 128-bit long doubles)",
>> };
>> if (value < sizeof fp_kinds / sizeof fp_kinds[0])
>> *value_name = fp_kinds[value];
Hi Anna,
On Thu, May 29, 2025 at 11:43 PM A. Wilcox <AWilcox@wilcox-tech.com> wrote:
>
> Unfortunately, the only reference I am aware of for GNU attributes is
> the GCC compiler source itself; these constants are defined in
> gcc/config/rs6000/rs6000.cc in rs6000_elf_file_end.
LGTM, I've pushed this patch.
Thanks,
Aaron
@@ -52,6 +52,18 @@ ppc_check_object_attribute (Ebl *ebl __attribute__ ((unused)),
"Hard float",
"Soft float",
"Single-precision hard float",
+ "Hard or soft float (IBM style long doubles)",
+ "Hard float (IBM style long doubles)",
+ "Soft float (IBM style long doubles)",
+ "Single-precision hard float (IBM style long doubles)",
+ "Hard or soft float (64-bit long doubles)",
+ "Hard float (64-bit long doubles)",
+ "Soft float (64-bit long doubles)",
+ "Single-precision hard float (64-bit long doubles)",
+ "Hard or soft float (IEEE 128-bit long doubles)",
+ "Hard float (IEEE 128-bit long doubles)",
+ "Soft float (IEEE 128-bit long doubles)",
+ "Single-precision hard float (IEEE 128-bit long doubles)",
};
if (value < sizeof fp_kinds / sizeof fp_kinds[0])
*value_name = fp_kinds[value];