include/elf/
authorNathan Sidwell <nathan@codesourcery.com>
Thu, 8 Nov 2007 13:51:07 +0000 (13:51 +0000)
committerNathan Sidwell <nathan@codesourcery.com>
Thu, 8 Nov 2007 13:51:07 +0000 (13:51 +0000)
* vxworks.h: New.

bfd/
* elf-vxworks.h (elf_vxworks_add_dynamic_entries): Declare.
(elf_vxworks_finish_dynamic_entry): Declare.
* elf-vxworks.c: Include elf/vxworks.h.
(elf_vxworks_add_dynamic_entries): New.
(elf_vxworks_finish_dynamic_entry): New.
* Makefile.am (elf-vxworks.lo): Add dependency.
* Makefile.in (elf-vxworks.lo): Add dependency.
* elf32-i386.c (elf_i386_size_dynamic_sections,
elf_i386_finish_dynamic_sections): Call
elf_vxworks_add_dynamic_entries and
elf_vxworks_finish_dynamic_entry.
* elf32-ppc.c (ppc_elf_size_dynamic_sections,
ppc_elf_finish_dynamic_sections): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections,
sparc_finish_dyn): Likewise.
* elf32-sh.c (sh_elf_size_dynamic_sections,
sh_elf_finish_dynamic_sections): Likewise.
* elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections,
_bfd_mips_elf_finish_dynamic_sections): Likewise.
* elf32-arm.c (elf32_arm_size_dynamic_sections,
elf32_arm_finish_dynamic_sections): Likewise.

ld/
* ld-vxworks/tls-2.d: New.
* ld-vxworks/tls-2.s: New.

14 files changed:
bfd/ChangeLog
bfd/Makefile.am
bfd/Makefile.in
bfd/elf32-arm.c
bfd/elf32-i386.c
bfd/elf32-ppc.c
bfd/elf32-sh.c
bfd/elfxx-mips.c
bfd/elfxx-sparc.c
include/elf/ChangeLog
include/elf/vxworks.h [new file with mode: 0644]
ld/testsuite/ChangeLog
ld/testsuite/ld-vxworks/tls-2.d [new file with mode: 0644]
ld/testsuite/ld-vxworks/tls-2.s [new file with mode: 0644]

index b05c8eefe6aacbea058d8568efd7df55727977b4..5b37351eccba9da7817f113cc718fa4b405386d0 100644 (file)
@@ -1,3 +1,27 @@
+2007-11-08  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * elf-vxworks.h (elf_vxworks_add_dynamic_entries): Declare.
+       (elf_vxworks_finish_dynamic_entry): Declare.
+       * elf-vxworks.c: Include elf/vxworks.h.
+       (elf_vxworks_add_dynamic_entries): New.
+       (elf_vxworks_finish_dynamic_entry): New.
+       * Makefile.am (elf-vxworks.lo): Add dependency.
+       * Makefile.in (elf-vxworks.lo): Add dependency.
+       * elf32-i386.c (elf_i386_size_dynamic_sections,
+       elf_i386_finish_dynamic_sections): Call
+       elf_vxworks_add_dynamic_entries and
+       elf_vxworks_finish_dynamic_entry.
+       * elf32-ppc.c (ppc_elf_size_dynamic_sections,
+       ppc_elf_finish_dynamic_sections): Likewise.
+       * elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections,
+       sparc_finish_dyn): Likewise.
+       * elf32-sh.c (sh_elf_size_dynamic_sections,
+       sh_elf_finish_dynamic_sections): Likewise.
+       * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections,
+       _bfd_mips_elf_finish_dynamic_sections): Likewise.
+       * elf32-arm.c (elf32_arm_size_dynamic_sections,
+       elf32_arm_finish_dynamic_sections): Likewise.
+
 2007-11-07  Olivier Hainque  <hainque@adacore.com>
 
        * bfd/elfxx-mips.c (_bfd_mips_elf_fake_sections): Force
index 3d92daee53bf553a3fcc924527ed7c37ea93901c..0ee4e3ea79f9f34cbf796776b32034add81a862b 100644 (file)
@@ -1580,7 +1580,7 @@ elf-eh-frame.lo: elf-eh-frame.c $(INCDIR)/filenames.h \
 elf-vxworks.lo: elf-vxworks.c $(INCDIR)/filenames.h \
   $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
