bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/18741] Corrupted .ARM.attributes section with -meabi=gnu o


From: markus.eisenmann at gmx dot at
Subject: [Bug binutils/18741] Corrupted .ARM.attributes section with -meabi=gnu option
Date: Wed, 12 Aug 2015 13:20:50 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=18741

--- Comment #5 from markus.eisenmann at gmx dot at ---
Hi Nick!

I have generated a GCC-Cross-Compiler for arm-eabi, and (have to) use it with
the option ARM-option "-mabi=apcs-gnu" (I.e. OABI);
using:
 GCC 4.9.2
 binutils 2.25 (but this issue still occurs with 2.25.1)
 newlib 2.1.0

In this case the GNU-AS (which is used by the compiler) generates an
.ARM.attributes segment with vendor "aeabi" but no sub-fields (attributes).
Therefore readelf shows an .ARM.attributes-segment with a size of 16 Byte.

But readelf (for this ELF-output) gives me the warning "Unused bytes at end of
section", since there's an empty sub-field (less than 6 byte).

At least, it's more a "problem" of readelf and it's handling of (assumed)
corrupted attribute-entries. On the other hand, it is necessary to emit an
.ARM.attributes section for OABI-compiles?

----------------------------------------------------------------------
Sorry, currently I'm not find a public arm-eabi toolchain which uses binutils
2.25 - but there's the "way" ... :

Compile an empty source-file (I.e. empty.c) with:
>arm-eabi-gcc -c -mabi=apcs-gnu empty.c

>arm-eabi-readelf -a empty.o
will show the .ARM.attributes section (type ARM_ATTRIBUTES) with a size of 16
byte.

If readelf is of version 2.24 it will show the ARM_ATTRIBUTES as:
    No version information found in this file.
    Attribute Section: aeabi
    File Attributes
and nothing more, a version 2.25 readelf instead shows me:
    No version information found in this file.
    Attribute Section: aeabi
    readelf: Error: Unused bytes at end of section

----------------------------------------------------------------------

Background information:
I have to build a newer toolchain for arm-eabi; (very) earlier version of
GCC/binutils (2.19) do not emit an ARM-attributes section in case of OABI.

After building this newer version, I've seen this readelf-warning and thought,
that's really corrupted section; Now I think, it's more a "overshooting"
miss-interpretation by readelf (with Bug 17531). 

Because, I need a toolchain which behave more compatible to earlier
GCC/binutils combinations, I'm using following private work-around:

--- binutils-2.25/gas/write.c   Tue Nov 04 10:54:41 2014
+++ binutils-2.25/gas/write.c   (working copy)
@@ -1772,6 +1772,9 @@
       name = get_elf_backend_data (stdoutput)->obj_attrs_section;
       if (!name)
        name = ".gnu.attributes";
+      // ME: Drop (nearby) empty '.ARM.attributes' section!
+      else if ((size <= 16) && !stricmp(name, ".ARM.attributes")) return;
+
       s = subseg_new (name, 0);
       elf_section_type (s)
        = get_elf_backend_data (stdoutput)->obj_attrs_section_type;
---
to do not emit this section in this (special) case; for EABI>=5 size will be
greater than 16 Byte (because there are ARM-attributes).

I'm not sure, whether an ARM-attributes section is required for OABI-build
(I.e. EABI=0, -mabi=apcs-gnu) ?!

Best regards,
Markus

P.S.: Sorry for noise - if it's not a real issue and more a minor "blemish".

-- 
You are receiving this mail because:
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]