]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Merge fixes from trunk.
authorDaniel Jacobowitz <drow@false.org>
Sun, 15 Dec 2002 22:31:49 +0000 (22:31 +0000)
committerDaniel Jacobowitz <drow@false.org>
Sun, 15 Dec 2002 22:31:49 +0000 (22:31 +0000)
20 files changed:
bfd/ChangeLog
bfd/aoutx.h
bfd/elf32-m68k.c
bfd/elf32-sh.c
bfd/elf64-sh64.c
bfd/libaout.h
binutils/ChangeLog
binutils/size.c
gas/ChangeLog
gas/config/tc-sh.c
gas/testsuite/ChangeLog
gas/testsuite/gas/sh/pic.d
gas/testsuite/gas/sh/pic.s
gprof/ChangeLog
gprof/configure
gprof/configure.in
ld/ChangeLog
ld/emultempl/elf32.em
ld/ld.texinfo
ld/testsuite/ChangeLog

index 54b77c8eb6a3ba2cbf8ff7f0582b52824e933d80..a0a47f833bbf6344a3db89bff98e4eeaad065e73 100644 (file)
@@ -1,3 +1,33 @@
+2002-12-15  Daniel Jacobowitz  <drow@mvista.com>
+
+       Merge from mainline:
+       2002-11-28  Kaz Kojima  <kkojima@rr.iij4u.or.jp>
+       * elf32-sh.c (sh_elf_relocate_section): Don't complain about
+       unresolved debugging relocs in dynamic applications.
+       * elf64-sh64.c (sh_elf64_relocate_section): Likewise.
+
+2002-12-10  Jason Thorpe  <thorpej@wasabisystems.com>
+
+       * aoutx.h (set_section_contents): Allow an otherwise unrepresentable
+       read-only section that lies after .text and before .data to be
+       written into the output file and included in a_text.
+       (translate_to_native_sym_flags): If an otherwise unrepresentable
+       section was merged with .text, convert its symbols to N_TEXT
+       symbols.
+       * libaout.h (aout_section_merge_with_text_p): New macro.
+
+2002-12-04  Andreas Schwab  <schwab@suse.de>
+
+       * elf32-m68k.c (struct elf_m68k_link_hash_table): Add sym_sec
+       member.
+       (elf_m68k_link_hash_table_create): Initialize it.
+       (elf_m68k_check_relocs): Handle symbols that are forced to be
+       local due to visibility changes.
+       (elf_m68k_adjust_dynamic_symbol): Likewise.
+       (elf_m68k_size_dynamic_sections): Likewise.
+       (elf_m68k_discard_copies): Likewise.
+       (elf_m68k_relocate_section): Likewise.
+
 2002-12-04  Alan Modra  <amodra@bigpond.net.au>
 
        * elf64-ppc.c (edit_opd): Correct typo.
index 70359d658ed972913f4a199f2f0236e6ce3ee739..5c553c62892a5cbb82d013a5a558d957d0affad9 100644 (file)
@@ -1278,11 +1278,17 @@ NAME(aout,set_section_contents) (abfd, section, location, offset, count)
   if (section != obj_textsec (abfd)
       && section != obj_datasec (abfd))
     {
-      (*_bfd_error_handler)
-       (_("%s: can not represent section `%s' in a.out object file format"),
-        bfd_get_filename (abfd), bfd_get_section_name (abfd, section));
-      bfd_set_error (bfd_error_nonrepresentable_section);
-      return false;
+      if (aout_section_merge_with_text_p (abfd, section))
+       section->filepos = obj_textsec (abfd)->filepos +
+                          (section->vma - obj_textsec (abfd)->vma);
+      else
+       {
+          (*_bfd_error_handler)
+          (_("%s: can not represent section `%s' in a.out object file format"),
+            bfd_get_filename (abfd), bfd_get_section_name (abfd, section));
+          bfd_set_error (bfd_error_nonrepresentable_section);
+          return false;
+       }
     }
 
   if (count != 0)
