~ubuntu-core-dev/binutils/pkg-ubuntu

« back to all changes in this revision

Viewing changes to patches/000_branch_updates.patch

  • Committer: Matthias Klose
  • Date: 2011-03-11 18:56:10 UTC
  • Revision ID: doko@canonical.com-20110311185610-nw58il131ei4huy6
binutils (2.21.0.20110302-2ubuntu1) natty; urgency=low

  * Merge with Debian.

 -- Matthias Klose <doko@ubuntu.com>  Fri, 11 Mar 2011 00:14:22 +0100

binutils (2.21.0.20110302-2) unstable; urgency=low

  [ Carlos O'Donell ]
  * Fix binutils-hppa64 build.

  [ Matthias Klose ]
  * Fix PR ld/12376 (John David Anglin), taken from the trunk.
  * Update to the 2.21 branch, 20110310.

 -- Matthias Klose <doko@debian.org>  Thu, 10 Mar 2011 21:35:07 +0100

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# DP: Update to the 2.21 branch, 20110310
 
2
 
 
3
diff -urN '--exclude=debian' '--exclude=CVS' binutils-2.21.0.20110302/bfd/ChangeLog a/bfd/ChangeLog
 
4
--- a/bfd/ChangeLog     2011-02-28 08:47:04.000000000 +0100
 
5
+++ a/bfd/ChangeLog     2011-03-10 14:23:48.593058052 +0100
 
6
@@ -1,3 +1,21 @@
 
7
+2011-03-10  Alan Modra  <amodra@gmail.com>
 
8
+
 
9
+       * elf64-ppc.c (ppc64_elf_relocate_section): Provide section/offset
 
10
+       for LO_DS error message and correct multiple.
 
11
+
 
12
+2011-03-10  Alan Modra  <amodra@gmail.com>
 
13
+
 
14
+       * elf64-ppc.c (bfd_elf64_bfd_link_just_syms): Define.
 
15
+       (ppc64_elf_link_just_syms): New function.
 
16
+       (opd_entry_value): Don't assume big-endian host.
 
17
+       (get_r2off): New function.
 
18
+       (ppc_build_one_stub, ppc_size_one_stub): Use it here.
 
19
+
 
20
+2011-03-04  Alan Modra  <amodra@gmail.com>
 
21
+
 
22
+       * archive.c (bsd_write_armap): Don't call stat in deterministic
 
23
+       mode, and don't use st_mtime if stat returns error.
 
24
+
 
25
 2011-02-28  Alan Modra  <amodra@gmail.com>
 
26
 
 
27
        PR 12513
 
28
diff -urN '--exclude=debian' '--exclude=CVS' a/bfd/archive.c a/bfd/archive.c
 
29
--- a/bfd/archive.c     2011-02-28 08:47:04.000000000 +0100
 
30
+++ a/bfd/archive.c     2011-03-08 12:36:31.343059363 +0100
 
31
@@ -2299,31 +2299,28 @@
 
32
   bfd_byte temp[4];
 
33
   unsigned int count;
 
34
   struct ar_hdr hdr;
 
35
-  struct stat statbuf;
 
36
   long uid, gid;
 
37
 
 
38
   firstreal = mapsize + elength + sizeof (struct ar_hdr) + SARMAG;
 
39
 
 
40
-  stat (arch->filename, &statbuf);
 
41
+  /* If deterministic, we use 0 as the timestamp in the map.
 
42
+     Some linkers may require that the archive filesystem modification
 
43
+     time is less than (or near to) the archive map timestamp.  Those
 
44
+     linkers should not be used with deterministic mode.  (GNU ld and
 
45
+     Gold do not have this restriction.)  */
 
46
+  bfd_ardata (arch)->armap_timestamp = 0;
 
47
+  uid = 0;
 
48
+  gid = 0;
 
49
   if ((arch->flags & BFD_DETERMINISTIC_OUTPUT) == 0)
 
50
     {
 
51
-      /* Remember the timestamp, to keep it holy.  But fudge it a little.  */
 
52
-      bfd_ardata (arch)->armap_timestamp = (statbuf.st_mtime
 
53
-                                            + ARMAP_TIME_OFFSET);
 
54
+      struct stat statbuf;
 
55
+
 
56
+      if (stat (arch->filename, &statbuf) == 0)
 
57
+       bfd_ardata (arch)->armap_timestamp = (statbuf.st_mtime
 
58
+                                             + ARMAP_TIME_OFFSET);
 
59
       uid = getuid();
 
60
       gid = getgid();
 
61
     }
 
62
-  else
 
63
-    {
 
64
-      /* If deterministic, we use 0 as the timestamp in the map.
 
65
-         Some linkers may require that the archive filesystem modification
 
66
-         time is less than (or near to) the archive map timestamp.  Those
 
67
-         linkers should not be used with deterministic mode.  (GNU ld and
 
68
-         Gold do not have this restriction.)  */
 
69
-      bfd_ardata (arch)->armap_timestamp = 0;
 
70
-      uid = 0;
 
71
-      gid = 0;
 
72
-    }
 
73
 
 
74
   memset (&hdr, ' ', sizeof (struct ar_hdr));
 
75
   memcpy (hdr.ar_name, RANLIBMAG, strlen (RANLIBMAG));
 
76
diff -urN '--exclude=debian' '--exclude=CVS' a/bfd/elf64-ppc.c a/bfd/elf64-ppc.c
 
77
--- a/bfd/elf64-ppc.c   2011-02-15 05:08:10.000000000 +0100
 
78
+++ a/bfd/elf64-ppc.c   2011-03-10 14:23:50.613054675 +0100
 
79
@@ -79,12 +79,13 @@
 
80
 
 
81
 #define bfd_elf64_mkobject                   ppc64_elf_mkobject
 
82
 #define bfd_elf64_bfd_reloc_type_lookup              ppc64_elf_reloc_type_lookup
 
83
-#define bfd_elf64_bfd_reloc_name_lookup ppc64_elf_reloc_name_lookup
 
84
+#define bfd_elf64_bfd_reloc_name_lookup              ppc64_elf_reloc_name_lookup
 
85
 #define bfd_elf64_bfd_merge_private_bfd_data  ppc64_elf_merge_private_bfd_data
 
86
 #define bfd_elf64_new_section_hook           ppc64_elf_new_section_hook
 
87
 #define bfd_elf64_bfd_link_hash_table_create  ppc64_elf_link_hash_table_create
 
88
 #define bfd_elf64_bfd_link_hash_table_free    ppc64_elf_link_hash_table_free
 
89
 #define bfd_elf64_get_synthetic_symtab       ppc64_elf_get_synthetic_symtab
 
90
+#define bfd_elf64_bfd_link_just_syms         ppc64_elf_link_just_syms
 
91
 
 
92
 #define elf_backend_object_p                 ppc64_elf_object_p
 
93
 #define elf_backend_grok_prstatus            ppc64_elf_grok_prstatus
 
94
@@ -4745,6 +4746,25 @@
 
95
   return TRUE;
 
96
 }
 
