]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
merge of 'aee0b12a9696567adc81ce0bab9a764f6d109392'
authorRoland McGrath <roland@redhat.com>
Fri, 18 Jan 2008 21:42:01 +0000 (21:42 +0000)
committerRoland McGrath <roland@redhat.com>
Fri, 18 Jan 2008 21:42:01 +0000 (21:42 +0000)
     and 'f3933ac5f5de522fcd38d0960f642fec00b553fa'

config/elfutils.spec.in
src/ChangeLog
src/i386_ld.c
src/ld.c
src/ldgeneric.c
src/readelf.c

index 380e5c5af5f505750a7606baa40077461c4355ac..5c5fc54085cefe327ee5671adc3cf8d5bcd7e75c 100644 (file)
@@ -8,7 +8,7 @@ Group: Development/Tools
 Source: elfutils-%{version}.tar.gz
 Obsoletes: libelf libelf-devel
 Requires: elfutils-libelf = %{version}-%{release}
-Requires: glibc >= 2.3.1-2
+Requires: glibc >= 2.7
 
 # ExcludeArch: xxx
 
index b58102e26152ca50ef2061a89c6c4b61a0f58718..aeb501bde385f4e9544a24ee6e374682f196f103 100644 (file)
@@ -1,27 +1,3 @@
-2008-01-19  Ulrich Drepper  <drepper@redhat.com>
-
-       * i386_ld.c (elf_i386_count_relocations): PLT relocations for undefined
-       symbols are not carried over into statically linked output files.
-       Add dummy entries for more TLS relocations.
-
-       * ld.c (options): Add long names for -( and -).
-
-       * ldgeneric.c (check_definition): For newly found definitions don't
-       mark section as used if symbol is absolute.
-       (extract_from_archive): Only assign archive sequence number the first
-       time the archive is handled.  Update ld_state.last_archive_used
-       if any symbol was used.  Remove nround variable.
-       (file_process2): When using symbol from an archive, update
-       ld_state.group_start_archive, ld_state.archives, and
-       ld_state.tailarchives.
-       (ld_generic_file_process): If group is not handled anymore, after
-       freeing ELF handles for the archives, clear ld_state.archives and
-       *nextp.  Fix wrong logic in recognizing first iteration of group
-       loop.  When clearing flags, also clear ld_state.group_start_archive.
-
-       * src/readelf.c (process_elf_file): When re-reading pure file,
-       don't first open the file and then map from the mapped archive.
-
 2008-01-11  Ulrich Drepper  <drepper@redhat.com>
 
        * objdump.c (show_disasm): Adjust disassembler format string for
index 82fb9473e1fb4b4ade89c45088e529804abcc151..c79804cda4c2decc1951f56d02f008829c2e9af0 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008 Red Hat, Inc.
+/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc.
    This file is part of Red Hat elfutils.
    Written by Ulrich Drepper <drepper@redhat.com>, 2001.
 
@@ -592,9 +592,10 @@ elf_i386_count_relocations (struct ld_state *statep, struct scninfo *scninfo)
                 If the symbol is not defined and we are not creating
                 a statically linked binary, then we need in any case
                 a PLT entry.  */
-             if (! scninfo->fileinfo->symref[r_sym]->defined
-                 && !statep->statically)
+             if (! scninfo->fileinfo->symref[r_sym]->defined)
                {
+                 assert (!statep->statically);
+
                  sym = scninfo->fileinfo->symref[r_sym];
                  sym->type = STT_FUNC;
                  sym->in_dso = 1;
@@ -613,9 +614,6 @@ elf_i386_count_relocations (struct ld_state *statep, struct scninfo *scninfo)
                }
              break;
 
-           case R_386_TLS_IE:
-           case R_386_TLS_GOTIE:
-           case R_386_TLS_LE:
            case R_386_TLS_GD:
            case R_386_TLS_LDM:
            case R_386_TLS_GD_32:
index 4ac3023af555825cf0d6cb41d84e88b3a15ef59d..bede0e85491655287e776f1a5c1292b456b4870e 100644 (file)
--- a/src/ld.c
+++ b/src/ld.c
@@ -88,8 +88,8 @@ static const struct argp_option options[] =
   { "no-whole-archive", ARGP_no_whole_archive, NULL, 0,
     N_("Stop including the whole arhives in the output."), 0 },
   { NULL, 'l', N_("FILE"), OPTION_HIDDEN, NULL, 0 },