@@ -1695,11 +1701,16 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer)
     sym_pointer->e_type[0] = N_UNDF | N_EXT;
   else
     {
-      (*_bfd_error_handler)
-       (_("%s: can not represent section `%s' in a.out object file format"),
-        bfd_get_filename (abfd), bfd_get_section_name (abfd, sec));
-      bfd_set_error (bfd_error_nonrepresentable_section);
-      return false;
+      if (aout_section_merge_with_text_p (abfd, sec))
+       sym_pointer->e_type[0] |= N_TEXT;
+      else
+       {
+          (*_bfd_error_handler)
+          (_("%s: can not represent section `%s' in a.out object file format"),
+            bfd_get_filename (abfd), bfd_get_section_name (abfd, sec));
+          bfd_set_error (bfd_error_nonrepresentable_section);
+          return false;
+       }
     }
 
   /* Turn the symbol from section relative to absolute again */
index 6c71418b4e2c0c5161ed3b5e3dbd2ee4fed0928c..5b28f1e704d33270f68242497e4343ffbffd01b6 100644 (file)
@@ -279,6 +279,9 @@ struct elf_m68k_link_hash_entry
 struct elf_m68k_link_hash_table
 {
   struct elf_link_hash_table root;
+
+  /* Small local sym to section mapping cache.  */
+  struct sym_sec_cache sym_sec;
 };
 
 /* Declare this now that the above structures are defined.  */
@@ -351,6 +354,8 @@ elf_m68k_link_hash_table_create (abfd)
       return NULL;
     }
 
+  ret->sym_sec.abfd = NULL;
+
   return &ret->root.root;
 }
 
