This is the mail archive of the binutils@sources.redhat.com 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]

PATCH: Fix Symbian OS .plt header flags


The .plt section for ARM Symbian OS was not being marked SHF_ALLOC.

That's because on this platform we redefine ELF_DYNAMIC_SEC_FLAGS to
mark most dynamic sections (.hash, etc.) as not-loaded.  (In contrast
to normal ELF systems where there are loaded and processed by the
dynamic linker, the BPABI uses a postlinker which postprocesses these
before generating the target executable format.)  The PLT should
always be marked SHF_ALLOC, though, unless bed->plt_not_loaded.

OK?

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2004-10-12  Mark Mitchell  <mark@codesourcery.com>

	* elfarm-nabi.c (ELF_DYNAMIC_SEC_FLAGS): Add comment.
	* elflink.c (_bfd_elf_create_dynamic_sections): For a loaded PLT,
	set SEC_ALLOC and SEC_LOAD.

Index: elfarm-nabi.c
===================================================================
RCS file: /cvs/src/src/bfd/elfarm-nabi.c,v
retrieving revision 1.22
diff -c -5 -p -r1.22 elfarm-nabi.c
*** elfarm-nabi.c	6 Sep 2004 20:55:22 -0000	1.22
--- elfarm-nabi.c	12 Oct 2004 20:07:39 -0000
*************** elf32_arm_symbian_modify_segment_map (ab
*** 964,973 ****
--- 964,975 ----
  }
  
  #undef elf32_bed
  #define elf32_bed elf32_arm_symbian_bed
  
+ /* The dynamic sections are not allocated on SymbianOS; the postlinker
+    will process them and then discard them.  */
  #undef ELF_DYNAMIC_SEC_FLAGS
  #define ELF_DYNAMIC_SEC_FLAGS \
    (SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED)
  
  #undef bfd_elf32_bfd_link_hash_table_create
Index: elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.100
diff -c -5 -p -r1.100 elflink.c
*** elflink.c	6 Sep 2004 17:24:32 -0000	1.100
--- elflink.c	12 Oct 2004 20:07:39 -0000
*************** _bfd_elf_create_dynamic_sections (bfd *a
*** 250,262 ****
    /* We need to create .plt, .rel[a].plt, .got, .got.plt, .dynbss, and
       .rel[a].bss sections.  */
    flags = bed->dynamic_sec_flags;
  
    pltflags = flags;
-   pltflags |= SEC_CODE;
    if (bed->plt_not_loaded)
      pltflags &= ~ (SEC_CODE | SEC_LOAD | SEC_HAS_CONTENTS);
    if (bed->plt_readonly)
      pltflags |= SEC_READONLY;
  
    s = bfd_make_section (abfd, ".plt");
    if (s == NULL
--- 250,266 ----
    /* We need to create .plt, .rel[a].plt, .got, .got.plt, .dynbss, and
       .rel[a].bss sections.  */
    flags = bed->dynamic_sec_flags;
  
    pltflags = flags;
    if (bed->plt_not_loaded)
+     /* We do not clear SEC_ALLOC here because we still want the OS to
+        allocate space for the section; it's just that there's nothing
+        to read in from the object file.  */
      pltflags &= ~ (SEC_CODE | SEC_LOAD | SEC_HAS_CONTENTS);
+   else
+     pltflags |= SEC_ALLOC | SEC_CODE | SEC_LOAD;
    if (bed->plt_readonly)
      pltflags |= SEC_READONLY;
  
    s = bfd_make_section (abfd, ".plt");
    if (s == NULL


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