-  { "start-group", '(', NULL, 0, N_("Start a group."), 0 },
-  { "end-group", ')', NULL, 0, N_("End a group."), 0 },
+  { NULL, '(', NULL, 0, N_("Start a group."), 0 },
+  { NULL, ')', NULL, 0, N_("End a group."), 0 },
   { NULL, 'L', N_("PATH"), 0,
     N_("Add PATH to list of directories files are searched in."), 0 },
   { "as-needed", ARGP_as_needed, NULL, 0,
index 63fc77ca5ccacfdfaf9fc2424840030501243eb2..cb184abfd22270400544a07d7ed196d54be5cc0f 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008 Red Hat, Inc.
+/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc.
    This file is part of Red Hat elfutils.
    Written by Ulrich Drepper <drepper@redhat.com>, 2001.
 
@@ -726,8 +726,7 @@ check_definition (const XElf_Sym *sym, size_t symidx,
             and it's indicating whether the reference is weak or not.  */
          oldp->weak = XELF_ST_BIND (sym->st_info) == STB_WEAK;
 
-         // XXX Really exclude SHN_ABS?
-         if (sym->st_shndx != SHN_COMMON && sym->st_shndx != SHN_ABS)
+         if (sym->st_shndx != SHN_COMMON)
            {
              struct scninfo *ignore;
              mark_section_used (&fileinfo->scninfo[sym->st_shndx],
@@ -1413,8 +1412,8 @@ add_relocatable_file (struct usedfiles *fileinfo, GElf_Word secttype)
            /* The symbol is not used.  */
            continue;
 
-         /* If the DSO uses symbol versions determine whether this is
-            the default version.  Otherwise we'll ignore the symbol.  */
+         /* If the DSO uses symbols determine whether this is the default
+            version.  Otherwise we'll ignore the symbol.  */
          if (versymdata != NULL)
            {
              XElf_Versym versym;
@@ -1786,16 +1785,15 @@ extract_from_archive (struct usedfiles *fileinfo)
   static int archive_seq;
   int res = 0;
 
-  if (fileinfo->archive_seq == 0)
-    /* This is an archive we are not using completely.  Give it a
-       unique number.  */
-    fileinfo->archive_seq = ++archive_seq;
+  /* This is an archive we are not using completely.  Give it a
+     unique number.  */
+  fileinfo->archive_seq = ++archive_seq;
 
   /* If there are no unresolved symbols don't do anything.  */
-  assert (ld_state.extract_rule == defaultextract
-         || ld_state.extract_rule == weakextract);
   if ((likely (ld_state.extract_rule == defaultextract)
-       ? ld_state.nunresolved_nonweak : ld_state.nunresolved) == 0)
+       && ld_state.nunresolved_nonweak == 0)
+      || (unlikely (ld_state.extract_rule == weakextract)
+         && ld_state.nunresolved == 0))
     return 0;
 
   Elf_Arsym *syms;
@@ -1820,6 +1818,7 @@ extract_from_archive (struct usedfiles *fileinfo)
      the first definition.  */
   // XXX Is this a compatible behavior?
   bool any_used;
+  int nround = 0;
   do
     {
       any_used = false;
@@ -1877,7 +1876,7 @@ extract_from_archive (struct usedfiles *fileinfo)
            }
        }
 
-      if (any_used)
+      if (++nround == 1)
        {
          /* This is an archive therefore it must have a number.  */
          assert (fileinfo->archive_seq != 0);
@@ -2070,22 +2069,9 @@ cannot use DSO '%s' when generating relocatable object file"),
          res = 0;
        }
       else
-       {
-         if (ld_state.group_start_requested
-             && ld_state.group_start_archive == NULL)
-           ld_state.group_start_archive = fileinfo;
-
-         if (ld_state.archives == NULL)
-           ld_state.archives = fileinfo;
-
-         if (ld_state.tailarchives != NULL)
-           ld_state.tailarchives->next = fileinfo;
-         ld_state.tailarchives = fileinfo;
-
-         /* Extract only the members from the archive which are
-            currently referenced by unresolved symbols.  */
-         res = extract_from_archive (fileinfo);
-       }
+       /* Extract only the members from the archive which are
+          currently referenced by unresolved symbols.  */
+       res = extract_from_archive (fileinfo);
     }
   else
     /* This should never happen, we know about no other types.  */
@@ -2141,7 +2127,7 @@ ld_generic_file_process (int fd, struct usedfiles *fileinfo,
       /* We found the file.  Now test whether it is a file type we can
         handle.
 
-        XXX Do we need to have the ability to start from a given
+        XXX Do we have to have the ability to start from a given
         position in the search path again to look for another file if
         the one found has not the right type?  */
       res = open_elf (fileinfo, elf_begin (fileinfo->fd,
@@ -2184,24 +2170,19 @@ ld_generic_file_process (int fd, struct usedfiles *fileinfo,
              runp = runp->next;
            }
          while (runp != fileinfo->next);
-
-         /* Do not do this again.  */
-         ld_state.archives = NULL;
-
-         /* Do not move on to the next archive.  */
-         *nextp = fileinfo->next = NULL;
        }
     }
   else if (unlikely (fileinfo->group_end))
     {
-      /* This is the end of a group.  We possibly have to go back.
+      /* This is the end of a group.  We possibly of to go back.
         Determine which file we would go back to and see whether it
         makes sense.  If there has not been an archive we don't have
         to do anything.  */
-      if (ld_state.group_start_requested)
+      if (!ld_state.group_start_requested)
        {
          if (ld_state.group_start_archive != ld_state.tailarchives)
-           /* The loop includes more than one archive, add the pointer.  */
+           /* The loop would include more than one archive, add the
+              pointer.  */
            {
              *nextp = ld_state.tailarchives->group_backref =
                ld_state.group_start_archive;
@@ -2220,7 +2201,6 @@ ld_generic_file_process (int fd, struct usedfiles *fileinfo,
 
       /* Clear the flags.  */
       ld_state.group_start_requested = false;
-      ld_state.group_start_archive = NULL;
       fileinfo->group_end = false;
     }
 
index e0352443f45ebab0d80fccd4efa3f2af56c258bd..f243f62699697b32cb9eb3d006266ab5f9d48995 100644 (file)
@@ -601,6 +601,7 @@ process_elf_file (Dwfl_Module *dwflmod, int fd)
   if (ehdr->e_type == ET_REL && print_unrelocated)
     {
       /* Read the file afresh.  */
+      pure_elf = elf_begin (fd, ELF_C_READ_MMAP, NULL);
       off64_t aroff = elf_getaroff (elf);
       if (aroff > 0)
        {
@@ -610,8 +611,6 @@ process_elf_file (Dwfl_Module *dwflmod, int fd)
          elf_end (pure_elf);
          pure_elf = armem;
        }
-      else
-       pure_elf = elf_begin (fd, ELF_C_READ_MMAP, NULL);
       if (pure_elf == NULL)
        goto elf_error;
       pure_ebl = ebl_openbackend (pure_elf);