97
 
 
98
+/* If --just-symbols against a final linked binary, then assume we need
 
99
+   toc adjusting stubs when calling functions defined there.  */
 
100
+
 
101
+static void
 
102
+ppc64_elf_link_just_syms (asection *sec, struct bfd_link_info *info)
 
103
+{
 
104
+  if ((sec->flags & SEC_CODE) != 0
 
105
+      && (sec->owner->flags & (EXEC_P | DYNAMIC)) != 0
 
106
+      && is_ppc64_elf (sec->owner))
 
107
+    {
 
108
+      asection *got = bfd_get_section_by_name (sec->owner, ".got");
 
109
+      if (got != NULL
 
110
+         && got->size >= elf_backend_got_header_size
 
111
+         && bfd_get_section_by_name (sec->owner, ".opd") != NULL)
 
112
+       sec->has_toc_reloc = 1;
 
113
+    }
 
114
+  _bfd_elf_link_just_syms (sec, info);
 
115
+}
 
116
+
 
117
 static struct plt_entry **
 
118
 update_local_sym_info (bfd *abfd, Elf_Internal_Shdr *symtab_hdr,
 
119
                       unsigned long r_symndx, bfd_vma r_addend, int tls_type)
 
120
@@ -5465,9 +5485,12 @@
 
121
   /* No relocs implies we are linking a --just-symbols object.  */
 
122
   if (opd_sec->reloc_count == 0)
 
