Use info->executable to decide if a .interp section should be present.

Nick Clifton nickc@redhat.com
Tue Nov 11 13:31:00 GMT 2003


Hi Guys,

  I noticed that the size_dynamic_sections() functions in several
  targets were checking (! info->shared) instead of (info->executable)
  to see if a .interp section was present.  I am applying the patch
  below to fix this.

Cheers
        Nick

bfd/ChangeLog        
2003-11-11  Nick Clifton  <nickc@redhat.com>

	* elf-m10300.c (bfd_mn10300_elf_size_dynamic_sections): Use
	info->executable not info->shared to decide if a .interp section
	should be present.
	* elf32-arm.h (elf32_arm_size_dynamic_sections): Likewise.
	* elf32-cris.c (elf_cris_size_dynamic_sections): Likewise.
	* elf32-hppa.c (elf32_hppa_size_dynamic_sections): Likewise.
	* elf32-i370.c (i370_elf_size_dynamic_sections): Likewise.
	* elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
	* elf32-vax.c (elf_vax_size_dynamic_sections): Likewise.
	* elf32-xtensa.c (elf_xtensa_size_dynamic_sections): Likewise.
	* elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise.
	* elfxx-mips.c (_bfd_mips_size_dynamic_sections): Likewise.
	* elflink.h (size_dynamic_sections): Likewise.

Index: bfd/elf-m10300.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-m10300.c,v
retrieving revision 1.43
diff -c -3 -p -r1.43 elf-m10300.c
*** bfd/elf-m10300.c	5 Nov 2003 13:17:08 -0000	1.43
--- bfd/elf-m10300.c	11 Nov 2003 12:30:57 -0000
*************** _bfd_mn10300_elf_size_dynamic_sections (
*** 4351,4357 ****
    if (elf_hash_table (info)->dynamic_sections_created)
      {
        /* Set the contents of the .interp section to the interpreter.  */
!       if (! info->shared)
  	{
  	  s = bfd_get_section_by_name (dynobj, ".interp");
  	  BFD_ASSERT (s != NULL);
--- 4351,4357 ----
    if (elf_hash_table (info)->dynamic_sections_created)
      {
        /* Set the contents of the .interp section to the interpreter.  */
!       if (info->executable)
  	{
  	  s = bfd_get_section_by_name (dynobj, ".interp");
  	  BFD_ASSERT (s != NULL);
Index: bfd/elf32-arm.h
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.h,v
retrieving revision 1.115
diff -c -3 -p -r1.115 elf32-arm.h
*** bfd/elf32-arm.h	5 Nov 2003 13:17:08 -0000	1.115
--- bfd/elf32-arm.h	11 Nov 2003 12:31:01 -0000
*************** elf32_arm_size_dynamic_sections (output_
*** 3523,3529 ****
    if (elf_hash_table (info)->dynamic_sections_created)
      {
        /* Set the contents of the .interp section to the interpreter.  */
!       if (! info->shared)
  	{
  	  s = bfd_get_section_by_name (dynobj, ".interp");
  	  BFD_ASSERT (s != NULL);
--- 3523,3529 ----
    if (elf_hash_table (info)->dynamic_sections_created)
      {
        /* Set the contents of the .interp section to the interpreter.  */
!       if (info->executable)
  	{
  	  s = bfd_get_section_by_name (dynobj, ".interp");
  	  BFD_ASSERT (s != NULL);
Index: bfd/elf32-cris.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-cris.c,v
retrieving revision 1.45
diff -c -3 -p -r1.45 elf32-cris.c
*** bfd/elf32-cris.c	5 Nov 2003 13:17:08 -0000	1.45
--- bfd/elf32-cris.c	11 Nov 2003 12:31:06 -0000
*************** elf_cris_size_dynamic_sections (output_b
*** 2638,2644 ****
    if (elf_hash_table (info)->dynamic_sections_created)
      {
        /* Set the contents of the .interp section to the interpreter.  */
!       if (!info->shared)
  	{
  	  s = bfd_get_section_by_name (dynobj, ".interp");
  	  BFD_ASSERT (s != NULL);
--- 2638,2644 ----
    if (elf_hash_table (info)->dynamic_sections_created)
      {
        /* Set the contents of the .interp section to the interpreter.  */
!       if (info->executable)
  	{
  	  s = bfd_get_section_by_name (dynobj, ".interp");
  	  BFD_ASSERT (s != NULL);
Index: bfd/elf32-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-hppa.c,v
retrieving revision 1.108
diff -c -3 -p -r1.108 elf32-hppa.c
*** bfd/elf32-hppa.c	5 Nov 2003 13:17:08 -0000	1.108
--- bfd/elf32-hppa.c	11 Nov 2003 12:31:09 -0000
*************** elf32_hppa_size_dynamic_sections (bfd *o
*** 2047,2053 ****
    if (htab->elf.dynamic_sections_created)
      {
        /* Set the contents of the .interp section to the interpreter.  */
!       if (! info->shared)
  	{
  	  s = bfd_get_section_by_name (dynobj, ".interp");
  	  if (s == NULL)
--- 2047,2053 ----
    if (htab->elf.dynamic_sections_created)
      {
        /* Set the contents of the .interp section to the interpreter.  */
!       if (info->executable)
  	{
  	  s = bfd_get_section_by_name (dynobj, ".interp");
  	  if (s == NULL)
Index: bfd/elf32-i370.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i370.c,v
retrieving revision 1.29
diff -c -3 -p -r1.29 elf32-i370.c
*** bfd/elf32-i370.c	5 Nov 2003 13:17:09 -0000	1.29
--- bfd/elf32-i370.c	11 Nov 2003 12:31:10 -0000
*************** i370_elf_size_dynamic_sections (output_b
*** 653,659 ****
    if (elf_hash_table (info)->dynamic_sections_created)
      {
        /* Set the contents of the .interp section to the interpreter.  */
!       if (! info->shared)
  	{
  	  s = bfd_get_section_by_name (dynobj, ".interp");
  	  BFD_ASSERT (s != NULL);
--- 653,659 ----
    if (elf_hash_table (info)->dynamic_sections_created)
      {
        /* Set the contents of the .interp section to the interpreter.  */
!       if (info->executable)
  	{
  	  s = bfd_get_section_by_name (dynobj, ".interp");
  	  BFD_ASSERT (s != NULL);
Index: bfd/elf32-m68k.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m68k.c,v
retrieving revision 1.59
diff -c -3 -p -r1.59 elf32-m68k.c
*** bfd/elf32-m68k.c	5 Nov 2003 13:17:09 -0000	1.59
--- bfd/elf32-m68k.c	11 Nov 2003 12:31:12 -0000
*************** elf_m68k_size_dynamic_sections (output_b
*** 1127,1133 ****
    if (elf_hash_table (info)->dynamic_sections_created)
      {
        /* Set the contents of the .interp section to the interpreter.  */
!       if (!info->shared)
  	{
  	  s = bfd_get_section_by_name (dynobj, ".interp");
  	  BFD_ASSERT (s != NULL);
--- 1127,1133 ----
    if (elf_hash_table (info)->dynamic_sections_created)
      {
        /* Set the contents of the .interp section to the interpreter.  */
!       if (info->executable)
  	{
  	  s = bfd_get_section_by_name (dynobj, ".interp");
  	  BFD_ASSERT (s != NULL);
Index: bfd/elf32-vax.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-vax.c,v
retrieving revision 1.15
diff -c -3 -p -r1.15 elf32-vax.c
*** bfd/elf32-vax.c	5 Nov 2003 13:17:09 -0000	1.15
--- bfd/elf32-vax.c	11 Nov 2003 12:31:14 -0000
*************** elf_vax_size_dynamic_sections (output_bf
*** 1149,1155 ****
    if (elf_hash_table (info)->dynamic_sections_created)
      {
        /* Set the contents of the .interp section to the interpreter.  */
!       if (!info->shared)
  	{
  	  s = bfd_get_section_by_name (dynobj, ".interp");
  	  BFD_ASSERT (s != NULL);
--- 1149,1155 ----
    if (elf_hash_table (info)->dynamic_sections_created)
      {
        /* Set the contents of the .interp section to the interpreter.  */
!       if (info->executable)
  	{
  	  s = bfd_get_section_by_name (dynobj, ".interp");
  	  BFD_ASSERT (s != NULL);
Index: bfd/elf32-xtensa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-xtensa.c,v
retrieving revision 1.16
diff -c -3 -p -r1.16 elf32-xtensa.c
*** bfd/elf32-xtensa.c	5 Nov 2003 13:17:09 -0000	1.16
--- bfd/elf32-xtensa.c	11 Nov 2003 12:31:19 -0000
*************** elf_xtensa_size_dynamic_sections (output
*** 1176,1182 ****
    if (elf_hash_table (info)->dynamic_sections_created)
      {
        /* Set the contents of the .interp section to the interpreter.  */
!       if (! info->shared)
  	{
  	  s = bfd_get_section_by_name (dynobj, ".interp");
  	  if (s == NULL)
--- 1176,1182 ----
    if (elf_hash_table (info)->dynamic_sections_created)
      {
        /* Set the contents of the .interp section to the interpreter.  */
!       if (info->executable)
  	{
  	  s = bfd_get_section_by_name (dynobj, ".interp");
  	  if (s == NULL)
Index: bfd/elf64-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-hppa.c,v
retrieving revision 1.40
diff -c -3 -p -r1.40 elf64-hppa.c
*** bfd/elf64-hppa.c	3 Nov 2003 15:17:39 -0000	1.40
--- bfd/elf64-hppa.c	11 Nov 2003 12:31:22 -0000
*************** elf64_hppa_size_dynamic_sections (output
*** 1642,1648 ****
    if (elf_hash_table (info)->dynamic_sections_created)
      {
        /* Set the contents of the .interp section to the interpreter.  */
!       if (! info->shared)
  	{
  	  s = bfd_get_section_by_name (dynobj, ".interp");
  	  BFD_ASSERT (s != NULL);
--- 1642,1648 ----
    if (elf_hash_table (info)->dynamic_sections_created)
      {
        /* Set the contents of the .interp section to the interpreter.  */
!       if (info->executable)
  	{
  	  s = bfd_get_section_by_name (dynobj, ".interp");
  	  BFD_ASSERT (s != NULL);
Index: bfd/elflink.h
===================================================================
RCS file: /cvs/src/src/bfd/elflink.h,v
retrieving revision 1.246
diff -c -3 -p -r1.246 elflink.h
*** bfd/elflink.h	4 Nov 2003 06:16:34 -0000	1.246
--- bfd/elflink.h	11 Nov 2003 12:31:28 -0000
*************** NAME(bfd_elf,size_dynamic_sections) (bfd
*** 1981,1987 ****
        bfd_boolean all_defined;
  
        *sinterpptr = bfd_get_section_by_name (dynobj, ".interp");
!       BFD_ASSERT (*sinterpptr != NULL || info->shared);
  
        if (soname != NULL)
  	{
--- 1981,1987 ----
        bfd_boolean all_defined;
  
        *sinterpptr = bfd_get_section_by_name (dynobj, ".interp");
!       BFD_ASSERT (*sinterpptr != NULL || !info->executable);
  
        if (soname != NULL)
  	{
Index: bfd/elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.80
diff -c -3 -p -r1.80 elfxx-mips.c
*** bfd/elfxx-mips.c	4 Nov 2003 10:41:51 -0000	1.80
--- bfd/elfxx-mips.c	11 Nov 2003 12:31:37 -0000
*************** _bfd_mips_elf_size_dynamic_sections (out
*** 5871,5877 ****
    if (elf_hash_table (info)->dynamic_sections_created)
      {
        /* Set the contents of the .interp section to the interpreter.  */
!       if (! info->shared)
  	{
  	  s = bfd_get_section_by_name (dynobj, ".interp");
  	  BFD_ASSERT (s != NULL);
--- 5871,5877 ----
    if (elf_hash_table (info)->dynamic_sections_created)
      {
        /* Set the contents of the .interp section to the interpreter.  */
!       if (info->executable)
  	{
  	  s = bfd_get_section_by_name (dynobj, ".interp");
  	  BFD_ASSERT (s != NULL);
        



More information about the Binutils mailing list