@@ -518,7 +523,8 @@ elf_m68k_check_relocs (abfd, info, sec, relocs)
              if (h->got.refcount == 0)
                {
                  /* Make sure this symbol is output as a dynamic symbol.  */
-                 if (h->dynindx == -1)
+                 if (h->dynindx == -1
+                     && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
                    {
                      if (!bfd_elf32_link_record_dynamic_symbol (info, h))
                        return false;
@@ -595,7 +601,8 @@ elf_m68k_check_relocs (abfd, info, sec, relocs)
            }
 
          /* Make sure this symbol is output as a dynamic symbol.  */
-         if (h->dynindx == -1)
+         if (h->dynindx == -1
+             && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
            {
              if (!bfd_elf32_link_record_dynamic_symbol (info, h))
                return false;
@@ -622,6 +629,7 @@ elf_m68k_check_relocs (abfd, info, sec, relocs)
                && (sec->flags & SEC_ALLOC) != 0
                && h != NULL
                && (!info->symbolic
+                   || h->root.type == bfd_link_hash_defweak
                    || (h->elf_link_hash_flags
                        & ELF_LINK_HASH_DEF_REGULAR) == 0)))
            {
@@ -689,24 +697,41 @@ elf_m68k_check_relocs (abfd, info, sec, relocs)
 
              sreloc->_raw_size += sizeof (Elf32_External_Rela);
 
-             /* If we are linking with -Bsymbolic, we count the number of
-                PC relative relocations we have entered for this symbol,
-                so that we can discard them again if the symbol is later
-                defined by a regular object.  Note that this function is
-                only called if we are using an m68kelf linker hash table,
-                which means that h is really a pointer to an
+             /* We count the number of PC relative relocations we have
+                entered for this symbol, so that we can discard them
+                again if, in the -Bsymbolic case, the symbol is later
+                defined by a regular object, or, in the normal shared
+                case, the symbol is forced to be local.  Note that this
+                function is only called if we are using an m68kelf linker
+                hash table, which means that h is really a pointer to an
                 elf_m68k_link_hash_entry.  */
-             if ((ELF32_R_TYPE (rel->r_info) == R_68K_PC8
-                  || ELF32_R_TYPE (rel->r_info) == R_68K_PC16
-                  || ELF32_R_TYPE (rel->r_info) == R_68K_PC32)
-                 && info->symbolic)
+             if (ELF32_R_TYPE (rel->r_info) == R_68K_PC8
+                 || ELF32_R_TYPE (rel->r_info) == R_68K_PC16
+                 || ELF32_R_TYPE (rel->r_info) == R_68K_PC32)
                {
-                 struct elf_m68k_link_hash_entry *eh;
                  struct elf_m68k_pcrel_relocs_copied *p;
+                 struct elf_m68k_pcrel_relocs_copied **head;
 
-                 eh = (struct elf_m68k_link_hash_entry *) h;
+                 if (h != NULL)
+                   {
+                     struct elf_m68k_link_hash_entry *eh
+                       = (struct elf_m68k_link_hash_entry *) h;
+                     head = &eh->pcrel_relocs_copied;
+                   }
+                 else
+                   {
+                     asection *s;
+                     s = (bfd_section_from_r_symndx
+                          (abfd, &elf_m68k_hash_table (info)->sym_sec,
+                           sec, r_symndx));
+                     if (s == NULL)
+                       return false;
+
+                     head = ((struct elf_m68k_pcrel_relocs_copied **)
+                             &elf_section_data (s)->local_dynrel);
+                   }
 
-                 for (p = eh->pcrel_relocs_copied; p != NULL; p = p->next)
+                 for (p = *head; p != NULL; p = p->next)
                    if (p->section == sreloc)
                      break;
 
@@ -716,8 +741,8 @@ elf_m68k_check_relocs (abfd, info, sec, relocs)
                           bfd_alloc (dynobj, (bfd_size_type) sizeof *p));
                      if (p == NULL)
                        return false;
-                     p->next = eh->pcrel_relocs_copied;
-                     eh->pcrel_relocs_copied = p;
+                     p->next = *head;
+                     *head = p;
                      p->section = sreloc;
                      p->count = 0;
                    }
@@ -952,7 +977,8 @@ elf_m68k_adjust_dynamic_symbol (info, h)
        }
 
       /* Make sure this symbol is output as a dynamic symbol.  */
-      if (h->dynindx == -1)
+      if (h->dynindx == -1
+         && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
        {
          if (! bfd_elf32_link_record_dynamic_symbol (info, h))
            return false;
@@ -1123,14 +1149,16 @@ elf_m68k_size_dynamic_sections (output_bfd, info)
        s->_raw_size = 0;
     }
 
-  /* If this is a -Bsymbolic shared link, then we need to discard all PC
-     relative relocs against symbols defined in a regular object.  We
-     allocated space for them in the check_relocs routine, but we will not
-     fill them in in the relocate_section routine.  */
-  if (info->shared && info->symbolic)
+  /* If this is a -Bsymbolic shared link, then we need to discard all
+     PC relative relocs against symbols defined in a regular object.
+     For the normal shared case we discard the PC relative relocs
+     against symbols that have become local due to visibility changes.
+     We allocated space for them in the check_relocs routine, but we
+     will not fill them in in the relocate_section routine.  */
+  if (info->shared)
     elf_m68k_link_hash_traverse (elf_m68k_hash_table (info),
                                 elf_m68k_discard_copies,
-                                (PTR) NULL);
+                                (PTR) info);
 
   /* The check_relocs and adjust_dynamic_symbol entry points have
      determined the sizes of the various dynamic sections.  Allocate
@@ -1257,23 +1285,28 @@ elf_m68k_size_dynamic_sections (output_bfd, info)
 }
 
 /* This function is called via elf_m68k_link_hash_traverse if we are
-   creating a shared object with -Bsymbolic.  It discards the space
-   allocated to copy PC relative relocs against symbols which are defined
-   in regular objects.  We allocated space for them in the check_relocs
-   routine, but we won't fill them in in the relocate_section routine.  */
+   creating a shared object.  In the -Bsymbolic case it discards the
+   space allocated to copy PC relative relocs against symbols which
+   are defined in regular objects.  For the normal shared case, if
+   discards space for pc-relative relocs that have become local due to
+   symbol visibility changes.  We allocated space for them in the
+   check_relocs routine, but we won't fill them in in the
+   relocate_section routine.  */
 
 static boolean
-elf_m68k_discard_copies (h, ignore)
+elf_m68k_discard_copies (h, inf)
      struct elf_m68k_link_hash_entry *h;
-     PTR ignore ATTRIBUTE_UNUSED;
+     PTR inf;
 {
+  struct bfd_link_info *info = (struct bfd_link_info *) inf;
   struct elf_m68k_pcrel_relocs_copied *s;
 
   if (h->root.root.type == bfd_link_hash_warning)
     h = (struct elf_m68k_link_hash_entry *) h->root.root.u.i.link;
 
-  /* We only discard relocs for symbols defined in a regular object.  */
-  if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+  if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
+      || (!info->symbolic
+         && (h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0))
     return true;
 
   for (s = h->pcrel_relocs_copied; s != NULL; s = s->next)
@@ -1594,7 +1627,9 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
        case R_68K_PC8:
        case R_68K_PC16:
        case R_68K_PC32:
-         if (h == NULL)
+         if (h == NULL
+             || (info->shared
+                 && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0))
            break;
          /* Fall through.  */
        case R_68K_8:
index 841c42a687f49bce75646969f9a6eb5f4d66e07a..4e7bc55c934824158c858a812ee5a001a999f679 100644 (file)
@@ -4529,7 +4529,14 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                             with them here.  */
                          || ((input_section->flags & SEC_DEBUGGING) != 0
                              && (h->elf_link_hash_flags
-                                 & ELF_LINK_HASH_DEF_DYNAMIC) != 0))))
+                                 & ELF_LINK_HASH_DEF_DYNAMIC) != 0)))
+                 /* Dynamic relocs are not propagated for SEC_DEBUGGING
+                    sections because such sections are not SEC_ALLOC and
+                    thus ld.so will not process them.  */
+                 || (sec->output_section == NULL
+                     && ((input_section->flags & SEC_DEBUGGING) != 0
+                         && (h->elf_link_hash_flags
+                             & ELF_LINK_HASH_DEF_DYNAMIC) != 0)))
                relocation = 0;
              else if (sec->output_section == NULL)
                {
index 40b2cc856a489409dd19cd7a700b93732d104928..0c0ce79a6d3cf71fc6f2ba24d1039d7a35962c93 100644 (file)
@@ -1651,7 +1651,14 @@ sh_elf64_relocate_section (output_bfd, info, input_bfd, input_section,
                             sections against symbols defined externally
                             in shared libraries.  We can't do anything
                             with them here.  */
-                         || (input_section->flags & SEC_DEBUGGING) != 0)))
+                         || (input_section->flags & SEC_DEBUGGING) != 0))
+                 /* Dynamic relocs are not propagated for SEC_DEBUGGING
+                    sections because such sections are not SEC_ALLOC and
+                    thus ld.so will not process them.  */
+                 || (sec->output_section == NULL
+                     && ((input_section->flags & SEC_DEBUGGING) != 0
+                         && (h->elf_link_hash_flags
+                             & ELF_LINK_HASH_DEF_DYNAMIC) != 0)))
                relocation = 0;
              else if (sec->output_section == NULL)
                {
index a76b935d394ad3b2713365735d6738aca7cd589d..e4667b35d75f0cb42f63bdf31debdd71778963d6 100644 (file)
@@ -672,4 +672,23 @@ extern boolean NAME(aout,bfd_free_cached_info)
       }
 #endif
 
