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] elf32-arm.c: Fix shared library creation on arm-none-symbianelf.


Hi,

Attached is a patch to fix shared library creation on
arm-none-symbianelf.

Consider a simple object file that comes from:

        .comm   g,4,4

When I try to create a shared library with this object file, I get:

./ld-new: a.out: could not find output section .got for input section .got
./ld-new: final link failed: Nonrepresentable section on output

The problem is that the linker wants to output _GLOBAL_OFFSET_SYMBOL_
to the .got section, but before that happens,
elf32_arm_size_dynamic_sections prunes the .got section by adding
SEC_EXCLUDE to the .got section's flags.

The patch fixes the problem by keeping the .got section even if it's
empty.

Tested by building i686-pc-linux-gnu X arm-none-symbianelf.  I have a
strong feeling that I am papering over a real bug elsewhere, but I
don't know where to go from here.

Kazu Hirata

2005-07-25  Kazu Hirata  <kazu@codesourcery.com>

	* elf32-arm.c (elf32_arm_size_dynamic_sections): Don't exclude
	the .got section even if it's empty.

Index: elf32-arm.c
===================================================================
RCS file: /home/gcc/repos/src/src/bfd/elf32-arm.c,v
retrieving revision 1.49
diff -c -d -p -r1.49 elf32-arm.c
*** elf32-arm.c	8 Jul 2005 06:19:58 -0000	1.49
--- elf32-arm.c	25 Jul 2005 17:15:00 -0000
*************** elf32_arm_size_dynamic_sections (bfd * o
*** 5886,5892 ****
  	  continue;
  	}
  
!       if (s->size == 0)
  	{
  	  /* If we don't need this section, strip it from the
  	     output file.  This is mostly to handle .rel.bss and
--- 5886,5896 ----
  	  continue;
  	}
  
!       if (s->size == 0
! 	  /* Some port may output _GLOBAL_OFFSET_TABLE_ even when the
! 	     .got section empty.  Keep it so that we have a place to
! 	     put the symbol.  */
! 	  && strcmp (name, ".got") != 0)
  	{
  	  /* If we don't need this section, strip it from the
  	     output file.  This is mostly to handle .rel.bss and


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