123
     {
 
124
-      if (!bfd_get_section_contents (opd_bfd, opd_sec, &val, offset, 8))
 
125
+      char buf[8];
 
126
+
 
127
+      if (!bfd_get_section_contents (opd_bfd, opd_sec, buf, offset, 8))
 
128
        return (bfd_vma) -1;
 
129
 
 
130
+      val = bfd_get_64 (opd_bfd, buf);
 
131
       if (code_sec != NULL)
 
132
        {
 
133
          asection *sec, *likely = NULL;
 
134
@@ -9401,6 +9424,37 @@
 
135
   return relocs;
 
136
 }
 
137
 
 
138
+static bfd_vma
 
139
+get_r2off (struct ppc_link_hash_table *htab,
 
140
+          struct ppc_stub_hash_entry *stub_entry)
 
141
+{
 
142
+  bfd_vma r2off = htab->stub_group[stub_entry->target_section->id].toc_off;
 
143
+
 
144
+  if (r2off == 0)
 
145
+    {
 
146
+      /* Support linking -R objects.  Get the toc pointer from the
 
147
+        opd entry.  */
 
148
+      char buf[8];
 
149
+      asection *opd = stub_entry->h->elf.root.u.def.section;
 
150
+      bfd_vma opd_off = stub_entry->h->elf.root.u.def.value;
 
151
+
 
152
+      if (strcmp (opd->name, ".opd") != 0
 
153
+         || opd->reloc_count != 0)
 
154
+       {
 
155
+         (*_bfd_error_handler) (_("cannot find opd entry toc for %s"),
 
156
+                                stub_entry->h->elf.root.root.string);
 
157
+         bfd_set_error (bfd_error_bad_value);
 
158
+         return 0;
 
159
+       }
 
160
+      if (!bfd_get_section_contents (opd->owner, opd, buf, opd_off + 8, 8))
 
161
+       return 0;
 
162
+      r2off = bfd_get_64 (opd->owner, buf);
 
163
+      r2off -= elf_gp (stub_entry->id_sec->output_section->owner);
 
164
+    }
 
165
+  r2off -= htab->stub_group[stub_entry->id_sec->id].toc_off;
 
166
+  return r2off;
 
167
+}
 
168
+
 
169
 static bfd_boolean
 
170
 ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
 
171
 {
 
172
@@ -9445,10 +9499,13 @@
 
173
       size = 4;
 
174
       if (stub_entry->stub_type == ppc_stub_long_branch_r2off)
 
175
        {
 
176
-         bfd_vma r2off;
 
177
+         bfd_vma r2off = get_r2off (htab, stub_entry);
 
178
 
 
179
-         r2off = (htab->stub_group[stub_entry->target_section->id].toc_off
 
180
-                  - htab->stub_group[stub_entry->id_sec->id].toc_off);
 
181
+         if (r2off == 0)
 
182
+           {
 
183
+             htab->stub_error = TRUE;
 
184
+             return FALSE;
 
185
+           }
 
186
          bfd_put_32 (htab->stub_bfd, STD_R2_40R1, loc);
 
187
          loc += 4;
 
188
          size = 12;
 
189
@@ -9632,10 +9689,14 @@
 
190
        }
 
191
       else
 
192
        {
 
193
-         bfd_vma r2off;
 
194
+         bfd_vma r2off = get_r2off (htab, stub_entry);
 
195
+
 
196
+         if (r2off == 0)
 
197
+           {
 
198
+             htab->stub_error = TRUE;
 
199
+             return FALSE;
 
200
+           }
 
201
 
 
202
-         r2off = (htab->stub_group[stub_entry->target_section->id].toc_off
 
203
-                  - htab->stub_group[stub_entry->id_sec->id].toc_off);
 
204
          bfd_put_32 (htab->stub_bfd, STD_R2_40R1, loc);
 
205
          loc += 4;
 
206
          size = 20;
 
207
@@ -9875,8 +9936,12 @@
 
208
       size = 4;
 
209
       if (stub_entry->stub_type == ppc_stub_long_branch_r2off)
 
210
        {
 
211
-         r2off = (htab->stub_group[stub_entry->target_section->id].toc_off
 
212
-                  - htab->stub_group[stub_entry->id_sec->id].toc_off);
 
213
+         r2off = get_r2off (htab, stub_entry);
 
214
+         if (r2off == 0)
 
215
+           {
 
216
+             htab->stub_error = TRUE;
 
217
+             return FALSE;
 
218
+           }
 
219
          size = 12;
 
220
          if (PPC_HA (r2off) != 0)
 
221
            size = 16;
 
222
@@ -11590,7 +11655,7 @@
 
223
       bfd_boolean unresolved_reloc;
 
224
       bfd_boolean warned;
 
225
       unsigned int insn;
 
226
-      bfd_vma mask;
 
227
+      unsigned int mask;
 
228
       struct ppc_stub_hash_entry *stub_entry;
 
229
       bfd_vma max_br_offset;
 
230
       bfd_vma from;
 
231
@@ -13126,8 +13191,8 @@
 
232
          if (((relocation + addend) & mask) != 0)
 
233
            {
 
234
              (*_bfd_error_handler)
 
235
-               (_("%B: error: relocation %s not a multiple of %d"),
 
236
-                input_bfd,
 
237
+               (_("%B(%A+0x%lx): error: %s not a multiple of %u"),
 
238
+                input_bfd, input_section, (long) rel->r_offset,
 
239
                 ppc64_elf_howto_table[r_type]->name,
 
240
                 mask + 1);
 
241
              bfd_set_error (bfd_error_bad_value);
 
242
diff -urN '--exclude=debian' '--exclude=CVS' a/gold/ChangeLog a/gold/ChangeLog
 
243
--- a/gold/ChangeLog    2011-03-01 22:50:05.000000000 +0100
 
244
+++ a/gold/ChangeLog    2011-03-10 14:24:41.633057306 +0100
 
245
@@ -1,3 +1,23 @@
 
246
+2011-03-08  Ian Lance Taylor  <iant@google.com>
 
247
+
 
248
+       PR gold/12525
 
249
+       * fileread.cc: #include <climits>.
 
250
+       (GOLD_IOV_MAX): Define.
 
251
+       (File_read::read_multiple): Limit number of entries by iov_max.
 
252
+       * fileread.h (class File_read): Always set max_readv_entries to
 
253
+       128.
 
254
+
 
255
+2011-03-07  Ian Lance Taylor  <iant@google.com>
 
256
+
 
257
+       PR gold/12525
 
258
+       * options.h (class General_options): Add -dy and -dn.
 
259
+
 
260
+2011-03-02  Simon Baldwin  <simonb@google.com>
 
261
+
 
262
+       * configure.ac: Add check for gnu_indirect_function support in
 
263
+       the toolchain building binutils.
 
264
+       * configure: Rebuild.
 
265
+
 
266
 2011-03-01  Ian Lance Taylor  <iant@google.com>
 
267
 
 
268
        Backport from mainline:
 
269
diff -urN '--exclude=debian' '--exclude=CVS' a/gold/configure a/gold/configure
 
270
--- a/gold/configure    2010-11-23 14:38:36.000000000 +0100
 
271
+++ a/gold/configure    2011-03-08 12:37:03.873056616 +0100
 
272
@@ -6384,6 +6384,7 @@
 
273
 #elif __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 11)
 
274
 error
 
275
 #endif
 
276
+__asm__(".type foo, %gnu_indirect_function");
 
277
 
 
278
 _ACEOF
 
279
 if ac_fn_c_try_compile "$LINENO"; then :
 
280
diff -urN '--exclude=debian' '--exclude=CVS' a/gold/configure.ac a/gold/configure.ac
 
281
--- a/gold/configure.ac 2010-11-23 14:38:36.000000000 +0100
 
282
+++ a/gold/configure.ac 2011-03-08 12:37:03.883056568 +0100
 
283
@@ -369,7 +369,7 @@
 
284
 AC_SUBST(RANDOM_SEED_CFLAGS)
 
285
 
 
286
 dnl On GNU/Linux ifunc is supported by the dynamic linker in glibc
 
287
-dnl 2.11 or later.
 
288
+dnl 2.11 or later, and by binutils 2.20.1 or later.
 
289
 AC_CACHE_CHECK([for glibc >= 2.11], [gold_cv_lib_glibc2_11],
 
290
 [AC_COMPILE_IFELSE([
 
291
 #include <features.h>
 
292
@@ -378,6 +378,7 @@
 
293
 #elif __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 11)
 
294
 error
 
295
 #endif
 
296
+__asm__(".type foo, %gnu_indirect_function");
 
297
 ], [gold_cv_lib_glibc2_11=yes], [gold_cv_lib_glibc2_11=no])])
 
298
 
 
299
 AM_CONDITIONAL(IFUNC, test "$gold_cv_lib_glibc2_11" = "yes")
 
300
diff -urN '--exclude=debian' '--exclude=CVS' a/gold/fileread.cc a/gold/fileread.cc
 
301
--- a/gold/fileread.cc  2010-10-12 17:30:24.000000000 +0200
 
302
+++ a/gold/fileread.cc  2011-03-10 14:24:41.653056809 +0100
 
303
@@ -1,6 +1,6 @@
 
304
 // fileread.cc -- read files for gold
 
305
 
 
306
-// Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
307
+// Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
 
308
 // Written by Ian Lance Taylor <iant@google.com>.
 
309
 
 
310
 // This file is part of gold.
 
311
@@ -24,6 +24,7 @@
 
312
 
 
313
 #include <cstring>
 
314
 #include <cerrno>
 
315
+#include <climits>
 
316
 #include <fcntl.h>
 
317
 #include <unistd.h>
 
318
 #include <sys/mman.h>
 
319
@@ -598,11 +599,22 @@
 
320
               got, want, static_cast<long long>(base + first_offset));
 
321
 }
 
322
 
 
323
+// Portable IOV_MAX.
 
324
+
 
325
+#if !defined(HAVE_READV)
 
326
+#define GOLD_IOV_MAX 1
 
327
+#elif defined(IOV_MAX)
 
328
+#define GOLD_IOV_MAX IOV_MAX
 
329
+#else
 
330
+#define GOLD_IOV_MAX (File_read::max_readv_entries * 2)
 
331
+#endif
 
332
+
 
333
 // Read several pieces of data from the file.
 
334
 
 
335
 void
 
336
 File_read::read_multiple(off_t base, const Read_multiple& rm)
 
337
 {
 
338
+  static size_t iov_max = GOLD_IOV_MAX;
 
339
   size_t count = rm.size();
 
340
   size_t i = 0;
 
341
   while (i < count)
 
342
@@ -615,7 +627,7 @@
 
343
       size_t j;
 
344
       for (j = i + 1; j < count; ++j)
 
345
        {
 
346
-         if (j - i >= File_read::max_readv_entries)
 
347
+         if (j - i >= File_read::max_readv_entries || j - i >= iov_max / 2)
 
348
            break;
 
349
          const Read_multiple_entry& j_entry(rm[j]);
 
350
          off_t j_off = j_entry.file_offset;
 
351
diff -urN '--exclude=debian' '--exclude=CVS' a/gold/fileread.h a/gold/fileread.h
 
352
--- a/gold/fileread.h   2010-08-25 10:36:54.000000000 +0200
 
353
+++ a/gold/fileread.h   2011-03-10 14:24:41.663056953 +0100
 
354
@@ -1,6 +1,6 @@
 
355
 // fileread.h -- read files for gold   -*- C++ -*-
 
356
 
 
357
-// Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
358
+// Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
 
359
 // Written by Ian Lance Taylor <iant@google.com>.
 
360
 
 
361
 // This file is part of gold.
 
362
@@ -399,13 +399,7 @@
 
363
   { return (file_size + (page_size - 1)) & ~ (page_size - 1); }
 
364
 
 
365
   // The maximum number of entries we will pass to ::readv.
 
366
-#ifdef HAVE_READV
 
367
   static const size_t max_readv_entries = 128;
 
368
-#else
 
369
-  // On targets that don't have readv set the max to 1 so readv is not
 
370
-  // used.
 
371
-  static const size_t max_readv_entries = 1;
 
372
-#endif
 
373
 
 
374
   // Use readv to read data.
 
375
   void
 
376
diff -urN '--exclude=debian' '--exclude=CVS' a/gold/options.h a/gold/options.h
 
377
--- a/gold/options.h    2010-10-15 00:10:22.000000000 +0200
 
378
+++ a/gold/options.h    2011-03-08 12:37:04.043057183 +0100
 
379
@@ -623,6 +623,10 @@
 
380
   DEFINE_bool_alias(Bstatic, Bdynamic, options::ONE_DASH, '\0',
 
381
                    N_("-l does not search for shared libraries"), NULL,
 
382
                    true);
 
383
+  DEFINE_bool_alias(dy, Bdynamic, options::ONE_DASH, '\0',
 
384
+                   N_("alias for -Bdynamic"), NULL, false);
 
385
+  DEFINE_bool_alias(dn, Bdynamic, options::ONE_DASH, '\0',
 
386
+                   N_("alias for -Bstatic"), NULL, true);
 
387
 
 
388
   DEFINE_bool(Bsymbolic, options::ONE_DASH, '\0', false,
 
389
               N_("Bind defined symbols locally"), NULL);