+/* Test if a read-only section can be merged with .text.  This is
+   possible if:
+
+   1. Section has file contents and is read-only.
+   2. The VMA of the section is after the end of .text and before
+      the start of .data.
+   3. The image is demand-pageable (otherwise, a_text in the header
+      will not reflect the gap between .text and .data).  */
+
+#define aout_section_merge_with_text_p(abfd, sec)                      \
+  (((sec)->flags & (SEC_HAS_CONTENTS|SEC_READONLY)) ==                 \
+      (SEC_HAS_CONTENTS|SEC_READONLY)                                  \
+   && obj_textsec (abfd) != NULL                                       \
+   && obj_datasec (abfd) != NULL                                       \
+   && (sec)->vma >= (obj_textsec (abfd)->vma +                         \
+                    obj_textsec (abfd)->_cooked_size)                  \
+   && ((sec)->vma + (sec)->_cooked_size) <= obj_datasec (abfd)->vma    \
+   && ((abfd)->flags & D_PAGED) != 0)
+
 #endif /* ! defined (LIBAOUT_H) */
index 95d72cf9e10bae6af85701b53bbd1a77862b913c..a3053b0eec778422660496df5737e4e7aa6744af 100644 (file)
@@ -1,3 +1,7 @@
+2002-11-23  Nick Clifton  <nickc@redhat.com>
+
+       * size.c (usage): Fix typo describing switch for hex format.
+
 2002-11-07  Nick Clifton  <nickc@redhat.com>
 
        * configure.in (LINGUAS): Add 'da'.
