1
# DP: Update to the 2.21 branch, 20110310
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
7
+2011-03-10 Alan Modra <amodra@gmail.com>
9
+ * elf64-ppc.c (ppc64_elf_relocate_section): Provide section/offset
10
+ for LO_DS error message and correct multiple.
12
+2011-03-10 Alan Modra <amodra@gmail.com>
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.
20
+2011-03-04 Alan Modra <amodra@gmail.com>
22
+ * archive.c (bsd_write_armap): Don't call stat in deterministic
23
+ mode, and don't use st_mtime if stat returns error.
25
2011-02-28 Alan Modra <amodra@gmail.com>
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 @@
35
- struct stat statbuf;
38
firstreal = mapsize + elength + sizeof (struct ar_hdr) + SARMAG;
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;
49
if ((arch->flags & BFD_DETERMINISTIC_OUTPUT) == 0)
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;
56
+ if (stat (arch->filename, &statbuf) == 0)
57
+ bfd_ardata (arch)->armap_timestamp = (statbuf.st_mtime
58
+ + ARMAP_TIME_OFFSET);
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;
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
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
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 @@
98
+/* If --just-symbols against a final linked binary, then assume we need
99
+ toc adjusting stubs when calling functions defined there. */
102
+ppc64_elf_link_just_syms (asection *sec, struct bfd_link_info *info)
104
+ if ((sec->flags & SEC_CODE) != 0
105
+ && (sec->owner->flags & (EXEC_P | DYNAMIC)) != 0
106
+ && is_ppc64_elf (sec->owner))
108
+ asection *got = bfd_get_section_by_name (sec->owner, ".got");
110
+ && got->size >= elf_backend_got_header_size
111
+ && bfd_get_section_by_name (sec->owner, ".opd") != NULL)
112
+ sec->has_toc_reloc = 1;
114
+ _bfd_elf_link_just_syms (sec, info);
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)
124
- if (!bfd_get_section_contents (opd_bfd, opd_sec, &val, offset, 8))
127
+ if (!bfd_get_section_contents (opd_bfd, opd_sec, buf, offset, 8))
130
+ val = bfd_get_64 (opd_bfd, buf);
131
if (code_sec != NULL)
133
asection *sec, *likely = NULL;
134
@@ -9401,6 +9424,37 @@
139
+get_r2off (struct ppc_link_hash_table *htab,
140
+ struct ppc_stub_hash_entry *stub_entry)
142
+ bfd_vma r2off = htab->stub_group[stub_entry->target_section->id].toc_off;
146
+ /* Support linking -R objects. Get the toc pointer from the
149
+ asection *opd = stub_entry->h->elf.root.u.def.section;
150
+ bfd_vma opd_off = stub_entry->h->elf.root.u.def.value;
152
+ if (strcmp (opd->name, ".opd") != 0
153
+ || opd->reloc_count != 0)
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);
160
+ if (!bfd_get_section_contents (opd->owner, opd, buf, opd_off + 8, 8))
162
+ r2off = bfd_get_64 (opd->owner, buf);
163
+ r2off -= elf_gp (stub_entry->id_sec->output_section->owner);
165
+ r2off -= htab->stub_group[stub_entry->id_sec->id].toc_off;
170
ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
172
@@ -9445,10 +9499,13 @@
174
if (stub_entry->stub_type == ppc_stub_long_branch_r2off)
177
+ bfd_vma r2off = get_r2off (htab, stub_entry);
179
- r2off = (htab->stub_group[stub_entry->target_section->id].toc_off
180
- - htab->stub_group[stub_entry->id_sec->id].toc_off);
183
+ htab->stub_error = TRUE;
186
bfd_put_32 (htab->stub_bfd, STD_R2_40R1, loc);
189
@@ -9632,10 +9689,14 @@
194
+ bfd_vma r2off = get_r2off (htab, stub_entry);
198
+ htab->stub_error = TRUE;
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);
207
@@ -9875,8 +9936,12 @@
209
if (stub_entry->stub_type == ppc_stub_long_branch_r2off)
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);
216
+ htab->stub_error = TRUE;
220
if (PPC_HA (r2off) != 0)
222
@@ -11590,7 +11655,7 @@
223
bfd_boolean unresolved_reloc;
228
struct ppc_stub_hash_entry *stub_entry;
229
bfd_vma max_br_offset;
231
@@ -13126,8 +13191,8 @@
232
if (((relocation + addend) & mask) != 0)
234
(*_bfd_error_handler)
235
- (_("%B: error: relocation %s not a multiple of %d"),
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,
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
246
+2011-03-08 Ian Lance Taylor <iant@google.com>
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
255
+2011-03-07 Ian Lance Taylor <iant@google.com>
258
+ * options.h (class General_options): Add -dy and -dn.
260
+2011-03-02 Simon Baldwin <simonb@google.com>
262
+ * configure.ac: Add check for gnu_indirect_function support in
263
+ the toolchain building binutils.
264
+ * configure: Rebuild.
266
2011-03-01 Ian Lance Taylor <iant@google.com>
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)
276
+__asm__(".type foo, %gnu_indirect_function");
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
284
AC_SUBST(RANDOM_SEED_CFLAGS)
286
dnl On GNU/Linux ifunc is supported by the dynamic linker in glibc
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],
291
#include <features.h>
293
#elif __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 11)
296
+__asm__(".type foo, %gnu_indirect_function");
297
], [gold_cv_lib_glibc2_11=yes], [gold_cv_lib_glibc2_11=no])])
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
304
// fileread.cc -- read files for gold
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>.
310
// This file is part of gold.
318
#include <sys/mman.h>
319
@@ -598,11 +599,22 @@
320
got, want, static_cast<long long>(base + first_offset));
323
+// Portable IOV_MAX.
325
+#if !defined(HAVE_READV)
326
+#define GOLD_IOV_MAX 1
327
+#elif defined(IOV_MAX)
328
+#define GOLD_IOV_MAX IOV_MAX
330
+#define GOLD_IOV_MAX (File_read::max_readv_entries * 2)
333
// Read several pieces of data from the file.
336
File_read::read_multiple(off_t base, const Read_multiple& rm)
338
+ static size_t iov_max = GOLD_IOV_MAX;
339
size_t count = rm.size();
344
for (j = i + 1; j < count; ++j)
346
- if (j - i >= File_read::max_readv_entries)
347
+ if (j - i >= File_read::max_readv_entries || j - i >= iov_max / 2)
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
355
// fileread.h -- read files for gold -*- C++ -*-
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>.
361
// This file is part of gold.
363
{ return (file_size + (page_size - 1)) & ~ (page_size - 1); }
365
// The maximum number of entries we will pass to ::readv.
367
static const size_t max_readv_entries = 128;
369
- // On targets that don't have readv set the max to 1 so readv is not
371
- static const size_t max_readv_entries = 1;
374
// Use readv to read data.
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
380
DEFINE_bool_alias(Bstatic, Bdynamic, options::ONE_DASH, '\0',
381
N_("-l does not search for shared libraries"), NULL,
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);
388
DEFINE_bool(Bsymbolic, options::ONE_DASH, '\0', false,
389
N_("Bind defined symbols locally"), NULL);