-  elf-vxworks.h
+  $(INCDIR)/elf/vxworks.h elf-vxworks.h
 epoc-pe-arm.lo: epoc-pe-arm.c pe-arm.c $(INCDIR)/filenames.h \
   coff-arm.c $(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h \
   $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
index 3e5ee0a8ac48955baac67540a668e3d5316cd91d..df0e45ae64765db6e1452e3d0e4800a35f4ad491 100644 (file)
@@ -2160,7 +2160,7 @@ elf-eh-frame.lo: elf-eh-frame.c $(INCDIR)/filenames.h \
 elf-vxworks.lo: elf-vxworks.c $(INCDIR)/filenames.h \
   $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
-  elf-vxworks.h
+  $(INCDIR)/elf/vxworks.h elf-vxworks.h
 epoc-pe-arm.lo: epoc-pe-arm.c pe-arm.c $(INCDIR)/filenames.h \
   coff-arm.c $(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h \
   $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
index cbde697360b069c35c0d8c37d829204e39cd15a5..0e8e4239e7ad09199bb01ddf6d0f85663d613762 100644 (file)
@@ -8723,6 +8723,9 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
          if (!add_dynamic_entry (DT_TEXTREL, 0))
            return FALSE;
        }
+      if (htab->vxworks_p
+         && !elf_vxworks_add_dynamic_entries (output_bfd, info))
+       return FALSE;
     }
 #undef add_dynamic_entry
 
@@ -9065,6 +9068,9 @@ elf32_arm_finish_dynamic_sections (bfd * output_bfd, struct bfd_link_info * info
              unsigned int type;
 
            default:
+             if (htab->vxworks_p
+                 && elf_vxworks_finish_dynamic_entry (output_bfd, &dyn))
+               bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
              break;
 
            case DT_HASH:
index e2396ce140df890d8ffb870ec815e9805eaf987f..802c2b1450536cbe42ad80402a47ca205d4212d2 100644 (file)
@@ -2374,6 +2374,9 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
                return FALSE;
            }
        }
+      if (htab->is_vxworks
+         && !elf_vxworks_add_dynamic_entries (output_bfd, info))
+       return FALSE;
     }
 #undef add_dynamic_entry
 
@@ -3796,6 +3799,9 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
          switch (dyn.d_tag)
            {
            default:
+             if (htab->is_vxworks
+                 && elf_vxworks_finish_dynamic_entry (output_bfd, &dyn))
+               break;
              continue;
 
            case DT_PLTGOT:
index 17978a0bef74447ae301c1f0380cd1ce3dc28572..69cc740e81775533a670aed22a5e6a878d70aaf0 100644 (file)
@@ -5188,7 +5188,10 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
          if (!add_dynamic_entry (DT_TEXTREL, 0))
            return FALSE;
        }
-    }
+      if (htab->is_vxworks
+         && !elf_vxworks_add_dynamic_entries (output_bfd, info))
+       return FALSE;
+   }
 #undef add_dynamic_entry
 
   return TRUE;
@@ -7353,6 +7356,9 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd,
              continue;
 
            default:
+             if (htab->is_vxworks
+                 && elf_vxworks_finish_dynamic_entry (output_bfd, &dyn))
+               break;
              continue;
            }
 
index 3d4a2ffd6229e28f6e7fcb27ef9e5925f0fe08b5..24ac5bbfdb4e685e5b379fb3c8b64b8ca09a8ae1 100644 (file)
@@ -3138,6 +3138,9 @@ sh_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
                return FALSE;
            }
        }
+      if (htab->vxworks_p
+         && !elf_vxworks_add_dynamic_entries (output_bfd, info))
+       return FALSE;
     }
 #undef add_dynamic_entry
 
@@ -5763,6 +5766,9 @@ sh_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
          switch (dyn.d_tag)
            {
            default:
+             if (htab->vxworks_p
+                 && elf_vxworks_finish_dynamic_entry (output_bfd, &dyn))
+               bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
              break;
 
 #ifdef INCLUDE_SHMEDIA
index c571077fa63a0cf65887f2f6c47f387a76e7882c..217cd9207bea12132de316367794547859d9889f 100644 (file)
@@ -7674,6 +7674,9 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
              && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_OPTIONS, 0))
            return FALSE;
        }
+      if (htab->is_vxworks
+         && !elf_vxworks_add_dynamic_entries (output_bfd, info))
+       return FALSE;
     }
 
   return TRUE;
@@ -8901,6 +8904,9 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd,
 
            default:
              swap_out_p = FALSE;
+             if (htab->is_vxworks
+                 && elf_vxworks_finish_dynamic_entry (output_bfd, &dyn))
+               swap_out_p = TRUE;
              break;
            }
 