index 792cb8239985ef338c252d1cea0ea4ea170e2129..8804a43a2b43deaf5449b64d1224ba695a55d5fc 100644 (file)
@@ -87,7 +87,7 @@ usage (stream, status)
   fprintf (stream, _(" If no input file(s) are specified, a.out is assumed\n"));
   fprintf (stream, _(" The options are:\n\
   -A|-B     --format={sysv|berkeley}  Select output style (default is %s)\n\
-  -o|-d|-h  --radix={8|10|16}         Display numbers in octal, decimal or hex\n\
+  -o|-d|-x  --radix={8|10|16}         Display numbers in octal, decimal or hex\n\
   -t        --totals                  Display the total sizes (Berkeley only)\n\
             --target=<bfdname>        Set the binary file format\n\
   -h        --help                    Display this information\n\
index 94223d03ce89f03bef3d2684ea1c318c0700d6c1..21235119e0d713f880b7b2339ccb64a5fbb81b22 100644 (file)
@@ -1,3 +1,8 @@
+2002-11-30  Kaz Kojima  <kkojima@rr.iij4u.or.jp>
+
+       * config/tc-sh.c (md_apply_fix3): Take account of fx_offset
+       for BFD_RELOC_32_PLT_PCREL.
+
 2002-11-20  Alan Modra  <amodra@bigpond.net.au>
 
        * write.c (adjust_reloc_syms): Don't reduce SEC_MERGE fixups with
index 1361cb8d5155d7501a91490a43b38fcc296e808f..6dd2719cdbe5add0ef754987392155c82cc180f7 100644 (file)
@@ -3530,7 +3530,7 @@ md_apply_fix3 (fixP, valP, seg)
       /* Make the jump instruction point to the address of the operand.  At
         runtime we merely add the offset to the actual PLT entry.  */
       * valP = 0xfffffffc;
-      val = fixP->fx_addnumber;
+      val = fixP->fx_addnumber + fixP->fx_offset;
       if (fixP->fx_subsy)
        val -= S_GET_VALUE (fixP->fx_subsy);
       md_number_to_chars (buf, val, 4);
index 8cf3abeb8535a002d1d0b5707f9d42125650e426..b5ddd113bc9c4705658cbc87842eac1e20321c68 100644 (file)
@@ -1,3 +1,8 @@
+2002-11-30  Kaz Kojima  <kkojima@rr.iij4u.or.jp>
+
+       * sh/gas/sh/pic.s: Add a test for ".long foo@PLT+.-2-label".
+       * sh/gas/sh/pic.d: Add expected output.
+
 2002-10-28  Daniel Jacobowitz  <drow@mvista.com>
 
        Merge from mainline:
index f4ac77518d1fb00c494b802e63a378403181d913..9a2d0cecdde65ad58ff072f6c64c34ca9edcb264 100644 (file)
@@ -38,3 +38,6 @@ Disassembly of section \.text:
 0x00000040 00 00               \.word 0x0000
                        40: R_SH_PLT32  foo
 0x00000042 00 14               mov\.b  r1,@\(r0,r0\)
+0x00000044 00 00               \.word 0x0000
+                       44: R_SH_PLT32  foo
+0x00000046 00 1e               mov\.l  @\(r0,r1\),r0
index 6e0c53e25855cff1cc61d9cff5892b8722f8ee36..bb9551c24271d41c9744a7fdcd05f558f9359aa0 100644 (file)
@@ -39,3 +39,5 @@
        .long   foo@PLT + . - (.LPLTcall_old + 2)
 .Lfooplt_new:
        .long   foo@PLT - (.LPLTcall_new + 2 - .)
+.Lfooplt_old2:
+       .long   foo@PLT + . - 2 - .LPLTcall_old
index 9747bbada5ab4bf78465a96e6d8aefad09391f9f..d9239a6bbf0e77470c516c12396962e367131780 100644 (file)
@@ -1,3 +1,15 @@
+2002-12-02  Nick Clifton  <nickc@redhat.com>
+
+       * configure.in (LINGUAS): Add pt_BR.
+       * configure: Regenerate.
+       * po/pt_BR: New Brazillian Portugese translation.
+
+2002-11-12  Nick Clifton  <nickc@redhat.com>
+
+       * configure.in (ALL_LINGUAS): Add da.
+       * configure: Regenerate.
+       * po/da.po: New Danish translation.
+
 2002-10-30  Daniel Jacobowitz  <drow@mvista.com>
 
        * po/gprof.pot: Regenerated.
index 913fb81e46320fd1ae7f56b86dc6b13cbdb705e7..8a38fc3491cb13f6b36baedd1e22c0ef44a549d0 100755 (executable)
@@ -2491,7 +2491,7 @@ fi
 done
 
 
-ALL_LINGUAS="fr tr sv es id"
+ALL_LINGUAS="fr tr sv es id da pt_BR"
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
 echo "configure:2497: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
index 3273b75f2f58259b46b56fb566e38c1ab64d98ea..8956171b6c0fc54ba2bc348bf0b749dd3c9c89dc 100644 (file)
@@ -23,7 +23,7 @@ AC_PROG_INSTALL
 
 AC_CHECK_FUNCS(setmode)
 
-ALL_LINGUAS="fr tr sv es id"
+ALL_LINGUAS="fr tr sv es id da pt_BR"
 CY_GNU_GETTEXT
 
 AM_MAINTAINER_MODE
index 428de76c03beb9eb6715732504a57ddb4b39dbf7..86ca4821470e11674bafe624ba8c0aa3befe7bf4 100644 (file)
@@ -1,3 +1,18 @@
+2002-12-10  Alan Modra  <amodra@bigpond.net.au>
+
+       * emultempl/elf32.em (struct orphan_save): Add os_tail field.
+       (gld${EMULATION_NAME}_place_orphan): Re-order output_section_statement
+       list too.
+
+2002-12-05  Alan Modra  <amodra@bigpond.net.au>
+
+       * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Set
+       load_base for orphans that follow a section with load_base set.
+
+2002-12-01  H.J. Lu <hjl@gnu.org>
+
+       * ld.texinfo: Remove the extra `;' in sample version script.
+
 2002-11-27  David O'Brien  <obrien@FreeBSD.org>
 
        * configure.host: Fix generic FreeBSD configuration entry.
index 9bfed6eb67ca2f3aa402570d7b26b68b3aa7a1af..2b9a466de5443e2659fd2e2056e6951a5d6ab1bc 100644 (file)
@@ -1071,6 +1071,7 @@ struct orphan_save {
   lang_output_section_statement_type *os;
   asection **section;
   lang_statement_union_type **stmt;
+  lang_statement_union_type **os_tail;
 };
 
 static boolean
@@ -1093,6 +1094,8 @@ gld${EMULATION_NAME}_place_orphan (file, s)
   const char *secname;
   const char *ps = NULL;
   lang_output_section_statement_type *os;
+  lang_statement_union_type **os_tail;
+  etree_type *load_base;
   int isdyn = 0;
 
   secname = bfd_get_section_name (s->owner, s);
@@ -1227,16 +1230,26 @@ gld${EMULATION_NAME}_place_orphan (file, s)
        }
     }
 
+  address = NULL;
   if (link_info.relocateable || (s->flags & (SEC_LOAD | SEC_ALLOC)) == 0)
     address = exp_intop ((bfd_vma) 0);
-  else
-    address = NULL;
 
+  load_base = NULL;
+  if (place != NULL && place->os->load_base != NULL)
+    {
+      etree_type *lma_from_vma;
+      lma_from_vma = exp_binop ('-', place->os->load_base,
+                               exp_nameop (ADDR, place->os->name));
+      load_base = exp_binop ('+', lma_from_vma,
+                            exp_nameop (ADDR, secname));
+    }
+
+  os_tail = lang_output_section_statement.tail;
   os = lang_enter_output_section_statement (secname, address, 0,
                                            (bfd_vma) 0,
                                            (etree_type *) NULL,
                                            (etree_type *) NULL,
-                                           (etree_type *) NULL);
+                                           load_base);
 
   lang_add_section (&os->children, s, os, file);
 
@@ -1311,11 +1324,15 @@ gld${EMULATION_NAME}_place_orphan (file, s)
         read/write section before or amongst the read-only ones.  */
       if (add.head != NULL)
        {
+         lang_statement_union_type *newly_added_os;
+
          if (place->stmt == NULL)
            {
              /* Put the new statement list right at the head.  */
              *add.tail = place->os->header.next;
              place->os->header.next = add.head;
+
+             place->os_tail = &place->os->next;
            }
          else
            {
@@ -1331,6 +1348,21 @@ gld${EMULATION_NAME}_place_orphan (file, s)
 
          /* Save the end of this list.  */
          place->stmt = add.tail;
+
+         /* Do the same for the list of output statements.  */
+         newly_added_os = *os_tail;
+         *os_tail = NULL;
+         newly_added_os->output_section_statement.next = *place->os_tail;
+         *place->os_tail = newly_added_os;
+         place->os_tail = &newly_added_os->output_section_statement.next;
+
+         /* Fixing the global list pointer here is a little different.
+            We added to the list in lang_enter_output_section_statement,
+            trimmed off the new output_section_statment above when
+            assigning *os_tail = NULL, but possibly added it back in
+            the same place when assigning *place->os_tail.  */
+         if (*os_tail == NULL)
+           lang_output_section_statement.tail = os_tail;
        }
     }
 
index 789e8940bba68427e333c5e3213f3cc03a200f66..05e9e5bdd8c96a3f7d71ee1dc20505e7d702a631 100644 (file)
@@ -3718,7 +3718,7 @@ and @samp{bar2} are bound to the version node @samp{VERS_2.0}.
 When the linker finds a symbol defined in a library which is not
 specifically bound to a version node, it will effectively bind it to an
 unspecified base version of the library.  You can bind all otherwise
-unspecified symbols to a given version node by using @samp{global: *}
+unspecified symbols to a given version node by using @samp{global: *;}
 somewhere in the version script.
 
 The names of the version nodes have no specific meaning other than what
@@ -3732,7 +3732,7 @@ symbols, only selects which symbols will be globally visible out and which
 won't.
 
 @smallexample
-@{ global: foo; bar; local: *; @}
+@{ global: foo; bar; local: *; @};
 @end smallexample
 
 When you link an application against a shared library that has versioned
index dbc8e48212c148d3e40a89d05d78f89f4e1fb18e..ab4e3264f5b96412eab00600d53f4b17c3524fdf 100644 (file)
@@ -1,3 +1,10 @@
+2002-11-28  Kaz Kojima  <kkojima@rr.iij4u.or.jp>
+
+       * ld-sh/refdbg-0-dso.d: New test.
+       * ld-sh/refdbg-1.d: Likewise.
+       * ld-sh/refdbg.s: Likewise.
+       * ld-sh/refdbglib.s: Likewise.
+
 2002-11-13  Alan Modra  <amodra@bigpond.net.au>
 
        Merge from mainline: