This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] XCOFF/AIX: Remove SEC_ALLOC flags for unmapped sections.


Hello,

objdump -h on AIX shows that the flags for the .loader section
are:

      3 .loader       00001d0f  00000000  00000000  00001450  2**3
                      CONTENTS, ALLOC, LOAD

This causes the following kind of problem in GDB:

      | During symbol reading...unexpected overlap between:
      |  (A) section `.bss' from `/[...]/gdb' [0x2005e290, 0x200850b8)
      |  (B) section `.loader' from `/[...]/gdb' [0x20084ff8, 0x2010e620).
      | Will ignore section B...

The warning is telling us that GDB detected that the address
range after relocation of two sections overlap, which is unexpected.
But what's more unexpected is that the .loader section is not
mapped to memory by the system loader.

The set of flags associated to each section is actually computed
from the section type (STYP_*). This patch fixes the section-type-
to-bfd-section-flags routine to remove the SEC_ALLOC flag for
the .except, .loader and .typchk sections.

bfd/ChangeLog:

        * coffcode.h (styp_to_sec_flags) [RS6000COFF_C]: Add handling
        of STYP_EXCEPT, STYP_LOADER and STYP_TYPCHK sections.

ld/testsuite/ChangeLog:

        * ld-powerpc/aix-core-sec-1.hd, aix-core-sec-2.hd,
        ld-powerpc/aix-core-sec-3.hd: Adjust expected section flags
        for section .loader.

Tested using the various binutils testsuites as well as through
AdaCore's internal GDB testsuite.  This fixes the problem above.

OK to commit?

Thank you,
-- 
Joel

---
 bfd/coffcode.h                            |    6 ++++++
 ld/testsuite/ld-powerpc/aix-core-sec-1.hd |    2 +-
 ld/testsuite/ld-powerpc/aix-core-sec-2.hd |    2 +-
 ld/testsuite/ld-powerpc/aix-core-sec-3.hd |    2 +-
 4 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 9d9c992..2a1a172 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -795,6 +795,12 @@ styp_to_sec_flags (bfd *abfd ATTRIBUTE_UNUSED,
   else if (styp_flags & STYP_PAD)
     sec_flags = 0;
 #ifdef RS6000COFF_C
+  else if (styp_flags & STYP_EXCEPT)
+    sec_flags |= SEC_LOAD;
+  else if (styp_flags & STYP_LOADER)
+    sec_flags |= SEC_LOAD;
+  else if (styp_flags & STYP_TYPCHK)
+    sec_flags |= SEC_LOAD;
   else if (styp_flags & STYP_DWARF)
     sec_flags |= SEC_DEBUGGING;
 #endif
diff --git a/ld/testsuite/ld-powerpc/aix-core-sec-1.hd b/ld/testsuite/ld-powerpc/aix-core-sec-1.hd
index 19d09e4..8d81e50 100644
--- a/ld/testsuite/ld-powerpc/aix-core-sec-1.hd
+++ b/ld/testsuite/ld-powerpc/aix-core-sec-1.hd
@@ -8,4 +8,4 @@ Sections:
  * 2 * \.bss * 0+0 .*
  * ALLOC
  * 3 * \.loader .*
- * CONTENTS, ALLOC, LOAD
+ * CONTENTS, LOAD
diff --git a/ld/testsuite/ld-powerpc/aix-core-sec-2.hd b/ld/testsuite/ld-powerpc/aix-core-sec-2.hd
index 39facd8..1152013 100644
--- a/ld/testsuite/ld-powerpc/aix-core-sec-2.hd
+++ b/ld/testsuite/ld-powerpc/aix-core-sec-2.hd
@@ -8,4 +8,4 @@ Sections:
  * 2 * \.bss * 0+0 .*
  * ALLOC
  * 3 * \.loader .*
- * CONTENTS, ALLOC, LOAD
+ * CONTENTS, LOAD
diff --git a/ld/testsuite/ld-powerpc/aix-core-sec-3.hd b/ld/testsuite/ld-powerpc/aix-core-sec-3.hd
index f7acc39..61a93ae 100644
--- a/ld/testsuite/ld-powerpc/aix-core-sec-3.hd
+++ b/ld/testsuite/ld-powerpc/aix-core-sec-3.hd
@@ -8,4 +8,4 @@ Sections:
  * 2 * \.bss * 0+8 .*
  * ALLOC
  * 3 * \.loader .*
- * CONTENTS, ALLOC, LOAD
+ * CONTENTS, LOAD
-- 
1.7.10.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]