public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PATCH: Fix Symbian OS .plt header flags
@ 2004-10-12 20:10 Mark Mitchell
  2004-10-18 16:24 ` Nick Clifton
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Mitchell @ 2004-10-12 20:10 UTC (permalink / raw)
  To: binutils


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

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

* Re: PATCH: Fix Symbian OS .plt header flags
  2004-10-12 20:10 PATCH: Fix Symbian OS .plt header flags Mark Mitchell
@ 2004-10-18 16:24 ` Nick Clifton
  2004-10-19  6:35   ` Mark Mitchell
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Clifton @ 2004-10-18 16:24 UTC (permalink / raw)
  To: mark; +Cc: binutils

Hi Mark,

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

Approved - please apply.

Cheers
   Nick


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

* Re: PATCH: Fix Symbian OS .plt header flags
  2004-10-18 16:24 ` Nick Clifton
@ 2004-10-19  6:35   ` Mark Mitchell
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Mitchell @ 2004-10-19  6:35 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils

Nick Clifton wrote:

> Hi Mark,
> 
>> 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.
> 
> 
> Approved - please apply.

Done, thanks.

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

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

end of thread, other threads:[~2004-10-19  6:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-12 20:10 PATCH: Fix Symbian OS .plt header flags Mark Mitchell
2004-10-18 16:24 ` Nick Clifton
2004-10-19  6:35   ` Mark Mitchell

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