index 736f044ab7d5a8379802038dd1419c3f894e7c6b..79f8f86d0d3092115a27d541e8cf60ffd589215f 100644 (file)
@@ -2396,6 +2396,9 @@ _bfd_sparc_elf_size_dynamic_sections (bfd *output_bfd,
                eht->dynsymcount++;
              }
        }
+      if (htab->is_vxworks
+         && !elf_vxworks_add_dynamic_entries (output_bfd, info))
+       return FALSE;
     }
 #undef add_dynamic_entry
 
@@ -3846,6 +3849,9 @@ sparc_finish_dyn (bfd *output_bfd, struct bfd_link_info *info,
              bed->s->swap_dyn_out (output_bfd, &dyn, dyncon);
            }
        }
+      else if (htab->is_vxworks
+              && elf_vxworks_finish_dynamic_entry (output_bfd, &dyn))
+       bed->s->swap_dyn_out (output_bfd, &dyn, dyncon);
       else if (abi_64_p && dyn.d_tag == DT_SPARC_REGISTER)
        {
          if (stt_regidx == -1)
index 57bcd3b63d876c25c3dd025505b0d40f0337e691..fdce868c1b7a8ca474fe3fe7690d3b1d1202fc58 100644 (file)
@@ -1,3 +1,7 @@
+2007-11-08  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * vxworks.h: New.
+
 2007-10-30  Nick Clifton  <nickc@redhat.com>
 
        * mn10300.h (R_MN10300_ALIGN): Define.
diff --git a/include/elf/vxworks.h b/include/elf/vxworks.h
new file mode 100644 (file)
index 0000000..394de30
--- /dev/null
@@ -0,0 +1,33 @@
+/* VxWorks ELF support for BFD.
+   Copyright 2007
+   Free Software Foundation, Inc.
+
+   Contributed by Nathan Sidwell <nathan@codesourcery.com>
+
+This file is part of BFD, the Binary File Descriptor library.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+MA 02110-1301, USA.  */
+
+#ifndef _ELF_VXWORKS_H
+#define _ELF_VXWORKS_H
+
+#define DT_VX_WRS_TLS_DATA_START 0x60000010
+#define DT_VX_WRS_TLS_DATA_SIZE  0x60000011
+#define DT_VX_WRS_TLS_DATA_ALIGN 0x60000015
+#define DT_VX_WRS_TLS_VARS_START 0x60000012
+#define DT_VX_WRS_TLS_VARS_SIZE  0x60000013
+  
+#endif /* _ELF_VXWORKS_H */
index 4da2964ef466537132c9bb33100d13319a35302b..08052995ef5818ffad5f8e0ced481981f4afa536 100644 (file)
@@ -1,3 +1,8 @@
+2007-11-08  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * ld-vxworks/tls-2.d: New.
+       * ld-vxworks/tls-2.s: New.
+
 2007-11-07  Nathan Sidwell  <nathan@codesourcery.com>
 
        * ld-vxworks/tls-1.d: New.
diff --git a/ld/testsuite/ld-vxworks/tls-2.d b/ld/testsuite/ld-vxworks/tls-2.d
new file mode 100644 (file)
index 0000000..4278355
--- /dev/null
@@ -0,0 +1,11 @@
+# source: tls-2.s
+# ld: --entry foo -q --force-dynamic
+# readelf: -d
+
+#...
+ 0x60000010 \(Operating System specific: 60000010\)        0x[0-9a-f]+
+ 0x60000011 \(Operating System specific: 60000011\)        0x4
+ 0x60000015 \(Operating System specific: 60000015\)        0x4
+ 0x60000012 \(Operating System specific: 60000012\)        0x[0-9a-f]+
+ 0x60000013 \(Operating System specific: 60000013\)        0xc
+#...
diff --git a/ld/testsuite/ld-vxworks/tls-2.s b/ld/testsuite/ld-vxworks/tls-2.s
new file mode 100644 (file)
index 0000000..8fa97ab
--- /dev/null
@@ -0,0 +1,19 @@
+       .globl  foo
+foo:
+
+       .section        .tls_data
+       .p2align        2
+       .type   i,%object
+       .size   i,4
+i:
+       .space  4
+       .globl  __tls__i
+       .section        .tls_vars
+       .p2align        2
+       .type   __tls__i,%object
+       .size   __tls__i,12
+__tls__i:
+       .4byte  i
+       .4byte  0
+       .4byte  4
+