patches/binutils: Remove old patches for binutils

Since we removed older binutils versions, remove patches as well.

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
This commit is contained in:
Bryan Hundven 2016-01-03 01:22:02 -08:00
parent 5543f85feb
commit ba8713947e
65 changed files with 0 additions and 3365 deletions

View File

@ -1,23 +0,0 @@
Signed-off-by: dank@kegel.com
Raising the size of the hash table is a noticable win when linking
at least one large app.
There was a patch,
http://sources.redhat.com/ml/binutils/2004-06/msg00165.html
to do this dynamically. No idea why that didn't make it in.
So this tiny change to raise the default size is just
a stopgap for now.
--- binutils-2.16.1/bfd/hash.c.old 2006-03-02 23:01:39.000000000 -0800
+++ binutils-2.16.1/bfd/hash.c 2006-03-02 23:01:58.000000000 -0800
@@ -300,7 +300,7 @@
*/
/* The default number of entries to use when creating a hash table. */
-#define DEFAULT_SIZE 4051
+#define DEFAULT_SIZE 32749
static size_t bfd_default_hash_table_size = DEFAULT_SIZE;
/* Create a new hash table, given a number of entries. */

View File

@ -1,40 +0,0 @@
Make psignal prototype in libiberty match that in glibc.
Fixes:
gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c: In function `psignal':
gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:563: argument `signo' doesn't match prototype
/usr/include/signal.h:131: prototype declaration
gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:563: argument `message' doesn't match prototype
/usr/include/signal.h:131: prototype declaration
gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:568: warning: comparison between signed and unsigned
mprotect... make[1]: *** [strsignal.o] Error 1
make[1]: Leaving directory `/export/hda3/dkegel/queue/jobdir.produser_cpsm17/crosstool-0.32/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.1.3/build-binutils/libiberty'
make: *** [all-libiberty] Error 2
when building on red hat 7.1
though it's a bit of a mystery why libiberty's psignal is being compiled at
all, since red hat 7.1's glibc supports psignal (hence the error message)
--- binutils-2.15/libiberty/strsignal.c.old 2005-04-18 13:57:40.000000000 -0700
+++ binutils-2.15/libiberty/strsignal.c 2005-04-18 13:59:09.000000000 -0700
@@ -544,7 +544,7 @@
/*
-@deftypefn Supplemental void psignal (unsigned @var{signo}, char *@var{message})
+@deftypefn Supplemental void psignal (int @var{signo}, const char *@var{message})
Print @var{message} to the standard error, followed by a colon,
followed by the description of the signal specified by @var{signo},
@@ -557,9 +557,7 @@
#ifndef HAVE_PSIGNAL
void
-psignal (signo, message)
- unsigned signo;
- char *message;
+psignal (int signo, const char *message)
{
if (signal_names == NULL)
{

View File

@ -1,95 +0,0 @@
[removed first hunk so it would apply to 2.16.1 - copyright date already updated - dank]
Retrieved from http://sources.redhat.com/ml/binutils/2004-04/msg00646.html
Fixes
localealias.s:544: Error: junk at end of line, first unrecognized character is `,'
when building glibc-2.3.2 with gcc-3.4.0 and binutils-2.15.90.0.3
Paths adjusted to match crosstool's patcher.
Message-Id: m3n052qw2g.fsf@whitebox.m5r.de
From: Andreas Schwab <schwab at suse dot de>
To: Nathan Sidwell <nathan at codesourcery dot com>
Cc: Ian Lance Taylor <ian at wasabisystems dot com>, binutils at sources dot redhat dot com
Date: Fri, 23 Apr 2004 22:27:19 +0200
Subject: Re: demand_empty_rest_of_line and ignore_rest_of_line
Nathan Sidwell <nathan@codesourcery.com> writes:
> Index: read.c
> ===================================================================
> RCS file: /cvs/src/src/gas/read.c,v
> retrieving revision 1.76
> diff -c -3 -p -r1.76 read.c
> *** read.c 12 Mar 2004 17:48:12 -0000 1.76
> --- read.c 18 Mar 2004 09:56:05 -0000
> *************** read_a_source_file (char *name)
> *** 1053,1059 ****
> #endif
> input_line_pointer--;
> /* Report unknown char as ignored. */
> ! ignore_rest_of_line ();
> }
>
> #ifdef md_after_pass_hook
> --- 1053,1059 ----
> #endif
> input_line_pointer--;
> /* Report unknown char as ignored. */
> ! demand_empty_rest_of_line ();
> }
>
> #ifdef md_after_pass_hook
This means that the unknown character is no longer ignored, despite the
comment. As a side effect a line starting with a line comment character
not followed by APP in NO_APP mode now triggers an error instead of just a
warning, breaking builds of glibc on m68k-linux. Earlier in
read_a_source_file where #APP is handled there is another comment that
claims that unknown comments are ignored, when in fact they aren't (only
the initial line comment character is skipped).
Note that the presence of #APP will mess up the line counters, but
that appears to be difficult to fix.
Andreas.
2004-04-23 Andreas Schwab <schwab@suse.de>
* read.c (read_a_source_file): Ignore unknown text after line
comment character. Fix misleading comment.
--- binutils/gas/read.c.~1.78.~ 2004-04-23 08:58:23.000000000 +0200
+++ binutils/gas/read.c 2004-04-23 21:49:01.000000000 +0200
@@ -950,10 +950,14 @@ read_a_source_file (char *name)
unsigned int new_length;
char *tmp_buf = 0;
- bump_line_counters ();
s = input_line_pointer;
if (strncmp (s, "APP\n", 4))
- continue; /* We ignore it */
+ {
+ /* We ignore it */
+ ignore_rest_of_line ();
+ continue;
+ }
+ bump_line_counters ();
s += 4;
sb_new (&sbuf);
@@ -1052,7 +1056,7 @@ read_a_source_file (char *name)
continue;
#endif
input_line_pointer--;
- /* Report unknown char as ignored. */
+ /* Report unknown char as error. */
demand_empty_rest_of_line ();
}
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstra&#xC3;e 5, 90409 N&#xC3;rnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."

View File

@ -1,693 +0,0 @@
Signed-off-by: dank@kegel.com
Fixes ld speed issue.
See http://weblogs.mozillazine.org/roc/archives/2005/02/optimizing_gnu.html
See thread "Re: optimizations for 3x speedup in ld",
http://sources.redhat.com/ml/binutils/2005-03/msg00847.html
Wildcard section matching enhancement, backported from the binutils CVS tree.
Here's the CVS log comment from the original change to ldlang.c:
revision 1.177
date: 2005/04/06 15:33:02; author: jakub; state: Exp; lines: +438 -51
2005-04-06 Jakub Jelinek <jakub@redhat.com>
* ldlang.c: Formatting.
(walk_wild_consider_section): Remember return value from wildcardp.
(is_simple_wild): Use strcspn instead of 2 strpbrk calls and strlen.
(wild_spec_can_overlap): Use strcspn instead of strpbrk and strlen.
2005-04-06 Robert O'Callahan <rocallahan@novell.com>
* ld.h (lean_section_userdata_type): Remove.
(fat_section_userdata_type): Remove file field.
(SECTION_USERDATA_SIZE): Remove.
* ldlang.c (init_os): Eliminate initialization of unused
lean_section_userdata_type.
* ldlang.h (callback_t, walk_wild_section_handler_t): New
typedefs.
(struct lang_wild_statement_struct): Add walk_wild_section_handler
and handler_data fields.
* ldlang.c (callback_t): Removed.
(walk_wild_consider_section, walk_wild_section_general,
section_iterator_callback, find_section, is_simple_wild,
match_simple_wild, walk_wild_section_specs1_wild0,
walk_wild_section_specs1_wild1, walk_wild_section_specs2_wild1,
walk_wild_section_specs3_wild2, walk_wild_section_specs4_wild2,
wild_spec_can_overlap, analyze_walk_wild_section_handler): New
functions.
(lang_add_wild): Call analyze_walk_wild_section_handler.
(walk_wild_section): Renamed to walk_wild_section_general and
created a wrapper function.
(section_iterator_callback_data): New typedef.
Index: src/ld/ld.h
===================================================================
RCS file: /cvs/src/src/ld/ld.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- binutils/ld/ld.h.old 16 Mar 2005 21:52:42 -0000 1.26
+++ binutils/ld/ld.h 6 Apr 2005 15:33:02 -0000 1.27
@@ -1,6 +1,6 @@
/* ld.h -- general linker header file
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004
+ 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
@@ -89,28 +89,15 @@
struct map_symbol_def *next;
};
-/* Extra information we hold on sections */
-typedef struct lean_user_section_struct {
- /* For output sections: pointer to the section where this data will go. */
- struct lang_input_statement_struct *file;
-} lean_section_userdata_type;
-
/* The initial part of fat_user_section_struct has to be idential with
lean_user_section_struct. */
typedef struct fat_user_section_struct {
- /* For output sections: pointer to the section where this data will go. */
- struct lang_input_statement_struct *file;
/* For input sections, when writing a map file: head / tail of a linked
list of hash table entries for symbols defined in this section. */
struct map_symbol_def *map_symbol_def_head;
struct map_symbol_def **map_symbol_def_tail;
} fat_section_userdata_type;
-#define SECTION_USERDATA_SIZE \
- (command_line.reduce_memory_overheads \
- ? sizeof (lean_section_userdata_type) \
- : sizeof (fat_section_userdata_type))
-
#define get_userdata(x) ((x)->userdata)
#define BYTE_SIZE (1)
Index: src/ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.176
retrieving revision 1.177
diff -u -r1.176 -r1.177
--- binutils/ld/ldlang.c.old 18 Mar 2005 13:56:26 -0000 1.176
+++ binutils/ld/ldlang.c 6 Apr 2005 15:33:02 -0000 1.177
@@ -84,9 +84,6 @@
static void lang_record_phdrs (void);
static void lang_do_version_exports_section (void);
-typedef void (*callback_t) (lang_wild_statement_type *, struct wildcard_list *,
- asection *, lang_input_statement_type *, void *);
-
/* Exported variables. */
lang_output_section_statement_type *abs_output_section;
lang_statement_list_type lang_output_section_statement;
@@ -155,21 +152,71 @@
/* Generic traversal routines for finding matching sections. */
+/* Try processing a section against a wildcard. This just calls
+ the callback unless the filename exclusion list is present
+ and excludes the file. It's hardly ever present so this
+ function is very fast. */
+
+static void
+walk_wild_consider_section (lang_wild_statement_type *ptr,
+ lang_input_statement_type *file,
+ asection *s,
+ struct wildcard_list *sec,
+ callback_t callback,
+ void *data)
+{
+ bfd_boolean skip = FALSE;
+ struct name_list *list_tmp;
+
+ /* Don't process sections from files which were
+ excluded. */
+ for (list_tmp = sec->spec.exclude_name_list;
+ list_tmp;
+ list_tmp = list_tmp->next)
+ {
+ bfd_boolean is_wildcard = wildcardp (list_tmp->name);
+ if (is_wildcard)
+ skip = fnmatch (list_tmp->name, file->filename, 0) == 0;
+ else
+ skip = strcmp (list_tmp->name, file->filename) == 0;
+
+ /* If this file is part of an archive, and the archive is
+ excluded, exclude this file. */
+ if (! skip && file->the_bfd != NULL
+ && file->the_bfd->my_archive != NULL
+ && file->the_bfd->my_archive->filename != NULL)
+ {
+ if (is_wildcard)
+ skip = fnmatch (list_tmp->name,
+ file->the_bfd->my_archive->filename,
+ 0) == 0;
+ else
+ skip = strcmp (list_tmp->name,
+ file->the_bfd->my_archive->filename) == 0;
+ }
+
+ if (skip)
+ break;
+ }
+
+ if (!skip)
+ (*callback) (ptr, sec, s, file, data);
+}
+
+/* Lowest common denominator routine that can handle everything correctly,
+ but slowly. */
+
static void
-walk_wild_section (lang_wild_statement_type *ptr,
- lang_input_statement_type *file,
- callback_t callback,
- void *data)
+walk_wild_section_general (lang_wild_statement_type *ptr,
+ lang_input_statement_type *file,
+ callback_t callback,
+ void *data)
{
asection *s;
-
- if (file->just_syms_flag)
- return;
+ struct wildcard_list *sec;
for (s = file->the_bfd->sections; s != NULL; s = s->next)
{
- struct wildcard_list *sec;
-
sec = ptr->section_list;
if (sec == NULL)
(*callback) (ptr, sec, s, file, data);
@@ -177,39 +224,8 @@
while (sec != NULL)
{
bfd_boolean skip = FALSE;
- struct name_list *list_tmp;
- /* Don't process sections from files which were
- excluded. */
- for (list_tmp = sec->spec.exclude_name_list;
- list_tmp;
- list_tmp = list_tmp->next)
- {
- if (wildcardp (list_tmp->name))
- skip = fnmatch (list_tmp->name, file->filename, 0) == 0;
- else
- skip = strcmp (list_tmp->name, file->filename) == 0;
-
- /* If this file is part of an archive, and the archive is
- excluded, exclude this file. */
- if (! skip && file->the_bfd != NULL
- && file->the_bfd->my_archive != NULL
- && file->the_bfd->my_archive->filename != NULL)
- {
- if (wildcardp (list_tmp->name))
- skip = fnmatch (list_tmp->name,
- file->the_bfd->my_archive->filename,
- 0) == 0;
- else
- skip = strcmp (list_tmp->name,
- file->the_bfd->my_archive->filename) == 0;
- }
-
- if (skip)
- break;
- }
-
- if (!skip && sec->spec.name != NULL)
+ if (sec->spec.name != NULL)
{
const char *sname = bfd_get_section_name (file->the_bfd, s);
@@ -220,13 +236,381 @@
}
if (!skip)
- (*callback) (ptr, sec, s, file, data);
+ walk_wild_consider_section (ptr, file, s, sec, callback, data);
sec = sec->next;
}
}
}
+/* Routines to find a single section given its name. If there's more
+ than one section with that name, we report that. */
+
+typedef struct
+{
+ asection *found_section;
+ bfd_boolean multiple_sections_found;
+} section_iterator_callback_data;
+
+static bfd_boolean
+section_iterator_callback (bfd *bfd ATTRIBUTE_UNUSED, asection *s, void *data)
+{
+ section_iterator_callback_data *d = data;
+
+ if (d->found_section != NULL)
+ {
+ d->multiple_sections_found = TRUE;
+ return TRUE;
+ }
+
+ d->found_section = s;
+ return FALSE;
+}
+
+static asection *
+find_section (lang_input_statement_type *file,
+ struct wildcard_list *sec,
+ bfd_boolean *multiple_sections_found)
+{
+ section_iterator_callback_data cb_data = { NULL, FALSE };
+
+ bfd_get_section_by_name_if (file->the_bfd, sec->spec.name,
+ section_iterator_callback, &cb_data);
+ *multiple_sections_found = cb_data.multiple_sections_found;
+ return cb_data.found_section;
+}
+
+/* Code for handling simple wildcards without going through fnmatch,
+ which can be expensive because of charset translations etc. */
+
+/* A simple wild is a literal string followed by a single '*',
+ where the literal part is at least 4 characters long. */
+
+static bfd_boolean
+is_simple_wild (const char *name)
+{
+ size_t len = strcspn (name, "*?[");
+ return len >= 4 && name[len] == '*' && name[len + 1] == '\0';
+}
+
+static bfd_boolean
+match_simple_wild (const char *pattern, const char *name)
+{
+ /* The first four characters of the pattern are guaranteed valid
+ non-wildcard characters. So we can go faster. */
+ if (pattern[0] != name[0] || pattern[1] != name[1]
+ || pattern[2] != name[2] || pattern[3] != name[3])
+ return FALSE;
+
+ pattern += 4;
+ name += 4;
+ while (*pattern != '*')
+ if (*name++ != *pattern++)
+ return FALSE;
+
+ return TRUE;
+}
+
+/* Specialized, optimized routines for handling different kinds of
+ wildcards */
+
+static void
+walk_wild_section_specs1_wild0 (lang_wild_statement_type *ptr,
+ lang_input_statement_type *file,
+ callback_t callback,
+ void *data)
+{
+ /* We can just do a hash lookup for the section with the right name.
+ But if that lookup discovers more than one section with the name
+ (should be rare), we fall back to the general algorithm because
+ we would otherwise have to sort the sections to make sure they
+ get processed in the bfd's order. */
+ bfd_boolean multiple_sections_found;
+ struct wildcard_list *sec0 = ptr->handler_data[0];
+ asection *s0 = find_section (file, sec0, &multiple_sections_found);
+
+ if (multiple_sections_found)
+ walk_wild_section_general (ptr, file, callback, data);
+ else if (s0)
+ walk_wild_consider_section (ptr, file, s0, sec0, callback, data);
+}
+
+static void
+walk_wild_section_specs1_wild1 (lang_wild_statement_type *ptr,
+ lang_input_statement_type *file,
+ callback_t callback,
+ void *data)
+{
+ asection *s;
+ struct wildcard_list *wildsec0 = ptr->handler_data[0];
+
+ for (s = file->the_bfd->sections; s != NULL; s = s->next)
+ {
+ const char *sname = bfd_get_section_name (file->the_bfd, s);
+ bfd_boolean skip = !match_simple_wild (wildsec0->spec.name, sname);
+
+ if (!skip)
+ walk_wild_consider_section (ptr, file, s, wildsec0, callback, data);
+ }
+}
+
+static void
+walk_wild_section_specs2_wild1 (lang_wild_statement_type *ptr,
+ lang_input_statement_type *file,
+ callback_t callback,
+ void *data)
+{
+ asection *s;
+ struct wildcard_list *sec0 = ptr->handler_data[0];
+ struct wildcard_list *wildsec1 = ptr->handler_data[1];
+ bfd_boolean multiple_sections_found;
+ asection *s0 = find_section (file, sec0, &multiple_sections_found);
+
+ if (multiple_sections_found)
+ {
+ walk_wild_section_general (ptr, file, callback, data);
+ return;
+ }
+
+ /* Note that if the section was not found, s0 is NULL and
+ we'll simply never succeed the s == s0 test below. */
+ for (s = file->the_bfd->sections; s != NULL; s = s->next)
+ {
+ /* Recall that in this code path, a section cannot satisfy more
+ than one spec, so if s == s0 then it cannot match
+ wildspec1. */
+ if (s == s0)
+ walk_wild_consider_section (ptr, file, s, sec0, callback, data);
+ else
+ {
+ const char *sname = bfd_get_section_name (file->the_bfd, s);
+ bfd_boolean skip = !match_simple_wild (wildsec1->spec.name, sname);
+
+ if (!skip)
+ walk_wild_consider_section (ptr, file, s, wildsec1, callback,
+ data);
+ }
+ }
+}
+
+static void
+walk_wild_section_specs3_wild2 (lang_wild_statement_type *ptr,
+ lang_input_statement_type *file,
+ callback_t callback,
+ void *data)
+{
+ asection *s;
+ struct wildcard_list *sec0 = ptr->handler_data[0];
+ struct wildcard_list *wildsec1 = ptr->handler_data[1];
+ struct wildcard_list *wildsec2 = ptr->handler_data[2];
+ bfd_boolean multiple_sections_found;
+ asection *s0 = find_section (file, sec0, &multiple_sections_found);
+
+ if (multiple_sections_found)
+ {
+ walk_wild_section_general (ptr, file, callback, data);
+ return;
+ }
+
+ for (s = file->the_bfd->sections; s != NULL; s = s->next)
+ {
+ if (s == s0)
+ walk_wild_consider_section (ptr, file, s, sec0, callback, data);
+ else
+ {
+ const char *sname = bfd_get_section_name (file->the_bfd, s);
+ bfd_boolean skip = !match_simple_wild (wildsec1->spec.name, sname);
+
+ if (!skip)
+ walk_wild_consider_section (ptr, file, s, wildsec1, callback, data);
+ else
+ {
+ skip = !match_simple_wild (wildsec2->spec.name, sname);
+ if (!skip)
+ walk_wild_consider_section (ptr, file, s, wildsec2, callback,
+ data);
+ }
+ }
+ }
+}
+
+static void
+walk_wild_section_specs4_wild2 (lang_wild_statement_type *ptr,
+ lang_input_statement_type *file,
+ callback_t callback,
+ void *data)
+{
+ asection *s;
+ struct wildcard_list *sec0 = ptr->handler_data[0];
+ struct wildcard_list *sec1 = ptr->handler_data[1];
+ struct wildcard_list *wildsec2 = ptr->handler_data[2];
+ struct wildcard_list *wildsec3 = ptr->handler_data[3];
+ bfd_boolean multiple_sections_found;
+ asection *s0 = find_section (file, sec0, &multiple_sections_found), *s1;
+
+ if (multiple_sections_found)
+ {
+ walk_wild_section_general (ptr, file, callback, data);
+ return;
+ }
+
+ s1 = find_section (file, sec1, &multiple_sections_found);
+ if (multiple_sections_found)
+ {
+ walk_wild_section_general (ptr, file, callback, data);
+ return;
+ }
+
+ for (s = file->the_bfd->sections; s != NULL; s = s->next)
+ {
+ if (s == s0)
+ walk_wild_consider_section (ptr, file, s, sec0, callback, data);
+ else
+ if (s == s1)
+ walk_wild_consider_section (ptr, file, s, sec1, callback, data);
+ else
+ {
+ const char *sname = bfd_get_section_name (file->the_bfd, s);
+ bfd_boolean skip = !match_simple_wild (wildsec2->spec.name,
+ sname);
+
+ if (!skip)
+ walk_wild_consider_section (ptr, file, s, wildsec2, callback,
+ data);
+ else
+ {
+ skip = !match_simple_wild (wildsec3->spec.name, sname);
+ if (!skip)
+ walk_wild_consider_section (ptr, file, s, wildsec3,
+ callback, data);
+ }
+ }
+ }
+}
+
+static void
+walk_wild_section (lang_wild_statement_type *ptr,
+ lang_input_statement_type *file,
+ callback_t callback,
+ void *data)
+{
+ if (file->just_syms_flag)
+ return;
+
+ (*ptr->walk_wild_section_handler) (ptr, file, callback, data);
+}
+
+/* Returns TRUE when name1 is a wildcard spec that might match
+ something name2 can match. We're conservative: we return FALSE
+ only if the prefixes of name1 and name2 are different up to the
+ first wildcard character. */
+
+static bfd_boolean
+wild_spec_can_overlap (const char *name1, const char *name2)
+{
+ size_t prefix1_len = strcspn (name1, "?*[");
+ size_t prefix2_len = strcspn (name2, "?*[");
+ size_t min_prefix_len;
+
+ /* Note that if there is no wildcard character, then we treat the
+ terminating 0 as part of the prefix. Thus ".text" won't match
+ ".text." or ".text.*", for example. */
+ if (name1[prefix1_len] == '\0')
+ prefix1_len++;
+ if (name2[prefix2_len] == '\0')
+ prefix2_len++;
+
+ min_prefix_len = prefix1_len < prefix2_len ? prefix1_len : prefix2_len;
+
+ return memcmp (name1, name2, min_prefix_len) == 0;
+}
+
+/* Select specialized code to handle various kinds of wildcard
+ statements. */
+
+static void
+analyze_walk_wild_section_handler (lang_wild_statement_type *ptr)
+{
+ int sec_count = 0;
+ int wild_name_count = 0;
+ struct wildcard_list *sec;
+ int signature;
+ int data_counter;
+
+ ptr->walk_wild_section_handler = walk_wild_section_general;
+
+ /* Count how many wildcard_specs there are, and how many of those
+ actually use wildcards in the name. Also, bail out if any of the
+ wildcard names are NULL. (Can this actually happen?
+ walk_wild_section used to test for it.) And bail out if any
+ of the wildcards are more complex than a simple string
+ ending in a single '*'. */
+ for (sec = ptr->section_list; sec != NULL; sec = sec->next)
+ {
+ ++sec_count;
+ if (sec->spec.name == NULL)
+ return;
+ if (wildcardp (sec->spec.name))
+ {
+ ++wild_name_count;
+ if (!is_simple_wild (sec->spec.name))
+ return;
+ }
+ }
+
+ /* The zero-spec case would be easy to optimize but it doesn't
+ happen in practice. Likewise, more than 4 specs doesn't
+ happen in practice. */
+ if (sec_count == 0 || sec_count > 4)
+ return;
+
+ /* Check that no two specs can match the same section. */
+ for (sec = ptr->section_list; sec != NULL; sec = sec->next)
+ {
+ struct wildcard_list *sec2;
+ for (sec2 = sec->next; sec2 != NULL; sec2 = sec2->next)
+ {
+ if (wild_spec_can_overlap (sec->spec.name, sec2->spec.name))
+ return;
+ }
+ }
+
+ signature = (sec_count << 8) + wild_name_count;
+ switch (signature)
+ {
+ case 0x0100:
+ ptr->walk_wild_section_handler = walk_wild_section_specs1_wild0;
+ break;
+ case 0x0101:
+ ptr->walk_wild_section_handler = walk_wild_section_specs1_wild1;
+ break;
+ case 0x0201:
+ ptr->walk_wild_section_handler = walk_wild_section_specs2_wild1;
+ break;
+ case 0x0302:
+ ptr->walk_wild_section_handler = walk_wild_section_specs3_wild2;
+ break;
+ case 0x0402:
+ ptr->walk_wild_section_handler = walk_wild_section_specs4_wild2;
+ break;
+ default:
+ return;
+ }
+
+ /* Now fill the data array with pointers to the specs, first the
+ specs with non-wildcard names, then the specs with wildcard
+ names. It's OK to process the specs in different order from the
+ given order, because we've already determined that no section
+ will match more than one spec. */
+ data_counter = 0;
+ for (sec = ptr->section_list; sec != NULL; sec = sec->next)
+ if (!wildcardp (sec->spec.name))
+ ptr->handler_data[data_counter++] = sec;
+ for (sec = ptr->section_list; sec != NULL; sec = sec->next)
+ if (wildcardp (sec->spec.name))
+ ptr->handler_data[data_counter++] = sec;
+}
+
/* Handle a wild statement for a single file F. */
static void
@@ -1175,17 +1559,12 @@
static void
init_os (lang_output_section_statement_type *s)
{
- lean_section_userdata_type *new;
-
if (s->bfd_section != NULL)
return;
if (strcmp (s->name, DISCARD_SECTION_NAME) == 0)
einfo (_("%P%F: Illegal use of `%s' section\n"), DISCARD_SECTION_NAME);
- new = stat_alloc (SECTION_USERDATA_SIZE);
- memset (new, 0, SECTION_USERDATA_SIZE);
-
s->bfd_section = bfd_get_section_by_name (output_bfd, s->name);
if (s->bfd_section == NULL)
s->bfd_section = bfd_make_section (output_bfd, s->name);
@@ -1199,7 +1578,14 @@
/* We initialize an output sections output offset to minus its own
vma to allow us to output a section through itself. */
s->bfd_section->output_offset = 0;
- get_userdata (s->bfd_section) = new;
+ if (!command_line.reduce_memory_overheads)
+ {
+ fat_section_userdata_type *new
+ = stat_alloc (sizeof (fat_section_userdata_type));
+ memset (new, 0, sizeof (fat_section_userdata_type));
+ get_userdata (s->bfd_section) = new;
+ }
+
/* If there is a base address, make sure that any sections it might
mention are initialized. */
@@ -4939,6 +5325,7 @@
new->section_list = section_list;
new->keep_sections = keep_sections;
lang_list_init (&new->children);
+ analyze_walk_wild_section_handler (new);
}
void
Index: src/ld/ldlang.h
===================================================================
RCS file: /cvs/src/src/ld/ldlang.h,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- binutils/ld/ldlang.h.old 3 Mar 2005 11:51:58 -0000 1.44
+++ binutils/ld/ldlang.h 6 Apr 2005 15:33:03 -0000 1.45
@@ -298,7 +298,17 @@
union lang_statement_union *file;
} lang_afile_asection_pair_statement_type;
-typedef struct lang_wild_statement_struct
+typedef struct lang_wild_statement_struct lang_wild_statement_type;
+
+typedef void (*callback_t) (lang_wild_statement_type *, struct wildcard_list *,
+ asection *, lang_input_statement_type *, void *);
+
+typedef void (*walk_wild_section_handler_t) (lang_wild_statement_type *,
+ lang_input_statement_type *,
+ callback_t callback,
+ void *data);
+
+struct lang_wild_statement_struct
{
lang_statement_header_type header;
const char *filename;
@@ -306,7 +316,10 @@
struct wildcard_list *section_list;
bfd_boolean keep_sections;
lang_statement_list_type children;
-} lang_wild_statement_type;
+
+ walk_wild_section_handler_t walk_wild_section_handler;
+ struct wildcard_list *handler_data[4];
+};
typedef struct lang_address_statement_struct
{

View File

@ -1,22 +0,0 @@
--- binutils-2.15/configure.old 2004-07-21 21:36:47.000000000 -0700
+++ binutils-2.15/configure 2004-07-21 21:37:08.000000000 -0700
@@ -999,7 +999,7 @@
# Some tools are only suitable for building in a "native" situation.
# Remove these if host!=target.
-native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf"
+native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf"
# Similarly, some are only suitable for cross toolchains.
# Remove these if host=target.
--- binutils-2.15/configure.in.old 2004-07-21 21:37:19.000000000 -0700
+++ binutils-2.15/configure.in 2004-07-21 21:37:34.000000000 -0700
@@ -236,7 +236,7 @@
# Some tools are only suitable for building in a "native" situation.
# Remove these if host!=target.
-native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf"
+native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf"
# Similarly, some are only suitable for cross toolchains.
# Remove these if host=target.

View File

@ -1,28 +0,0 @@
Signed-off-by: dank@kegel.com
See http://sourceware.org/ml/binutils/2005-12/msg00270.html
http://sourceware.org/ml/binutils-cvs/2005-12/msg00139.html
STABS hash table size change, backported from the binutils CVS tree. Here's
the CVS log comment for the original change:
revision 1.25
date: 2005/12/29 10:29:23; author: nickc; state: Exp; lines: +2 -3
(_bfd_link_section_stabs): Use bfd_hash_table_init rather than
bfd_hash_table_init_n(...,251) so that the size of the hash table can be
controlled by the user.
--- binutils/bfd/stabs.c.old 4 May 2005 15:53:39 -0000 1.24
+++ binutils/bfd/stabs.c 29 Dec 2005 10:29:23 -0000 1.25
@@ -194,9 +194,8 @@
goto error_return;
/* Make sure the first byte is zero. */
(void) _bfd_stringtab_add (sinfo->strings, "", TRUE, TRUE);
- if (! bfd_hash_table_init_n (&sinfo->includes,
- stab_link_includes_newfunc,
- 251))
+ if (! bfd_hash_table_init (&sinfo->includes,
+ stab_link_includes_newfunc))
goto error_return;
sinfo->stabstr = bfd_make_section_anyway (abfd, ".stabstr");
if (sinfo->stabstr == NULL)

View File

@ -1,40 +0,0 @@
diff -durN binutils-2.16.1.orig/gas/config/tc-i386.c binutils-2.16.1/gas/config/tc-i386.c
--- binutils-2.16.1.orig/gas/config/tc-i386.c 2005-04-13 19:58:42.000000000 +0200
+++ binutils-2.16.1/gas/config/tc-i386.c 2008-09-22 09:00:09.000000000 +0200
@@ -192,16 +192,10 @@
#endif
;
-#if (defined (TE_I386AIX) \
- || ((defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)) \
- && !defined (TE_LINUX) \
- && !defined (TE_NETWARE) \
- && !defined (TE_FreeBSD) \
- && !defined (TE_NetBSD)))
/* This array holds the chars that always start a comment. If the
pre-processor is disabled, these aren't very useful. */
-const char comment_chars[] = "#/";
-#define PREFIX_SEPARATOR '\\'
+const char comment_chars[] = "#";
+#define PREFIX_SEPARATOR '/'
/* This array holds the chars that only start a comment at the beginning of
a line. If the line seems to have the form '# 123 filename'
@@ -211,16 +205,7 @@
#NO_APP at the beginning of its output.
Also note that comments started like this one will always work if
'/' isn't otherwise defined. */
-const char line_comment_chars[] = "#";
-
-#else
-/* Putting '/' here makes it impossible to use the divide operator.
- However, we need it for compatibility with SVR4 systems. */
-const char comment_chars[] = "#";
-#define PREFIX_SEPARATOR '/'
-
-const char line_comment_chars[] = "/#";
-#endif
+const char line_comment_chars[] = "#/";
const char line_separator_chars[] = ";";

View File

@ -1,149 +0,0 @@
diff -dur binutils-2.17.old/bfd/configure binutils-2.17/bfd/configure
--- binutils-2.17.old/bfd/configure 2006-06-23 20:17:03.000000000 +0200
+++ binutils-2.17/bfd/configure 2007-05-01 18:26:03.000000000 +0200
@@ -3576,7 +3576,7 @@
;;
# This must be Linux ELF.
-linux-gnu*)
+linux-gnu*|linux-uclibc*)
lt_cv_deplibs_check_method=pass_all
;;
diff -dur binutils-2.17.old/binutils/configure binutils-2.17/binutils/configure
--- binutils-2.17.old/binutils/configure 2006-04-06 23:49:29.000000000 +0200
+++ binutils-2.17/binutils/configure 2007-05-01 18:26:03.000000000 +0200
@@ -3411,7 +3411,7 @@
;;
# This must be Linux ELF.
-linux-gnu*)
+linux-gnu*|linux-uclibc*)
lt_cv_deplibs_check_method=pass_all
;;
diff -dur binutils-2.17.old/configure binutils-2.17/configure
--- binutils-2.17.old/configure 2006-04-06 23:49:25.000000000 +0200
+++ binutils-2.17/configure 2007-05-01 18:26:03.000000000 +0200
@@ -1276,7 +1276,7 @@
am33_2.0-*-linux*)
noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
;;
- sh-*-linux*)
+ sh*-*-linux*)
noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
;;
sh*-*-pe|mips*-*-pe|*arm-wince-pe)
@@ -1584,7 +1584,7 @@
romp-*-*)
noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
;;
- sh-*-* | sh64-*-*)
+ sh*-*-* | sh64-*-*)
case "${host}" in
i[3456789]86-*-vsta) ;; # don't add gprof back in
i[3456789]86-*-go32*) ;; # don't add gprof back in
diff -dur binutils-2.17.old/configure.in binutils-2.17/configure.in
--- binutils-2.17.old/configure.in 2006-06-23 20:19:53.000000000 +0200
+++ binutils-2.17/configure.in 2007-05-01 18:26:03.000000000 +0200
@@ -468,7 +468,7 @@
am33_2.0-*-linux*)
noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
;;
- sh-*-linux*)
+ sh*-*-linux*)
noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
;;
sh*-*-pe|mips*-*-pe|*arm-wince-pe)
@@ -776,7 +776,7 @@
romp-*-*)
noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
;;
- sh-*-* | sh64-*-*)
+ sh*-*-* | sh64-*-*)
case "${host}" in
i[[3456789]]86-*-vsta) ;; # don't add gprof back in
i[[3456789]]86-*-go32*) ;; # don't add gprof back in
diff -dur binutils-2.17.old/gas/configure binutils-2.17/gas/configure
--- binutils-2.17.old/gas/configure 2006-04-06 23:49:31.000000000 +0200
+++ binutils-2.17/gas/configure 2007-05-01 18:26:03.000000000 +0200
@@ -3411,7 +3411,7 @@
;;
# This must be Linux ELF.
-linux-gnu*)
+linux-gnu*|linux-uclibc*)
lt_cv_deplibs_check_method=pass_all
;;
diff -dur binutils-2.17.old/gprof/configure binutils-2.17/gprof/configure
--- binutils-2.17.old/gprof/configure 2006-04-06 23:49:33.000000000 +0200
+++ binutils-2.17/gprof/configure 2007-05-01 18:26:03.000000000 +0200
@@ -3414,6 +3414,11 @@
lt_cv_deplibs_check_method=pass_all
;;
+linux-uclibc*)
+ lt_cv_deplibs_check_method=pass_all
+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
+ ;;
+
netbsd* | knetbsd*-gnu)
if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
diff -dur binutils-2.17.old/ld/configure binutils-2.17/ld/configure
--- binutils-2.17.old/ld/configure 2006-04-11 12:36:26.000000000 +0200
+++ binutils-2.17/ld/configure 2007-05-01 18:26:03.000000000 +0200
@@ -3413,7 +3413,7 @@
;;
# This must be Linux ELF.
-linux-gnu*)
+linux-gnu*|linux-uclibc*)
lt_cv_deplibs_check_method=pass_all
;;
diff -dur binutils-2.17.old/libtool.m4 binutils-2.17/libtool.m4
--- binutils-2.17.old/libtool.m4 2005-12-27 17:37:57.000000000 +0100
+++ binutils-2.17/libtool.m4 2007-05-01 18:26:03.000000000 +0200
@@ -739,7 +739,7 @@
;;
# This must be Linux ELF.
-linux-gnu*)
+linux-gnu*|linux-uclibc*)
lt_cv_deplibs_check_method=pass_all
;;
diff -dur binutils-2.17.old/ltconfig binutils-2.17/ltconfig
--- binutils-2.17.old/ltconfig 2005-07-16 04:36:38.000000000 +0200
+++ binutils-2.17/ltconfig 2007-05-01 18:26:03.000000000 +0200
@@ -602,6 +602,7 @@
# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
case $host_os in
+linux-uclibc*) ;;
linux-gnu*) ;;
linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
esac
@@ -1247,7 +1248,7 @@
;;
# This must be Linux ELF.
-linux-gnu*)
+linux-gnu*|linux-uclibc*)
version_type=linux
need_lib_prefix=no
need_version=no
diff -dur binutils-2.17.old/opcodes/configure binutils-2.17/opcodes/configure
--- binutils-2.17.old/opcodes/configure 2006-02-17 15:36:28.000000000 +0100
+++ binutils-2.17/opcodes/configure 2007-05-01 18:26:03.000000000 +0200
@@ -3579,7 +3579,7 @@
;;
# This must be Linux ELF.
-linux-gnu*)
+linux-gnu*|linux-uclibc*)
lt_cv_deplibs_check_method=pass_all
;;

View File

@ -1,24 +0,0 @@
diff -dur binutils-2.17.old/configure binutils-2.17/configure
--- binutils-2.17.old/configure 2007-05-01 18:26:03.000000000 +0200
+++ binutils-2.17/configure 2007-05-01 18:26:06.000000000 +0200
@@ -1305,7 +1305,7 @@
arm-*-elf* | strongarm-*-elf* | xscale-*-elf* | arm*-*-eabi* )
noconfigdirs="$noconfigdirs target-libffi target-qthreads"
;;
- arm*-*-linux-gnueabi)
+ arm*-*-linux-gnueabi | arm*-*-linux-uclibcgnueabi)
noconfigdirs="$noconfigdirs target-libffi target-qthreads"
noconfigdirs="$noconfigdirs target-libjava target-libobjc"
;;
diff -dur binutils-2.17.old/configure.in binutils-2.17/configure.in
--- binutils-2.17.old/configure.in 2007-05-01 18:26:03.000000000 +0200
+++ binutils-2.17/configure.in 2007-05-01 18:26:06.000000000 +0200
@@ -497,7 +497,7 @@
arm-*-elf* | strongarm-*-elf* | xscale-*-elf* | arm*-*-eabi* )
noconfigdirs="$noconfigdirs target-libffi target-qthreads"
;;
- arm*-*-linux-gnueabi)
+ arm*-*-linux-gnueabi | arm*-*-linux-uclibcgnueabi)
noconfigdirs="$noconfigdirs target-libffi target-qthreads"
noconfigdirs="$noconfigdirs target-libjava target-libobjc"
;;

View File

@ -1,16 +0,0 @@
diff -u binutils-2.18-orig/configure binutils-2.18/configure
--- binutils-2.18-orig/configure 2007-08-06 16:29:40.000000000 -0400
+++ binutils-2.18/configure 2007-09-27 22:41:51.000000000 -0400
@@ -6125,10 +6125,10 @@
*" texinfo "*) MAKEINFO='$$r/$(BUILD_SUBDIR)/texinfo/makeinfo/makeinfo' ;;
*)
- # For an installed makeinfo, we require it to be from texinfo 4.4 or
+ # For an installed makeinfo, we require it to be from texinfo 4.6 or
# higher, else we use the "missing" dummy.
if ${MAKEINFO} --version \
- | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[4-9]|[5-9])' >/dev/null 2>&1; then
+ | egrep 'texinfo[^0-9]*(4\.([6-9]|[1-9][0-9])|[5-9]|[1-9][0-9])' >/dev/null 2>&1; then
:
else
MAKEINFO="$MISSING makeinfo"

View File

@ -1,24 +0,0 @@
diff -dur binutils-2.17.old/ld/Makefile.am binutils-2.17/ld/Makefile.am
--- binutils-2.17.old/ld/Makefile.am 2006-06-03 06:45:50.000000000 +0200
+++ binutils-2.17/ld/Makefile.am 2007-05-01 18:26:09.000000000 +0200
@@ -20,7 +20,7 @@
# We put the scripts in the directory $(scriptdir)/ldscripts.
# We can't put the scripts in $(datadir) because the SEARCH_DIR
# directives need to be different for native and cross linkers.
-scriptdir = $(tooldir)/lib
+scriptdir = $(libdir)
EMUL = @EMUL@
EMULATION_OFILES = @EMULATION_OFILES@
diff -dur binutils-2.17.old/ld/Makefile.in binutils-2.17/ld/Makefile.in
--- binutils-2.17.old/ld/Makefile.in 2006-06-03 06:45:50.000000000 +0200
+++ binutils-2.17/ld/Makefile.in 2007-05-01 18:26:09.000000000 +0200
@@ -269,7 +269,7 @@
# We put the scripts in the directory $(scriptdir)/ldscripts.
# We can't put the scripts in $(datadir) because the SEARCH_DIR
# directives need to be different for native and cross linkers.
-scriptdir = $(tooldir)/lib
+scriptdir = $(libdir)
BASEDIR = $(srcdir)/..
BFDDIR = $(BASEDIR)/bfd
INCDIR = $(BASEDIR)/include

View File

@ -1,17 +0,0 @@
diff -dur binutils-2.17.old/bfd/opncls.c binutils-2.17/bfd/opncls.c
--- binutils-2.17.old/bfd/opncls.c 2006-03-16 13:20:16.000000000 +0100
+++ binutils-2.17/bfd/opncls.c 2007-05-01 18:26:11.000000000 +0200
@@ -158,6 +158,13 @@
{
bfd *nbfd;
const bfd_target *target_vec;
+ struct stat s;
+
+ if (stat (filename, &s) == 0)
+ if (S_ISDIR(s.st_mode)) {
+ bfd_set_error (bfd_error_file_not_recognized);
+ return NULL;
+ }
nbfd = _bfd_new_bfd ();
if (nbfd == NULL)

View File

@ -1,21 +0,0 @@
diff -dur binutils-2.17.old/ld/emultempl/elf32.em binutils-2.17/ld/emultempl/elf32.em
--- binutils-2.17.old/ld/emultempl/elf32.em 2006-06-12 15:05:04.000000000 +0200
+++ binutils-2.17/ld/emultempl/elf32.em 2007-05-01 18:26:13.000000000 +0200
@@ -970,6 +970,8 @@
&& command_line.rpath == NULL)
{
lib_path = (const char *) getenv ("LD_RUN_PATH");
+ if ((lib_path) && (strlen (lib_path) == 0))
+ lib_path = NULL;
if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
force))
break;
@@ -1154,6 +1156,8 @@
rpath = command_line.rpath;
if (rpath == NULL)
rpath = (const char *) getenv ("LD_RUN_PATH");
+ if ((rpath) && (strlen (rpath) == 0))
+ rpath = NULL;
if (! (bfd_elf_size_dynamic_sections
(output_bfd, command_line.soname, rpath,
command_line.filter_shlib,

View File

@ -1,28 +0,0 @@
diff -dur binutils-2.17.old/bfd/elf32-mips.c binutils-2.17/bfd/elf32-mips.c
--- binutils-2.17.old/bfd/elf32-mips.c 2006-03-22 10:28:13.000000000 +0100
+++ binutils-2.17/bfd/elf32-mips.c 2007-05-01 18:26:15.000000000 +0200
@@ -1617,7 +1617,9 @@
/* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses
page sizes of up to that limit, so we need to respect it. */
-#define ELF_MAXPAGESIZE 0x10000
+/*#define ELF_MAXPAGESIZE 0x10000*/
+/* Use 4K to shrink the elf header. NOT for general use! */
+#define ELF_MAXPAGESIZE 0x1000
#define elf32_bed elf32_tradbed
/* Include the target file again for this target. */
diff -dur binutils-2.17.old/bfd/elfn32-mips.c binutils-2.17/bfd/elfn32-mips.c
--- binutils-2.17.old/bfd/elfn32-mips.c 2005-11-23 15:04:17.000000000 +0100
+++ binutils-2.17/bfd/elfn32-mips.c 2007-05-01 18:26:15.000000000 +0200
@@ -2402,7 +2402,9 @@
/* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses
page sizes of up to that limit, so we need to respect it. */
-#define ELF_MAXPAGESIZE 0x10000
+/*#define ELF_MAXPAGESIZE 0x10000*/
+/* Use 4K to shrink the elf header. NOT for general use! */
+#define ELF_MAXPAGESIZE 0x1000
#define elf32_bed elf32_tradbed
/* Include the target file again for this target. */

View File

@ -1,23 +0,0 @@
Signed-off-by: dank@kegel.com
Raising the size of the hash table is a noticable win when linking
at least one large app.
There was a patch,
http://sources.redhat.com/ml/binutils/2004-06/msg00165.html
to do this dynamically. No idea why that didn't make it in.
So this tiny change to raise the default size is just
a stopgap for now.
--- binutils-2.17/bfd/hash.c.old 2006-03-02 23:01:39.000000000 -0800
+++ binutils-2.17/bfd/hash.c 2006-03-02 23:01:58.000000000 -0800
@@ -298,7 +298,7 @@
*/
/* The default number of entries to use when creating a hash table. */
-#define DEFAULT_SIZE 4051
+#define DEFAULT_SIZE 32749
static size_t bfd_default_hash_table_size = DEFAULT_SIZE;
/* Create a new hash table, given a number of entries. */

View File

@ -1,29 +0,0 @@
Make psignal prototype in libiberty match that in glibc.
Fixes:
gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c: In function `psignal':
gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:563: argument `signo' doesn't match prototype
/usr/include/signal.h:131: prototype declaration
gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:563: argument `message' doesn't match prototype
/usr/include/signal.h:131: prototype declaration
gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:568: warning: comparison between signed and unsigned
mprotect... make[1]: *** [strsignal.o] Error 1
make[1]: Leaving directory `/export/hda3/dkegel/queue/jobdir.produser_cpsm17/crosstool-0.32/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.1.3/build-binutils/libiberty'
make: *** [all-libiberty] Error 2
when building on red hat 7.1
though it's a bit of a mystery why libiberty's psignal is being compiled at
all, since red hat 7.1's glibc supports psignal (hence the error message)
--- binutils-2.17/libiberty/strsignal.c.old 2005-04-18 13:57:40.000000000 -0700
+++ binutils-2.17/libiberty/strsignal.c 2005-04-18 13:59:09.000000000 -0700
@@ -536,7 +536,7 @@
/*
-@deftypefn Supplemental void psignal (unsigned @var{signo}, char *@var{message})
+@deftypefn Supplemental void psignal (int @var{signo}, const char *@var{message})
Print @var{message} to the standard error, followed by a colon,
followed by the description of the signal specified by @var{signo},

View File

@ -1,95 +0,0 @@
[removed first hunk so it would apply to 2.16.1 - copyright date already updated - dank]
Retrieved from http://sources.redhat.com/ml/binutils/2004-04/msg00646.html
Fixes
localealias.s:544: Error: junk at end of line, first unrecognized character is `,'
when building glibc-2.3.2 with gcc-3.4.0 and binutils-2.15.90.0.3
Paths adjusted to match crosstool's patcher.
Message-Id: m3n052qw2g.fsf@whitebox.m5r.de
From: Andreas Schwab <schwab at suse dot de>
To: Nathan Sidwell <nathan at codesourcery dot com>
Cc: Ian Lance Taylor <ian at wasabisystems dot com>, binutils at sources dot redhat dot com
Date: Fri, 23 Apr 2004 22:27:19 +0200
Subject: Re: demand_empty_rest_of_line and ignore_rest_of_line
Nathan Sidwell <nathan@codesourcery.com> writes:
> Index: read.c
> ===================================================================
> RCS file: /cvs/src/src/gas/read.c,v
> retrieving revision 1.76
> diff -c -3 -p -r1.76 read.c
> *** read.c 12 Mar 2004 17:48:12 -0000 1.76
> --- read.c 18 Mar 2004 09:56:05 -0000
> *************** read_a_source_file (char *name)
> *** 1053,1059 ****
> #endif
> input_line_pointer--;
> /* Report unknown char as ignored. */
> ! ignore_rest_of_line ();
> }
>
> #ifdef md_after_pass_hook
> --- 1053,1059 ----
> #endif
> input_line_pointer--;
> /* Report unknown char as ignored. */
> ! demand_empty_rest_of_line ();
> }
>
> #ifdef md_after_pass_hook
This means that the unknown character is no longer ignored, despite the
comment. As a side effect a line starting with a line comment character
not followed by APP in NO_APP mode now triggers an error instead of just a
warning, breaking builds of glibc on m68k-linux. Earlier in
read_a_source_file where #APP is handled there is another comment that
claims that unknown comments are ignored, when in fact they aren't (only
the initial line comment character is skipped).
Note that the presence of #APP will mess up the line counters, but
that appears to be difficult to fix.
Andreas.
2004-04-23 Andreas Schwab <schwab@suse.de>
* read.c (read_a_source_file): Ignore unknown text after line
comment character. Fix misleading comment.
--- binutils/gas/read.c.~1.78.~ 2004-04-23 08:58:23.000000000 +0200
+++ binutils/gas/read.c 2004-04-23 21:49:01.000000000 +0200
@@ -1008,10 +1008,14 @@ read_a_source_file (char *name)
unsigned int new_length;
char *tmp_buf = 0;
- bump_line_counters ();
s = input_line_pointer;
if (strncmp (s, "APP\n", 4))
- continue; /* We ignore it */
+ {
+ /* We ignore it */
+ ignore_rest_of_line ();
+ continue;
+ }
+ bump_line_counters ();
s += 4;
sb_new (&sbuf);
@@ -1110,7 +1110,7 @@ read_a_source_file (char *name)
continue;
#endif
input_line_pointer--;
- /* Report unknown char as ignored. */
+ /* Report unknown char as error. */
demand_empty_rest_of_line ();
}
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstra&#xC3;e 5, 90409 N&#xC3;rnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."

View File

@ -1,22 +0,0 @@
--- binutils-2.17/configure.old 2004-07-21 21:36:47.000000000 -0700
+++ binutils-2.17/configure 2004-07-21 21:37:08.000000000 -0700
@@ -1022,7 +1022,7 @@
# Some tools are only suitable for building in a "native" situation.
# Remove these if host!=target.
-native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf"
+native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf"
# Similarly, some are only suitable for cross toolchains.
# Remove these if host=target.
--- binutils-2.17/configure.in.old 2004-07-21 21:37:19.000000000 -0700
+++ binutils-2.17/configure.in 2004-07-21 21:37:34.000000000 -0700
@@ -227,7 +227,7 @@
# Some tools are only suitable for building in a "native" situation.
# Remove these if host!=target.
-native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf"
+native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf"
# Similarly, some are only suitable for cross toolchains.
# Remove these if host=target.

View File

@ -1,64 +0,0 @@
diff -durN binutils-2.17.orig/gas/config/tc-i386.c binutils-2.17/gas/config/tc-i386.c
--- binutils-2.17.orig/gas/config/tc-i386.c 2006-04-07 08:40:57.000000000 +0200
+++ binutils-2.17/gas/config/tc-i386.c 2008-09-22 09:06:07.000000000 +0200
@@ -196,24 +196,10 @@
#endif
;
-#if (defined (TE_I386AIX) \
- || ((defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)) \
- && !defined (TE_GNU) \
- && !defined (TE_LINUX) \
- && !defined (TE_NETWARE) \
- && !defined (TE_FreeBSD) \
- && !defined (TE_NetBSD)))
/* This array holds the chars that always start a comment. If the
- pre-processor is disabled, these aren't very useful. The option
- --divide will remove '/' from this list. */
-const char *i386_comment_chars = "#/";
-#define SVR4_COMMENT_CHARS 1
-#define PREFIX_SEPARATOR '\\'
-
-#else
+ pre-processor is disabled, these aren't very useful. */
const char *i386_comment_chars = "#";
#define PREFIX_SEPARATOR '/'
-#endif
/* This array holds the chars that only start a comment at the beginning of
a line. If the line seems to have the form '# 123 filename'
@@ -5486,20 +5472,6 @@
break;
case OPTION_DIVIDE:
-#ifdef SVR4_COMMENT_CHARS
- {
- char *n, *t;
- const char *s;
-
- n = (char *) xmalloc (strlen (i386_comment_chars) + 1);
- t = n;
- for (s = i386_comment_chars; *s != '\0'; s++)
- if (*s != '/')
- *t++ = *s;
- *t = '\0';
- i386_comment_chars = n;
- }
-#endif
break;
default:
@@ -5525,13 +5497,8 @@
fprintf (stream, _("\
-s ignored\n"));
#endif
-#ifdef SVR4_COMMENT_CHARS
- fprintf (stream, _("\
- --divide do not treat `/' as a comment character\n"));
-#else
fprintf (stream, _("\
--divide ignored\n"));
-#endif
}
#if ((defined (OBJ_MAYBE_COFF) && defined (OBJ_MAYBE_AOUT)) \

View File

@ -1,32 +0,0 @@
diff -u binutils-2.18-orig/configure binutils-2.18/configure
--- binutils-2.18-orig/configure 2007-08-06 16:29:40.000000000 -0400
+++ binutils-2.18/configure 2007-09-27 22:41:51.000000000 -0400
@@ -6125,10 +6125,10 @@
*" texinfo "*) MAKEINFO='$$r/$(BUILD_SUBDIR)/texinfo/makeinfo/makeinfo' ;;
*)
- # For an installed makeinfo, we require it to be from texinfo 4.4 or
+ # For an installed makeinfo, we require it to be from texinfo 4.6 or
# higher, else we use the "missing" dummy.
if ${MAKEINFO} --version \
- | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[4-9]|[5-9])' >/dev/null 2>&1; then
+ | egrep 'texinfo[^0-9]*(4\.([6-9]|[1-9][0-9])|[5-9]|[1-9][0-9])' >/dev/null 2>&1; then
:
else
MAKEINFO="$MISSING makeinfo"
diff -u binutils-2.18-orig/configure.ac binutils-2.18/configure.ac
--- binutils-2.18-orig/configure.ac 2007-08-28 16:24:26.000000000 -0400
+++ binutils-2.18/configure.ac 2007-09-27 22:41:00.000000000 -0400
@@ -2400,10 +2400,10 @@
*" texinfo "*) MAKEINFO='$$r/$(BUILD_SUBDIR)/texinfo/makeinfo/makeinfo' ;;
*)
changequote(,)
- # For an installed makeinfo, we require it to be from texinfo 4.4 or
+ # For an installed makeinfo, we require it to be from texinfo 4.6 or
# higher, else we use the "missing" dummy.
if ${MAKEINFO} --version \
- | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[4-9]|[5-9])' >/dev/null 2>&1; then
+ | egrep 'texinfo[^0-9]*(4\.([6-9]|[1-9][0-9])|[5-9]|[1-9][0-9])' >/dev/null 2>&1; then
:
else
MAKEINFO="$MISSING makeinfo"

View File

@ -1,20 +0,0 @@
Enable using a shell other than bash.
Courtesy "Martin Guy" <martinwguy@yahoo.it>
http://sourceware.org/ml/crossgcc/2008-08/msg00037.html
--- binutils-2.18.orig/ld/genscripts.sh 2007-08-12 20:00:07.000000000 +0100
+++ binutils-2.18/ld/genscripts.sh 2008-08-25 16:09:54.000000000 +0100
@@ -398,9 +398,11 @@
. $em_script
em_script=$current_script
}
- fragment()
+
+ alias fragment='em_lineno=$LINENO; fragment_em'
+ fragment_em()
{
- local lineno=$[${BASH_LINENO[0]} + 1]
+ local lineno=$[$em_lineno + 1]
echo >> e${EMULATION_NAME}.c "#line $lineno \"$em_script\""
cat >> e${EMULATION_NAME}.c
}

View File

@ -1,64 +0,0 @@
diff -durN binutils-2.18.orig/gas/config/tc-i386.c binutils-2.18/gas/config/tc-i386.c
--- binutils-2.18.orig/gas/config/tc-i386.c 2007-08-24 16:01:22.000000000 +0200
+++ binutils-2.18/gas/config/tc-i386.c 2008-09-22 08:11:42.000000000 +0200
@@ -180,24 +180,10 @@
#endif
;
-#if (defined (TE_I386AIX) \
- || ((defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)) \
- && !defined (TE_GNU) \
- && !defined (TE_LINUX) \
- && !defined (TE_NETWARE) \
- && !defined (TE_FreeBSD) \
- && !defined (TE_NetBSD)))
/* This array holds the chars that always start a comment. If the
- pre-processor is disabled, these aren't very useful. The option
- --divide will remove '/' from this list. */
-const char *i386_comment_chars = "#/";
-#define SVR4_COMMENT_CHARS 1
-#define PREFIX_SEPARATOR '\\'
-
-#else
+ pre-processor is disabled, these aren't very useful. */
const char *i386_comment_chars = "#";
#define PREFIX_SEPARATOR '/'
-#endif
/* This array holds the chars that only start a comment at the beginning of
a line. If the line seems to have the form '# 123 filename'
@@ -6061,20 +6047,6 @@
break;
case OPTION_DIVIDE:
-#ifdef SVR4_COMMENT_CHARS
- {
- char *n, *t;
- const char *s;
-
- n = (char *) xmalloc (strlen (i386_comment_chars) + 1);
- t = n;
- for (s = i386_comment_chars; *s != '\0'; s++)
- if (*s != '/')
- *t++ = *s;
- *t = '\0';
- i386_comment_chars = n;
- }
-#endif
break;
case OPTION_MARCH:
@@ -6142,13 +6114,8 @@
fprintf (stream, _("\
--32/--64 generate 32bit/64bit code\n"));
#endif
-#ifdef SVR4_COMMENT_CHARS
- fprintf (stream, _("\
- --divide do not treat `/' as a comment character\n"));
-#else
fprintf (stream, _("\
--divide ignored\n"));
-#endif
fprintf (stream, _("\
-march=CPU/-mtune=CPU generate code/optimize for CPU, where CPU is one of:\n\
i386, i486, pentium, pentiumpro, pentium4, nocona,\n\

View File

@ -1,25 +0,0 @@
Original patch from: ../crosstool-NG/ct-ng.trunk/patches/binutils/2.19/100-ppc64-pie.patch
-= BEGIN original header =-
Original patch from Gentoo:
gentoo/src/patchsets/binutils/2.19/03_all_binutils-2.15.92.0.2-ppc64-pie.patch
-= END original header =-
diff -durN binutils-2.19.1.orig/bfd/elf64-ppc.c binutils-2.19.1/bfd/elf64-ppc.c
--- binutils-2.19.1.orig/bfd/elf64-ppc.c 2008-10-09 14:18:24.000000000 +0200
+++ binutils-2.19.1/bfd/elf64-ppc.c 2009-03-08 11:56:59.000000000 +0100
@@ -11294,7 +11294,12 @@
else if (!SYMBOL_REFERENCES_LOCAL (info, &h->elf)
&& !is_opd
&& r_type != R_PPC64_TOC)
- outrel.r_info = ELF64_R_INFO (h->elf.dynindx, r_type);
+ {
+ outrel.r_info = ELF64_R_INFO (h->elf.dynindx, r_type);
+ if (h->elf.dynindx == -1
+ && h->elf.root.type == bfd_link_hash_undefweak)
+ memset (&outrel, 0, sizeof outrel);
+ }
else
{
/* This symbol is local, or marked to become local,

View File

@ -1,22 +0,0 @@
Original patch from: ../crosstool-NG/ct-ng.trunk/patches/binutils/2.19/110-RPATH_ENVVAR-smack.patch
-= BEGIN original header =-
Original patch from Gentoo:
gentoo/src/patchsets/binutils/2.19/08_all_binutils-RPATH_ENVVAR-smack.patch
http://sourceware.org/ml/binutils/2007-07/msg00401.html
http://sourceware.org/bugzilla/show_bug.cgi?id=4970
-= END original header =-
diff -durN binutils-2.19.1.orig/configure binutils-2.19.1/configure
--- binutils-2.19.1.orig/configure 2008-09-04 04:18:16.000000000 +0200
+++ binutils-2.19.1/configure 2009-03-08 11:57:00.000000000 +0100
@@ -5601,6 +5601,7 @@
*-*-mingw* | *-*-cygwin ) RPATH_ENVVAR=PATH ;;
*) RPATH_ENVVAR=LD_LIBRARY_PATH ;;
esac
+RPATH_ENVVAR="cant_touch_this_nah_nah_nah"
# On systems where the dynamic library environment variable is PATH,
if test "$RPATH_ENVVAR" = PATH; then

View File

@ -1,57 +0,0 @@
Original patch from: ../crosstool-NG/ct-ng.trunk/patches/binutils/2.19/120-sh-targets.patch
-= BEGIN original header =-
Original patch from Gentoo:
gentoo/src/patchsets/binutils/2.19/12_all_sh-targets.patch
r10231 | lethal | 2005-05-02 09:58:00 -0400 (Mon, 02 May 2005) | 13 lines
Likewise, binutils has no idea about any of these new targets either, so we
fix that up too.. now we're able to actually build a real toolchain for
sh2a_nofpu- and other more ineptly named toolchains (and yes, there are more
inept targets than that one, really. Go look, I promise).
-= END original header =-
diff -durN binutils-2.19.1.orig/configure binutils-2.19.1/configure
--- binutils-2.19.1.orig/configure 2009-03-08 11:57:00.000000000 +0100
+++ binutils-2.19.1/configure 2009-03-08 11:57:00.000000000 +0100
@@ -2281,7 +2281,7 @@
am33_2.0-*-linux*)
noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
;;
- sh-*-linux*)
+ sh*-*-linux*)
noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
;;
sh*-*-pe|mips*-*-pe|*arm-wince-pe)
@@ -2606,7 +2606,7 @@
romp-*-*)
noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
;;
- sh-*-* | sh64-*-*)
+ sh*-*-* | sh64-*-*)
case "${host}" in
i[3456789]86-*-vsta) ;; # don't add gprof back in
i[3456789]86-*-go32*) ;; # don't add gprof back in
diff -durN binutils-2.19.1.orig/configure.ac binutils-2.19.1/configure.ac
--- binutils-2.19.1.orig/configure.ac 2009-02-02 12:54:49.000000000 +0100
+++ binutils-2.19.1/configure.ac 2009-03-08 11:57:00.000000000 +0100
@@ -530,7 +530,7 @@
am33_2.0-*-linux*)
noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
;;
- sh-*-linux*)
+ sh*-*-linux*)
noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
;;
sh*-*-pe|mips*-*-pe|*arm-wince-pe)
@@ -855,7 +855,7 @@
romp-*-*)
noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
;;
- sh-*-* | sh64-*-*)
+ sh*-*-* | sh64-*-*)
case "${host}" in
i[[3456789]]86-*-vsta) ;; # don't add gprof back in
i[[3456789]]86-*-go32*) ;; # don't add gprof back in

View File

@ -1,36 +0,0 @@
Original patch from: ../crosstool-NG/ct-ng.trunk/patches/binutils/2.19/130-check_ldrunpath_length.patch
-= BEGIN original header =-
Original patch from Gentoo:
gentoo/src/patchsets/binutils/2.19/42_all_012_check_ldrunpath_length.patch
Originaly from Debian:
## 012_check_ldrunpath_length.dpatch by Chris Chimelis <chris@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Only generate an RPATH entry if LD_RUN_PATH is not empty, for
## DP: cases where -rpath isn't specified. (#151024)
-= END original header =-
diff -durN binutils-2.19.1.orig/ld/emultempl/elf32.em binutils-2.19.1/ld/emultempl/elf32.em
--- binutils-2.19.1.orig/ld/emultempl/elf32.em 2008-09-07 06:02:31.000000000 +0200
+++ binutils-2.19.1/ld/emultempl/elf32.em 2009-03-08 11:57:01.000000000 +0100
@@ -1219,6 +1219,8 @@
&& command_line.rpath == NULL)
{
lib_path = (const char *) getenv ("LD_RUN_PATH");
+ if ((lib_path) && (strlen (lib_path) == 0))
+ lib_path = NULL;
if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
force))
break;
@@ -1404,6 +1406,8 @@
rpath = command_line.rpath;
if (rpath == NULL)
rpath = (const char *) getenv ("LD_RUN_PATH");
+ if ((rpath) && (strlen (rpath) == 0))
+ rpath = NULL;
if (! (bfd_elf_size_dynamic_sections
(link_info.output_bfd, command_line.soname, rpath,
command_line.filter_shlib,

View File

@ -1,254 +0,0 @@
Original patch from: ../crosstool-NG/ct-ng.trunk/patches/binutils/2.19/140-pt-pax-flags-20081101.patch
-= BEGIN original header =-
Original patch from Gentoo:
gentoo/src/patchsets/binutils/2.19/63_all_binutils-2.19-pt-pax-flags-20081101.patch
-= END original header =-
diff -durN binutils-2.19.1.orig/bfd/elf-bfd.h binutils-2.19.1/bfd/elf-bfd.h
--- binutils-2.19.1.orig/bfd/elf-bfd.h 2008-08-21 01:28:58.000000000 +0200
+++ binutils-2.19.1/bfd/elf-bfd.h 2009-03-08 11:57:02.000000000 +0100
@@ -1526,6 +1526,9 @@
/* Segment flags for the PT_GNU_STACK segment. */
unsigned int stack_flags;
+ /* Segment flags for the PT_PAX_FLAGS segment. */
+ unsigned int pax_flags;
+
/* Symbol version definitions in external objects. */
Elf_Internal_Verdef *verdef;
diff -durN binutils-2.19.1.orig/bfd/elf.c binutils-2.19.1/bfd/elf.c
--- binutils-2.19.1.orig/bfd/elf.c 2008-12-23 14:54:48.000000000 +0100
+++ binutils-2.19.1/bfd/elf.c 2009-03-08 11:57:02.000000000 +0100
@@ -1136,6 +1136,7 @@
case PT_GNU_EH_FRAME: pt = "EH_FRAME"; break;
case PT_GNU_STACK: pt = "STACK"; break;
case PT_GNU_RELRO: pt = "RELRO"; break;
+ case PT_PAX_FLAGS: pt = "PAX_FLAGS"; break;
default: pt = NULL; break;
}
return pt;
@@ -2442,6 +2443,9 @@
case PT_GNU_RELRO:
return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "relro");
+ case PT_PAX_FLAGS:
+ return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "pax_flags");
+
default:
/* Check for any processor-specific program segment types. */
bed = get_elf_backend_data (abfd);
@@ -3404,6 +3408,11 @@
++segs;
}
+ {
+ /* We need a PT_PAX_FLAGS segment. */
+ ++segs;
+ }
+
for (s = abfd->sections; s != NULL; s = s->next)
{
if ((s->flags & SEC_LOAD) != 0
@@ -3983,6 +3992,20 @@
}
}
+ {
+ amt = sizeof (struct elf_segment_map);
+ m = bfd_zalloc (abfd, amt);
+ if (m == NULL)
+ goto error_return;
+ m->next = NULL;
+ m->p_type = PT_PAX_FLAGS;
+ m->p_flags = elf_tdata (abfd)->pax_flags;
+ m->p_flags_valid = 1;
+
+ *pm = m;
+ pm = &m->next;
+ }
+
free (sections);
elf_tdata (abfd)->segment_map = mfirst;
}
@@ -5160,7 +5183,8 @@
6. PT_TLS segment includes only SHF_TLS sections.
7. SHF_TLS sections are only in PT_TLS or PT_LOAD segments.
8. PT_DYNAMIC should not contain empty sections at the beginning
- (with the possible exception of .dynamic). */
+ (with the possible exception of .dynamic).
+ 9. PT_PAX_FLAGS segments does not include any sections. */
#define IS_SECTION_IN_INPUT_SEGMENT(section, segment, bed) \
((((segment->p_paddr \
? IS_CONTAINED_BY_LMA (section, segment, segment->p_paddr) \
@@ -5168,6 +5192,7 @@
&& (section->flags & SEC_ALLOC) != 0) \
|| IS_NOTE (segment, section)) \
&& segment->p_type != PT_GNU_STACK \
+ && segment->p_type != PT_PAX_FLAGS \
&& (segment->p_type != PT_TLS \
|| (section->flags & SEC_THREAD_LOCAL)) \
&& (segment->p_type == PT_LOAD \
diff -durN binutils-2.19.1.orig/bfd/elflink.c binutils-2.19.1/bfd/elflink.c
--- binutils-2.19.1.orig/bfd/elflink.c 2008-08-22 10:32:39.000000000 +0200
+++ binutils-2.19.1/bfd/elflink.c 2009-03-08 11:57:02.000000000 +0100
@@ -5397,16 +5397,30 @@
return TRUE;
bed = get_elf_backend_data (output_bfd);
+ elf_tdata (output_bfd)->pax_flags = PF_NORANDEXEC;
+
+ if (info->execheap)
+ elf_tdata (output_bfd)->pax_flags |= PF_NOMPROTECT;
+ else if (info->noexecheap)
+ elf_tdata (output_bfd)->pax_flags |= PF_MPROTECT;
+
if (info->execstack)
- elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
+ {
+ elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
+ elf_tdata (output_bfd)->pax_flags |= PF_EMUTRAMP;
+ }
else if (info->noexecstack)
- elf_tdata (output_bfd)->stack_flags = PF_R | PF_W;
+ {
+ elf_tdata (output_bfd)->stack_flags = PF_R | PF_W;
+ elf_tdata (output_bfd)->pax_flags |= PF_NOEMUTRAMP;
+ }
else
{
bfd *inputobj;
asection *notesec = NULL;
int exec = 0;
+ elf_tdata (output_bfd)->pax_flags |= PF_NOEMUTRAMP;
for (inputobj = info->input_bfds;
inputobj;
inputobj = inputobj->link_next)
@@ -5419,7 +5433,11 @@
if (s)
{
if (s->flags & SEC_CODE)
- exec = PF_X;
+ {
+ elf_tdata (output_bfd)->pax_flags &= ~PF_NOEMUTRAMP;
+ elf_tdata (output_bfd)->pax_flags |= PF_EMUTRAMP;
+ exec = PF_X;
+ }
notesec = s;
}
else if (bed->default_execstack)
diff -durN binutils-2.19.1.orig/binutils/readelf.c binutils-2.19.1/binutils/readelf.c
--- binutils-2.19.1.orig/binutils/readelf.c 2008-09-17 11:00:44.000000000 +0200
+++ binutils-2.19.1/binutils/readelf.c 2009-03-08 11:57:02.000000000 +0100
@@ -2505,6 +2505,7 @@
return "GNU_EH_FRAME";
case PT_GNU_STACK: return "GNU_STACK";
case PT_GNU_RELRO: return "GNU_RELRO";
+ case PT_PAX_FLAGS: return "PAX_FLAGS";
default:
if ((p_type >= PT_LOPROC) && (p_type <= PT_HIPROC))
diff -durN binutils-2.19.1.orig/include/bfdlink.h binutils-2.19.1/include/bfdlink.h
--- binutils-2.19.1.orig/include/bfdlink.h 2008-08-17 05:12:50.000000000 +0200
+++ binutils-2.19.1/include/bfdlink.h 2009-03-08 11:57:02.000000000 +0100
@@ -319,6 +319,14 @@
/* TRUE if PT_GNU_RELRO segment should be created. */
unsigned int relro: 1;
+ /* TRUE if PT_PAX_FLAGS segment should be created with PF_NOMPROTECT
+ flags. */
+ unsigned int execheap: 1;
+
+ /* TRUE if PT_PAX_FLAGS segment should be created with PF_MPROTECT
+ flags. */
+ unsigned int noexecheap: 1;
+
/* TRUE if we should warn when adding a DT_TEXTREL to a shared object. */
unsigned int warn_shared_textrel: 1;
diff -durN binutils-2.19.1.orig/include/elf/common.h binutils-2.19.1/include/elf/common.h
--- binutils-2.19.1.orig/include/elf/common.h 2008-08-04 01:20:42.000000000 +0200
+++ binutils-2.19.1/include/elf/common.h 2009-03-08 11:57:02.000000000 +0100
@@ -360,6 +360,7 @@
#define PT_SUNW_EH_FRAME PT_GNU_EH_FRAME /* Solaris uses the same value */
#define PT_GNU_STACK (PT_LOOS + 0x474e551) /* Stack flags */
#define PT_GNU_RELRO (PT_LOOS + 0x474e552) /* Read-only after relocation */
+#define PT_PAX_FLAGS (PT_LOOS + 0x5041580) /* PaX flags */
/* Program segment permissions, in program header p_flags field. */
@@ -370,6 +371,21 @@
#define PF_MASKOS 0x0FF00000 /* New value, Oct 4, 1999 Draft */
#define PF_MASKPROC 0xF0000000 /* Processor-specific reserved bits */
+/* Flags to control PaX behavior. */
+
+#define PF_PAGEEXEC (1 << 4) /* Enable PAGEEXEC */
+#define PF_NOPAGEEXEC (1 << 5) /* Disable PAGEEXEC */
+#define PF_SEGMEXEC (1 << 6) /* Enable SEGMEXEC */
+#define PF_NOSEGMEXEC (1 << 7) /* Disable SEGMEXEC */
+#define PF_MPROTECT (1 << 8) /* Enable MPROTECT */
+#define PF_NOMPROTECT (1 << 9) /* Disable MPROTECT */
+#define PF_RANDEXEC (1 << 10) /* Enable RANDEXEC */
+#define PF_NORANDEXEC (1 << 11) /* Disable RANDEXEC */
+#define PF_EMUTRAMP (1 << 12) /* Enable EMUTRAMP */
+#define PF_NOEMUTRAMP (1 << 13) /* Disable EMUTRAMP */
+#define PF_RANDMMAP (1 << 14) /* Enable RANDMMAP */
+#define PF_NORANDMMAP (1 << 15) /* Disable RANDMMAP */
+
/* Values for section header, sh_type field. */
#define SHT_NULL 0 /* Section header table entry unused */
diff -durN binutils-2.19.1.orig/ld/emultempl/elf32.em binutils-2.19.1/ld/emultempl/elf32.em
--- binutils-2.19.1.orig/ld/emultempl/elf32.em 2009-03-08 11:57:01.000000000 +0100
+++ binutils-2.19.1/ld/emultempl/elf32.em 2009-03-08 11:57:02.000000000 +0100
@@ -2146,6 +2146,16 @@
link_info.noexecstack = TRUE;
link_info.execstack = FALSE;
}
+ else if (strcmp (optarg, "execheap") == 0)
+ {
+ link_info.execheap = TRUE;
+ link_info.noexecheap = FALSE;
+ }
+ else if (strcmp (optarg, "noexecheap") == 0)
+ {
+ link_info.noexecheap = TRUE;
+ link_info.execheap = FALSE;
+ }
EOF
if test -n "$COMMONPAGESIZE"; then
@@ -2229,6 +2239,8 @@
fprintf (file, _("\
-z execstack Mark executable as requiring executable stack\n"));
fprintf (file, _("\
+ -z execheap\t\tMark executable as requiring executable heap\n"));
+ fprintf (file, _("\
-z initfirst Mark DSO to be initialized first at runtime\n"));
fprintf (file, _("\
-z interpose Mark object to interpose all DSOs but executable\n"));
@@ -2252,6 +2264,8 @@
-z nodump Mark DSO not available to dldump\n"));
fprintf (file, _("\
-z noexecstack Mark executable as not requiring executable stack\n"));
+ fprintf (file, _("\
+ -z noexecheap\tMark executable as not requiring executable heap\n"));
EOF
if test -n "$COMMONPAGESIZE"; then
diff -durN binutils-2.19.1.orig/ld/ldgram.y binutils-2.19.1/ld/ldgram.y
--- binutils-2.19.1.orig/ld/ldgram.y 2008-07-06 15:38:36.000000000 +0200
+++ binutils-2.19.1/ld/ldgram.y 2009-03-08 11:57:02.000000000 +0100
@@ -1112,6 +1112,8 @@
$$ = exp_intop (0x6474e550);
else if (strcmp (s, "PT_GNU_STACK") == 0)
$$ = exp_intop (0x6474e551);
+ else if (strcmp (s, "PT_PAX_FLAGS") == 0)
+ $$ = exp_intop (0x65041580);
else
{
einfo (_("\

View File

@ -1,53 +0,0 @@
Original patch from: ../crosstool-NG/ct-ng.trunk/patches/binutils/2.19/150-warn-textrel.patch
-= BEGIN original header =-
Original patch from Gentoo:
gentoo/src/patchsets/binutils/2.19/66_all_binutils-2.18.50.0.2-warn-textrel.patch
textrels are bad for forcing copy-on-write (this affects everyone),
and for security/runtime code generation, this affects security ppl.
But in either case, it doesn't matter who needs textrels, it's
the very fact that they're needed at all.
-= END original header =-
diff -durN binutils-2.19.1.orig/bfd/elflink.c binutils-2.19.1/bfd/elflink.c
--- binutils-2.19.1.orig/bfd/elflink.c 2009-03-08 11:57:02.000000000 +0100
+++ binutils-2.19.1/bfd/elflink.c 2009-03-08 11:57:02.000000000 +0100
@@ -10820,14 +10820,12 @@
goto error_return;
/* Check for DT_TEXTREL (late, in case the backend removes it). */
- if (info->warn_shared_textrel && info->shared)
+ o = bfd_get_section_by_name (dynobj, ".dynamic");
+ if (info->warn_shared_textrel && o != NULL)
{
bfd_byte *dyncon, *dynconend;
/* Fix up .dynamic entries. */
- o = bfd_get_section_by_name (dynobj, ".dynamic");
- BFD_ASSERT (o != NULL);
-
dyncon = o->contents;
dynconend = o->contents + o->size;
for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn)
@@ -10839,7 +10837,7 @@
if (dyn.d_tag == DT_TEXTREL)
{
info->callbacks->einfo
- (_("%P: warning: creating a DT_TEXTREL in a shared object.\n"));
+ (_("%P: warning: creating a DT_TEXTREL in object.\n"));
break;
}
}
diff -durN binutils-2.19.1.orig/ld/ldmain.c binutils-2.19.1/ld/ldmain.c
--- binutils-2.19.1.orig/ld/ldmain.c 2008-08-17 05:12:50.000000000 +0200
+++ binutils-2.19.1/ld/ldmain.c 2009-03-08 11:57:02.000000000 +0100
@@ -274,6 +274,7 @@
link_info.relax_pass = 1;
link_info.pei386_auto_import = -1;
link_info.spare_dynamic_tags = 5;
+ link_info.warn_shared_textrel = TRUE;
link_info.path_separator = ':';
ldfile_add_arch ("");

View File

@ -1,19 +0,0 @@
Original patch from: ../crosstool-NG/ct-ng.trunk/patches/binutils/2.19/160-use-new-ld-dtags.patch
-= BEGIN original header =-
Original patch from Gentoo:
gentoo/src/patchsets/binutils/2.19/76_all_use-new-ld-dtags.patch
-= END original header =-
diff -durN binutils-2.19.1.orig/ld/ldmain.c binutils-2.19.1/ld/ldmain.c
--- binutils-2.19.1.orig/ld/ldmain.c 2009-03-08 11:57:03.000000000 +0100
+++ binutils-2.19.1/ld/ldmain.c 2009-03-08 11:57:03.000000000 +0100
@@ -262,6 +262,7 @@
link_info.allow_undefined_version = TRUE;
link_info.keep_memory = TRUE;
+ link_info.new_dtags = TRUE;
link_info.combreloc = TRUE;
link_info.strip_discarded = TRUE;
link_info.emit_hash = TRUE;

View File

@ -1,19 +0,0 @@
Original patch from: ../crosstool-NG/ct-ng.trunk/patches/binutils/2.19/170-use-relro.patch
-= BEGIN original header =-
Original patch from Gentoo:
gentoo/src/patchsets/binutils/2.19/78_all_use-relro.patch
-= END original header =-
diff -durN binutils-2.19.1.orig/ld/ldmain.c binutils-2.19.1/ld/ldmain.c
--- binutils-2.19.1.orig/ld/ldmain.c 2009-03-08 11:57:03.000000000 +0100
+++ binutils-2.19.1/ld/ldmain.c 2009-03-08 11:57:03.000000000 +0100
@@ -264,6 +264,7 @@
link_info.keep_memory = TRUE;
link_info.new_dtags = TRUE;
link_info.combreloc = TRUE;
+ link_info.relro = TRUE;
link_info.strip_discarded = TRUE;
link_info.emit_hash = TRUE;
link_info.callbacks = &link_callbacks;

View File

@ -1,19 +0,0 @@
Original patch from: ../crosstool-NG/ct-ng.trunk/patches/binutils/2.19/180-libiberty-pic.patch
-= BEGIN original header =-
Original patch from Gentoo:
gentoo/src/patchsets/binutils/2.19/91_all_libiberty-pic.patch
-= END original header =-
diff -durN binutils-2.19.1.orig/libiberty/Makefile.in binutils-2.19.1/libiberty/Makefile.in
--- binutils-2.19.1.orig/libiberty/Makefile.in 2008-07-24 15:51:49.000000000 +0200
+++ binutils-2.19.1/libiberty/Makefile.in 2009-03-08 11:57:03.000000000 +0100
@@ -227,6 +227,7 @@
$(AR) $(AR_FLAGS) $(TARGETLIB) \
$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
$(RANLIB) $(TARGETLIB); \
+ cp $(TARGETLIB) ../ ; \
cd ..; \
else true; fi

View File

@ -1,18 +0,0 @@
--- binutils-2.20/ld/configure.tgt.orig 2010-02-20 04:05:31.000000000 -0500
+++ binutils-2.20/ld/configure.tgt 2010-02-20 04:08:11.000000000 -0500
@@ -400,11 +400,11 @@
mips*-*-vxworks*) targ_emul=elf32ebmipvxworks
targ_extra_emuls="elf32elmipvxworks" ;;
mips*-*-windiss) targ_emul=elf32mipswindiss ;;
-mips64*el-*-linux-*) targ_emul=elf32ltsmipn32
- targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip"
+mips64*el-*-linux-*) targ_emul=elf64ltsmip
+ targ_extra_emuls="elf32ltsmipn32 elf32btsmipn32 elf32ltsmip elf32btsmip elf64btsmip"
targ_extra_libpath=$targ_extra_emuls ;;
-mips64*-*-linux-*) targ_emul=elf32btsmipn32
- targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip"
+mips64*-*-linux-*) targ_emul=elf64btsmip
+ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32btsmip elf32ltsmip elf64ltsmip"
targ_extra_libpath=$targ_extra_emuls ;;
mips*el-*-linux-*) targ_emul=elf32ltsmip
targ_extra_emuls="elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip"

View File

@ -1,19 +0,0 @@
diff -durN binutils-2.20.1.orig/bfd/elf64-ppc.c binutils-2.20.1/bfd/elf64-ppc.c
--- binutils-2.20.1.orig/bfd/elf64-ppc.c 2010-02-03 14:28:25.000000000 +0100
+++ binutils-2.20.1/bfd/elf64-ppc.c 2010-08-17 19:32:04.000000000 +0200
@@ -11991,7 +11991,12 @@
else if (!SYMBOL_REFERENCES_LOCAL (info, &h->elf)
&& !is_opd
&& r_type != R_PPC64_TOC)
- outrel.r_info = ELF64_R_INFO (h->elf.dynindx, r_type);
+ {
+ outrel.r_info = ELF64_R_INFO (h->elf.dynindx, r_type);
+ if (h->elf.dynindx == -1
+ && h->elf.root.type == bfd_link_hash_undefweak)
+ memset (&outrel, 0, sizeof outrel);
+ }
else
{
/* This symbol is local, or marked to become local,

View File

@ -1,14 +0,0 @@
http://sourceware.org/ml/binutils/2007-07/msg00401.html
http://sourceware.org/bugzilla/show_bug.cgi?id=4970
diff -durN binutils-2.20.1.orig/configure binutils-2.20.1/configure
--- binutils-2.20.1.orig/configure 2010-03-03 14:59:02.000000000 +0100
+++ binutils-2.20.1/configure 2010-08-17 19:32:05.000000000 +0200
@@ -6466,6 +6466,7 @@
*-*-mingw* | *-*-cygwin ) RPATH_ENVVAR=PATH ;;
*) RPATH_ENVVAR=LD_LIBRARY_PATH ;;
esac
+RPATH_ENVVAR="cant_touch_this_nah_nah_nah"
# On systems where the dynamic library environment variable is PATH,
# gcc/ will put dynamic libraries into a subdirectory to avoid adding

View File

@ -1,44 +0,0 @@
diff -durN binutils-2.20.1.orig/configure binutils-2.20.1/configure
--- binutils-2.20.1.orig/configure 2010-08-17 19:32:05.000000000 +0200
+++ binutils-2.20.1/configure 2010-08-17 19:32:07.000000000 +0200
@@ -3054,7 +3054,7 @@
am33_2.0-*-linux*)
noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
;;
- sh-*-linux*)
+ sh*-*-linux*)
noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
;;
sh*-*-pe|mips*-*-pe|*arm-wince-pe)
@@ -3390,7 +3390,7 @@
romp-*-*)
noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
;;
- sh-*-* | sh64-*-*)
+ sh*-*-* | sh64-*-*)
case "${host}" in
i[3456789]86-*-vsta) ;; # don't add gprof back in
i[3456789]86-*-go32*) ;; # don't add gprof back in
diff -durN binutils-2.20.1.orig/configure.ac binutils-2.20.1/configure.ac
--- binutils-2.20.1.orig/configure.ac 2010-03-03 15:19:08.000000000 +0100
+++ binutils-2.20.1/configure.ac 2010-08-17 19:32:07.000000000 +0200
@@ -541,7 +541,7 @@
am33_2.0-*-linux*)
noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
;;
- sh-*-linux*)
+ sh*-*-linux*)
noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
;;
sh*-*-pe|mips*-*-pe|*arm-wince-pe)
@@ -877,7 +877,7 @@
romp-*-*)
noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
;;
- sh-*-* | sh64-*-*)
+ sh*-*-* | sh64-*-*)
case "${host}" in
i[[3456789]]86-*-vsta) ;; # don't add gprof back in
i[[3456789]]86-*-go32*) ;; # don't add gprof back in

View File

@ -1,37 +0,0 @@
Signed-off-by: Sven Rebhan <odinshorse@googlemail.com>
Always try to prepend the sysroot prefix to absolute filenames first.
http://bugs.gentoo.org/275666
http://sourceware.org/bugzilla/show_bug.cgi?id=10340
diff -durN binutils-2.20.1.orig/ld/ldfile.c binutils-2.20.1/ld/ldfile.c
--- binutils-2.20.1.orig/ld/ldfile.c 2009-08-30 00:11:01.000000000 +0200
+++ binutils-2.20.1/ld/ldfile.c 2010-08-17 19:32:08.000000000 +0200
@@ -308,18 +308,24 @@
directory first. */
if (! entry->is_archive)
{
- if (entry->sysrooted && IS_ABSOLUTE_PATH (entry->filename))
+ /* For absolute pathnames, try to always open the file in the
+ sysroot first. If this fails, try to open the file at the
+ given location. */
+ entry->sysrooted = is_sysrooted_pathname(entry->filename, FALSE);
+ if (IS_ABSOLUTE_PATH (entry->filename) && ld_sysroot && ! entry->sysrooted)
{
char *name = concat (ld_sysroot, entry->filename,
(const char *) NULL);
if (ldfile_try_open_bfd (name, entry))
{
entry->filename = name;
+ entry->sysrooted = TRUE;
return TRUE;
}
free (name);
}
- else if (ldfile_try_open_bfd (entry->filename, entry))
+
+ if (ldfile_try_open_bfd (entry->filename, entry))
{
entry->sysrooted = IS_ABSOLUTE_PATH (entry->filename)
&& is_sysrooted_pathname (entry->filename, TRUE);

View File

@ -1,49 +0,0 @@
#!/bin/sh -e
## 012_check_ldrunpath_length.dpatch by Chris Chimelis <chris@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Only generate an RPATH entry if LD_RUN_PATH is not empty, for
## DP: cases where -rpath isn't specified. (#151024)
if [ $# -ne 1 ]; then
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
fi
[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
case "$1" in
-patch) patch $patch_opts -p1 < $0;;
-unpatch) patch $patch_opts -p1 -R < $0;;
*)
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1;;
esac
exit 0
@DPATCH@
diff -urNad /home/james/debian/packages/binutils/new/binutils-2.15/ld/emultempl/elf32.em binutils-2.15/ld/emultempl/elf32.em
diff -durN binutils-2.20.1.orig/ld/emultempl/elf32.em binutils-2.20.1/ld/emultempl/elf32.em
--- binutils-2.20.1.orig/ld/emultempl/elf32.em 2009-09-14 13:43:30.000000000 +0200
+++ binutils-2.20.1/ld/emultempl/elf32.em 2010-08-17 19:32:09.000000000 +0200
@@ -1233,6 +1233,8 @@
&& command_line.rpath == NULL)
{
lib_path = (const char *) getenv ("LD_RUN_PATH");
+ if ((lib_path) && (strlen (lib_path) == 0))
+ lib_path = NULL;
if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
force))
break;
@@ -1418,6 +1420,8 @@
rpath = command_line.rpath;
if (rpath == NULL)
rpath = (const char *) getenv ("LD_RUN_PATH");
+ if ((rpath) && (strlen (rpath) == 0))
+ rpath = NULL;
if (! (bfd_elf_size_dynamic_sections
(link_info.output_bfd, command_line.soname, rpath,
command_line.filter_shlib,

View File

@ -1,248 +0,0 @@
diff -durN binutils-2.20.1.orig/bfd/elf-bfd.h binutils-2.20.1/bfd/elf-bfd.h
--- binutils-2.20.1.orig/bfd/elf-bfd.h 2009-09-10 13:47:12.000000000 +0200
+++ binutils-2.20.1/bfd/elf-bfd.h 2010-08-17 19:32:11.000000000 +0200
@@ -1531,6 +1531,9 @@
/* Segment flags for the PT_GNU_STACK segment. */
unsigned int stack_flags;
+ /* Segment flags for the PT_PAX_FLAGS segment. */
+ unsigned int pax_flags;
+
/* Symbol version definitions in external objects. */
Elf_Internal_Verdef *verdef;
diff -durN binutils-2.20.1.orig/bfd/elf.c binutils-2.20.1/bfd/elf.c
--- binutils-2.20.1.orig/bfd/elf.c 2009-09-10 13:47:12.000000000 +0200
+++ binutils-2.20.1/bfd/elf.c 2010-08-17 19:32:11.000000000 +0200
@@ -1083,6 +1083,7 @@
case PT_GNU_EH_FRAME: pt = "EH_FRAME"; break;
case PT_GNU_STACK: pt = "STACK"; break;
case PT_GNU_RELRO: pt = "RELRO"; break;
+ case PT_PAX_FLAGS: pt = "PAX_FLAGS"; break;
default: pt = NULL; break;
}
return pt;
@@ -2396,6 +2397,9 @@
case PT_GNU_RELRO:
return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "relro");
+ case PT_PAX_FLAGS:
+ return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "pax_flags");
+
default:
/* Check for any processor-specific program segment types. */
bed = get_elf_backend_data (abfd);
@@ -3413,6 +3417,11 @@
++segs;
}
+ {
+ /* We need a PT_PAX_FLAGS segment. */
+ ++segs;
+ }
+
for (s = abfd->sections; s != NULL; s = s->next)
{
if ((s->flags & SEC_LOAD) != 0
@@ -3994,6 +4003,20 @@
}
}
+ {
+ amt = sizeof (struct elf_segment_map);
+ m = bfd_zalloc (abfd, amt);
+ if (m == NULL)
+ goto error_return;
+ m->next = NULL;
+ m->p_type = PT_PAX_FLAGS;
+ m->p_flags = elf_tdata (abfd)->pax_flags;
+ m->p_flags_valid = 1;
+
+ *pm = m;
+ pm = &m->next;
+ }
+
free (sections);
elf_tdata (abfd)->segment_map = mfirst;
}
@@ -5198,7 +5221,8 @@
6. PT_TLS segment includes only SHF_TLS sections.
7. SHF_TLS sections are only in PT_TLS or PT_LOAD segments.
8. PT_DYNAMIC should not contain empty sections at the beginning
- (with the possible exception of .dynamic). */
+ (with the possible exception of .dynamic).
+ 9. PT_PAX_FLAGS segments do not include any sections. */
#define IS_SECTION_IN_INPUT_SEGMENT(section, segment, bed) \
((((segment->p_paddr \
? IS_CONTAINED_BY_LMA (section, segment, segment->p_paddr) \
@@ -5206,6 +5230,7 @@
&& (section->flags & SEC_ALLOC) != 0) \
|| IS_NOTE (segment, section)) \
&& segment->p_type != PT_GNU_STACK \
+ && segment->p_type != PT_PAX_FLAGS \
&& (segment->p_type != PT_TLS \
|| (section->flags & SEC_THREAD_LOCAL)) \
&& (segment->p_type == PT_LOAD \
diff -durN binutils-2.20.1.orig/bfd/elflink.c binutils-2.20.1/bfd/elflink.c
--- binutils-2.20.1.orig/bfd/elflink.c 2009-09-10 13:47:12.000000000 +0200
+++ binutils-2.20.1/bfd/elflink.c 2010-08-17 19:32:11.000000000 +0200
@@ -5469,16 +5469,30 @@
return TRUE;
bed = get_elf_backend_data (output_bfd);
+
+ elf_tdata (output_bfd)->pax_flags = PF_NORANDEXEC;
+ if (info->execheap)
+ elf_tdata (output_bfd)->pax_flags |= PF_NOMPROTECT;
+ else if (info->noexecheap)
+ elf_tdata (output_bfd)->pax_flags |= PF_MPROTECT;
+
if (info->execstack)
- elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
+ {
+ elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
+ elf_tdata (output_bfd)->pax_flags |= PF_EMUTRAMP;
+ }
else if (info->noexecstack)
- elf_tdata (output_bfd)->stack_flags = PF_R | PF_W;
+ {
+ elf_tdata (output_bfd)->stack_flags = PF_R | PF_W;
+ elf_tdata (output_bfd)->pax_flags |= PF_NOEMUTRAMP;
+ }
else
{
bfd *inputobj;
asection *notesec = NULL;
int exec = 0;
+ elf_tdata (output_bfd)->pax_flags |= PF_NOEMUTRAMP;
for (inputobj = info->input_bfds;
inputobj;
inputobj = inputobj->link_next)
@@ -5491,7 +5505,11 @@
if (s)
{
if (s->flags & SEC_CODE)
- exec = PF_X;
+ {
+ elf_tdata (output_bfd)->pax_flags &= ~PF_NOEMUTRAMP;
+ elf_tdata (output_bfd)->pax_flags |= PF_EMUTRAMP;
+ exec = PF_X;
+ }
notesec = s;
}
else if (bed->default_execstack)
diff -durN binutils-2.20.1.orig/binutils/readelf.c binutils-2.20.1/binutils/readelf.c
--- binutils-2.20.1.orig/binutils/readelf.c 2010-01-14 11:48:23.000000000 +0100
+++ binutils-2.20.1/binutils/readelf.c 2010-08-17 19:32:11.000000000 +0200
@@ -2569,6 +2569,7 @@
return "GNU_EH_FRAME";
case PT_GNU_STACK: return "GNU_STACK";
case PT_GNU_RELRO: return "GNU_RELRO";
+ case PT_PAX_FLAGS: return "PAX_FLAGS";
default:
if ((p_type >= PT_LOPROC) && (p_type <= PT_HIPROC))
diff -durN binutils-2.20.1.orig/include/bfdlink.h binutils-2.20.1/include/bfdlink.h
--- binutils-2.20.1.orig/include/bfdlink.h 2009-09-10 13:47:30.000000000 +0200
+++ binutils-2.20.1/include/bfdlink.h 2010-08-17 19:32:11.000000000 +0200
@@ -321,6 +321,14 @@
/* TRUE if PT_GNU_RELRO segment should be created. */
unsigned int relro: 1;
+ /* TRUE if PT_PAX_FLAGS segment should be created with PF_NOMPROTECT
+ flags. */
+ unsigned int execheap: 1;
+
+ /* TRUE if PT_PAX_FLAGS segment should be created with PF_MPROTECT
+ flags. */
+ unsigned int noexecheap: 1;
+
/* TRUE if we should warn when adding a DT_TEXTREL to a shared object. */
unsigned int warn_shared_textrel: 1;
diff -durN binutils-2.20.1.orig/include/elf/common.h binutils-2.20.1/include/elf/common.h
--- binutils-2.20.1.orig/include/elf/common.h 2009-08-09 15:42:26.000000000 +0200
+++ binutils-2.20.1/include/elf/common.h 2010-08-17 19:32:11.000000000 +0200
@@ -422,6 +422,7 @@
#define PT_SUNW_EH_FRAME PT_GNU_EH_FRAME /* Solaris uses the same value */
#define PT_GNU_STACK (PT_LOOS + 0x474e551) /* Stack flags */
#define PT_GNU_RELRO (PT_LOOS + 0x474e552) /* Read-only after relocation */
+#define PT_PAX_FLAGS (PT_LOOS + 0x5041580) /* PaX flags */
/* Program segment permissions, in program header p_flags field. */
@@ -432,6 +433,21 @@
#define PF_MASKOS 0x0FF00000 /* New value, Oct 4, 1999 Draft */
#define PF_MASKPROC 0xF0000000 /* Processor-specific reserved bits */
+/* Flags to control PaX behavior. */
+
+#define PF_PAGEEXEC (1 << 4) /* Enable PAGEEXEC */
+#define PF_NOPAGEEXEC (1 << 5) /* Disable PAGEEXEC */
+#define PF_SEGMEXEC (1 << 6) /* Enable SEGMEXEC */
+#define PF_NOSEGMEXEC (1 << 7) /* Disable SEGMEXEC */
+#define PF_MPROTECT (1 << 8) /* Enable MPROTECT */
+#define PF_NOMPROTECT (1 << 9) /* Disable MPROTECT */
+#define PF_RANDEXEC (1 << 10) /* Enable RANDEXEC */
+#define PF_NORANDEXEC (1 << 11) /* Disable RANDEXEC */
+#define PF_EMUTRAMP (1 << 12) /* Enable EMUTRAMP */
+#define PF_NOEMUTRAMP (1 << 13) /* Disable EMUTRAMP */
+#define PF_RANDMMAP (1 << 14) /* Enable RANDMMAP */
+#define PF_NORANDMMAP (1 << 15) /* Disable RANDMMAP */
+
/* Values for section header, sh_type field. */
#define SHT_NULL 0 /* Section header table entry unused */
diff -durN binutils-2.20.1.orig/ld/emultempl/elf32.em binutils-2.20.1/ld/emultempl/elf32.em
--- binutils-2.20.1.orig/ld/emultempl/elf32.em 2010-08-17 19:32:09.000000000 +0200
+++ binutils-2.20.1/ld/emultempl/elf32.em 2010-08-17 19:32:11.000000000 +0200
@@ -2165,6 +2165,16 @@
link_info.noexecstack = TRUE;
link_info.execstack = FALSE;
}
+ else if (strcmp (optarg, "execheap") == 0)
+ {
+ link_info.execheap = TRUE;
+ link_info.noexecheap = FALSE;
+ }
+ else if (strcmp (optarg, "noexecheap") == 0)
+ {
+ link_info.noexecheap = TRUE;
+ link_info.execheap = FALSE;
+ }
EOF
if test -n "$COMMONPAGESIZE"; then
@@ -2243,6 +2253,8 @@
fprintf (file, _("\
-z execstack Mark executable as requiring executable stack\n"));
fprintf (file, _("\
+ -z execheap Mark executable as requiring executable heap\n"));
+ fprintf (file, _("\
-z initfirst Mark DSO to be initialized first at runtime\n"));
fprintf (file, _("\
-z interpose Mark object to interpose all DSOs but executable\n"));
@@ -2266,6 +2278,8 @@
-z nodump Mark DSO not available to dldump\n"));
fprintf (file, _("\
-z noexecstack Mark executable as not requiring executable stack\n"));
+ fprintf (file, _("\
+ -z noexecheap Mark executable as not requiring executable heap\n"));
EOF
if test -n "$COMMONPAGESIZE"; then
diff -durN binutils-2.20.1.orig/ld/ldgram.y binutils-2.20.1/ld/ldgram.y
--- binutils-2.20.1.orig/ld/ldgram.y 2009-09-02 09:25:35.000000000 +0200
+++ binutils-2.20.1/ld/ldgram.y 2010-08-17 19:32:11.000000000 +0200
@@ -1116,6 +1116,8 @@
$$ = exp_intop (0x6474e550);
else if (strcmp (s, "PT_GNU_STACK") == 0)
$$ = exp_intop (0x6474e551);
+ else if (strcmp (s, "PT_PAX_FLAGS") == 0)
+ $$ = exp_intop (0x65041580);
else
{
einfo (_("\

View File

@ -1,19 +0,0 @@
diff -durN binutils-2.20.1.orig/ld/emulparams/elf_i386.sh binutils-2.20.1/ld/emulparams/elf_i386.sh
--- binutils-2.20.1.orig/ld/emulparams/elf_i386.sh 2009-07-29 16:59:23.000000000 +0200
+++ binutils-2.20.1/ld/emulparams/elf_i386.sh 2010-08-17 19:32:12.000000000 +0200
@@ -13,3 +13,13 @@
NO_SMALL_DATA=yes
SEPARATE_GOTPLT=12
IREL_IN_PLT=
+
+# In Gentoo, we install 32bit libs into /lib32 in an
+# ABI setup with amd64/x86
+case "$target" in
+ x86_64*-linux*)
+ case "$EMULATION_NAME" in
+ *i386*) LIBPATH_SUFFIX=32 ;;
+ esac
+ ;;
+esac

View File

@ -1,66 +0,0 @@
textrels are bad for forcing copy-on-write (this affects everyone),
and for security/runtime code generation, this affects security ppl.
But in either case, it doesn't matter who needs textrels, it's
the very fact that they're needed at all.
2006-06-10 Ned Ludd <solar@gentoo.org>, Mike Frysinger <vapier@gentoo.org>
* bfd/elflink.c (bfd_elf_final_link): Check all objects for TEXTRELs.
* ld/ldmain.c (main): Change textrel warning default to true.
* ld/testsuite/lib/ld-lib.exp (default_ld_simple_link): Scrub TEXTREL
warnings from ld output.
diff -durN binutils-2.20.1.orig/bfd/elflink.c binutils-2.20.1/bfd/elflink.c
--- binutils-2.20.1.orig/bfd/elflink.c 2010-08-17 19:32:11.000000000 +0200
+++ binutils-2.20.1/bfd/elflink.c 2010-08-17 19:32:13.000000000 +0200
@@ -10988,14 +10988,12 @@
goto error_return;
/* Check for DT_TEXTREL (late, in case the backend removes it). */
- if (info->warn_shared_textrel && info->shared)
+ o = bfd_get_section_by_name (dynobj, ".dynamic");
+ if (info->warn_shared_textrel && o != NULL)
{
bfd_byte *dyncon, *dynconend;
/* Fix up .dynamic entries. */
- o = bfd_get_section_by_name (dynobj, ".dynamic");
- BFD_ASSERT (o != NULL);
-
dyncon = o->contents;
dynconend = o->contents + o->size;
for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn)
@@ -11007,7 +11005,7 @@
if (dyn.d_tag == DT_TEXTREL)
{
info->callbacks->einfo
- (_("%P: warning: creating a DT_TEXTREL in a shared object.\n"));
+ (_("%P: warning: creating a DT_TEXTREL in object.\n"));
break;
}
}
diff -durN binutils-2.20.1.orig/ld/ldmain.c binutils-2.20.1/ld/ldmain.c
--- binutils-2.20.1.orig/ld/ldmain.c 2009-09-14 13:43:29.000000000 +0200
+++ binutils-2.20.1/ld/ldmain.c 2010-08-17 19:32:13.000000000 +0200
@@ -280,6 +280,7 @@
emulation = get_emulation (argc, argv);
ldemul_choose_mode (emulation);
default_target = ldemul_choose_target (argc, argv);
+ link_info.warn_shared_textrel = TRUE;
config.maxpagesize = bfd_emul_get_maxpagesize (default_target);
config.commonpagesize = bfd_emul_get_commonpagesize (default_target);
lang_init ();
diff -durN binutils-2.20.1.orig/ld/testsuite/lib/ld-lib.exp binutils-2.20.1/ld/testsuite/lib/ld-lib.exp
--- binutils-2.20.1.orig/ld/testsuite/lib/ld-lib.exp 2009-10-02 12:51:13.000000000 +0200
+++ binutils-2.20.1/ld/testsuite/lib/ld-lib.exp 2010-08-17 19:32:13.000000000 +0200
@@ -196,6 +196,10 @@
# symbol, since the default linker script might use ENTRY.
regsub -all "(^|\n)(\[^\n\]*: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
+ # Gentoo tweak:
+ # We want to ignore TEXTREL warnings since we force enable them by default
+ regsub -all "^lt-ld-new: warning: creating a DT_TEXTREL in object\." $exec_output "\\1" exec_output
+
if [string match "" $exec_output] then {
return 1
} else {

View File

@ -1,13 +0,0 @@
diff -durN binutils-2.20.1.orig/ld/ldmain.c binutils-2.20.1/ld/ldmain.c
--- binutils-2.20.1.orig/ld/ldmain.c 2010-08-17 19:32:13.000000000 +0200
+++ binutils-2.20.1/ld/ldmain.c 2010-08-17 19:32:15.000000000 +0200
@@ -262,6 +262,7 @@
link_info.allow_undefined_version = TRUE;
link_info.keep_memory = TRUE;
+ link_info.new_dtags = TRUE;
link_info.combreloc = TRUE;
link_info.strip_discarded = TRUE;
link_info.emit_hash = TRUE;

View File

@ -1,18 +0,0 @@
Index: binutils-2.19.51.0.5/ld/ld.texinfo
===================================================================
diff -durN binutils-2.20.1.orig/ld/ld.texinfo binutils-2.20.1/ld/ld.texinfo
--- binutils-2.20.1.orig/ld/ld.texinfo 2009-07-06 15:48:51.000000000 +0200
+++ binutils-2.20.1/ld/ld.texinfo 2010-08-17 19:32:16.000000000 +0200
@@ -2026,8 +2026,9 @@
systems may not understand them. If you specify
@option{--enable-new-dtags}, the dynamic tags will be created as needed.
If you specify @option{--disable-new-dtags}, no new dynamic tags will be
-created. By default, the new dynamic tags are not created. Note that
-those options are only available for ELF systems.
+created. On Gentoo, by default, the new dynamic tags are created (this
+differs from upstream behaviour). Note that those options are only
+available for ELF systems.
@kindex --hash-size=@var{number}
@item --hash-size=@var{number}

View File

@ -1,13 +0,0 @@
diff -durN binutils-2.20.1.orig/ld/ldmain.c binutils-2.20.1/ld/ldmain.c
--- binutils-2.20.1.orig/ld/ldmain.c 2010-08-17 19:32:17.000000000 +0200
+++ binutils-2.20.1/ld/ldmain.c 2010-08-17 19:32:18.000000000 +0200
@@ -264,6 +264,7 @@
link_info.keep_memory = TRUE;
link_info.new_dtags = TRUE;
link_info.combreloc = TRUE;
+ link_info.relro = TRUE;
link_info.strip_discarded = TRUE;
link_info.emit_hash = TRUE;
#ifndef __mips__

View File

@ -1,13 +0,0 @@
diff -durN binutils-2.20.1.orig/libiberty/Makefile.in binutils-2.20.1/libiberty/Makefile.in
--- binutils-2.20.1.orig/libiberty/Makefile.in 2009-08-23 21:03:58.000000000 +0200
+++ binutils-2.20.1/libiberty/Makefile.in 2010-08-17 19:32:19.000000000 +0200
@@ -227,6 +227,7 @@
$(AR) $(AR_FLAGS) $(TARGETLIB) \
$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
$(RANLIB) $(TARGETLIB); \
+ cp $(TARGETLIB) ../ ; \
cd ..; \
else true; fi

View File

@ -1,27 +0,0 @@
Description: correct where ld scripts are installed
Author: Chris Chimelis <chris@debian.org>
diff -durN binutils-2.20.1.orig/ld/Makefile.am binutils-2.20.1/ld/Makefile.am
--- binutils-2.20.1.orig/ld/Makefile.am 2010-02-22 09:07:01.000000000 +0100
+++ binutils-2.20.1/ld/Makefile.am 2010-08-17 19:32:21.000000000 +0200
@@ -24,7 +24,7 @@
# We put the scripts in the directory $(scriptdir)/ldscripts.
# We can't put the scripts in $(datadir) because the SEARCH_DIR
# directives need to be different for native and cross linkers.
-scriptdir = $(tooldir)/lib
+scriptdir = $(libdir)
EMUL = @EMUL@
EMULATION_OFILES = @EMULATION_OFILES@
diff -durN binutils-2.20.1.orig/ld/Makefile.in binutils-2.20.1/ld/Makefile.in
--- binutils-2.20.1.orig/ld/Makefile.in 2010-03-03 15:06:21.000000000 +0100
+++ binutils-2.20.1/ld/Makefile.in 2010-08-17 19:32:21.000000000 +0200
@@ -333,7 +333,7 @@
# We put the scripts in the directory $(scriptdir)/ldscripts.
# We can't put the scripts in $(datadir) because the SEARCH_DIR
# directives need to be different for native and cross linkers.
-scriptdir = $(tooldir)/lib
+scriptdir = $(libdir)
BASEDIR = $(srcdir)/..
BFDDIR = $(BASEDIR)/bfd
INCDIR = $(BASEDIR)/include

View File

@ -1,26 +0,0 @@
diff -u binutils-2.20.orig/configure binutils-2.20/configure
diff -durN binutils-2.20.1.orig/configure binutils-2.20.1/configure
--- binutils-2.20.1.orig/configure 2010-08-17 19:32:07.000000000 +0200
+++ binutils-2.20.1/configure 2010-08-17 19:32:22.000000000 +0200
@@ -3086,7 +3086,7 @@
noconfigdirs="$noconfigdirs target-libffi target-qthreads"
libgloss_dir=arm
;;
- arm*-*-linux-gnueabi)
+ arm*-*-linux-*gnueabi)
noconfigdirs="$noconfigdirs target-qthreads"
case ${with_newlib} in
no) noconfigdirs="$noconfigdirs target-newlib target-libgloss"
diff -durN binutils-2.20.1.orig/configure.ac binutils-2.20.1/configure.ac
--- binutils-2.20.1.orig/configure.ac 2010-08-17 19:32:07.000000000 +0200
+++ binutils-2.20.1/configure.ac 2010-08-17 19:32:22.000000000 +0200
@@ -573,7 +573,7 @@
noconfigdirs="$noconfigdirs target-libffi target-qthreads"
libgloss_dir=arm
;;
- arm*-*-linux-gnueabi)
+ arm*-*-linux-*gnueabi)
noconfigdirs="$noconfigdirs target-qthreads"
case ${with_newlib} in
no) noconfigdirs="$noconfigdirs target-newlib target-libgloss"

View File

@ -1,45 +0,0 @@
#!/bin/sh -e
## 006_better_file_error.dpatch by David Kimdon <dwhedon@gordian.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Specify which filename is causing an error if the filename is a
## DP: directory. (#45832)
if [ $# -ne 1 ]; then
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
fi
[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
case "$1" in
-patch) patch $patch_opts -p1 < $0;;
-unpatch) patch $patch_opts -p1 -R < $0;;
*)
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1;;
esac
exit 0
@DPATCH@
diff -urNad /home/james/debian/packages/binutils/binutils-2.14.90.0.6/bfd/opncls.c binutils-2.14.90.0.6/bfd/opncls.c
diff -durN binutils-2.20.1.orig/bfd/opncls.c binutils-2.20.1/bfd/opncls.c
--- binutils-2.20.1.orig/bfd/opncls.c 2010-01-14 11:48:22.000000000 +0100
+++ binutils-2.20.1/bfd/opncls.c 2010-08-17 19:32:23.000000000 +0200
@@ -183,6 +183,13 @@
{
bfd *nbfd;
const bfd_target *target_vec;
+ struct stat s;
+
+ if (stat (filename, &s) == 0)
+ if (S_ISDIR(s.st_mode)) {
+ bfd_set_error (bfd_error_file_not_recognized);
+ return NULL;
+ }
nbfd = _bfd_new_bfd ();
if (nbfd == NULL)

View File

@ -1,96 +0,0 @@
Description:
This patch is needed in situations where build system is running same version of
binutils that is intended to be built cross-native ( build != host = target)
and has shared libraries enabled. binutils/binutils
Makefile has some tools which are built to run on build system. Toplevel makefile
for binutils passes HOST_EXPORTS to sub-makefiles which also include RPATH_ENVVARS
containing LD_LIBRARY_PATH which is modified so that it also includes host libraries
like opcodes and libbfd which are just built for the host system.
Now the problem is that same LD_LIBRARY_PATH value gets set in environment even
for the tools that are being built for build system using CC_FOR_BUILD and the tools
like as,ld it invokes from build machine get the LD_LIBRARY_PATH set to search
the newly build host libraries like opcodes and bfd and if host is like a big endian
system say (mips-linux) the build system linker and assembler do not run because
ld.so tries to load these shared libraries instead of the ones from /usr/lib for
the build tools.
This patch fixes the issue by clearing LD_LIBRARY_PATH for BUILD tools
This patch would be needed on other versions of binutils. I just cared about 2.20
May be upstream is also interested in such a patch.
-Khem
Index: binutils-2.20/binutils/Makefile.am
===================================================================
diff -durN binutils-2.20.1.orig/binutils/Makefile.am binutils-2.20.1/binutils/Makefile.am
--- binutils-2.20.1.orig/binutils/Makefile.am 2010-01-14 11:48:22.000000000 +0100
+++ binutils-2.20.1/binutils/Makefile.am 2010-08-17 19:32:24.000000000 +0200
@@ -251,24 +251,24 @@
./sysinfo$(EXEEXT_FOR_BUILD) -d <$(srcdir)/sysroff.info >sysroff.h
sysinfo$(EXEEXT_FOR_BUILD): sysinfo.o syslex.o
- $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ sysinfo.o syslex.o
+ LD_LIBRARY_PATH= $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ sysinfo.o syslex.o
syslex.o: syslex.c sysinfo.h config.h
if [ -r syslex.c ]; then \
- $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) syslex.c ; \
+ LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) syslex.c ; \
else \
- $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/syslex.c ;\
+ LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/syslex.c ;\
fi
sysinfo.o: sysinfo.c
if [ -r sysinfo.c ]; then \
- $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) sysinfo.c ; \
+ LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) sysinfo.c ; \
else \
- $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/sysinfo.c ; \
+ LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/sysinfo.c ; \
fi
bin2c$(EXEEXT_FOR_BUILD):
- $(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c $(srcdir)/version.c
+ LD_LIBRARY_PATH= $(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c $(srcdir)/version.c
embedspu: embedspu.sh
sed "s@^program_transform_name=@program_transform_name=$(program_transform_name)@" < $< > $@
diff -durN binutils-2.20.1.orig/binutils/Makefile.in binutils-2.20.1/binutils/Makefile.in
--- binutils-2.20.1.orig/binutils/Makefile.in 2010-03-03 14:59:46.000000000 +0100
+++ binutils-2.20.1/binutils/Makefile.in 2010-08-17 19:32:24.000000000 +0200
@@ -1193,24 +1193,24 @@
./sysinfo$(EXEEXT_FOR_BUILD) -d <$(srcdir)/sysroff.info >sysroff.h
sysinfo$(EXEEXT_FOR_BUILD): sysinfo.o syslex.o
- $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ sysinfo.o syslex.o
+ LD_LIBRARY_PATH= $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ sysinfo.o syslex.o
syslex.o: syslex.c sysinfo.h config.h
if [ -r syslex.c ]; then \
- $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) syslex.c ; \
+ LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) syslex.c ; \
else \
- $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/syslex.c ;\
+ LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/syslex.c ;\
fi
sysinfo.o: sysinfo.c
if [ -r sysinfo.c ]; then \
- $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) sysinfo.c ; \
+ LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) sysinfo.c ; \
else \
- $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/sysinfo.c ; \
+ LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/sysinfo.c ; \
fi
bin2c$(EXEEXT_FOR_BUILD):
- $(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c $(srcdir)/version.c
+ LD_LIBRARY_PATH= $(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c $(srcdir)/version.c
embedspu: embedspu.sh
sed "s@^program_transform_name=@program_transform_name=$(program_transform_name)@" < $< > $@

View File

@ -1,24 +0,0 @@
diff -p -c -u -r1.196 elf32-arm.c
diff -durN binutils-2.20.1.orig/bfd/elf32-arm.c binutils-2.20.1/bfd/elf32-arm.c
--- binutils-2.20.1.orig/bfd/elf32-arm.c 2010-02-22 09:06:48.000000000 +0100
+++ binutils-2.20.1/bfd/elf32-arm.c 2010-08-17 19:32:25.000000000 +0200
@@ -3194,11 +3194,15 @@
/* We have an extra 2-bytes reach because of
the mode change (bit 24 (H) of BLX encoding). */
+ /* A stub is needed only if this call is not throught a PLT
+ entry, because PLT stubs handle mode switching
+ already. */
if (branch_offset > (ARM_MAX_FWD_BRANCH_OFFSET + 2)
|| (branch_offset < ARM_MAX_BWD_BRANCH_OFFSET)
- || ((r_type == R_ARM_CALL) && !globals->use_blx)
- || (r_type == R_ARM_JUMP24)
- || (r_type == R_ARM_PLT32))
+ || ( (((r_type == R_ARM_CALL) && !globals->use_blx)
+ || (r_type == R_ARM_JUMP24)
+ || (r_type == R_ARM_PLT32))
+ && !use_plt))
{
stub_type = (info->shared | globals->pic_veneer)
/* PIC stubs. */

View File

@ -1,21 +0,0 @@
diff -durN binutils-2.20.1.orig/ld/configure.tgt binutils-2.20.1/ld/configure.tgt
--- binutils-2.20.1.orig/ld/configure.tgt 2009-08-06 19:38:03.000000000 +0200
+++ binutils-2.20.1/ld/configure.tgt 2010-08-17 19:32:26.000000000 +0200
@@ -400,11 +400,11 @@
mips*-*-vxworks*) targ_emul=elf32ebmipvxworks
targ_extra_emuls="elf32elmipvxworks" ;;
mips*-*-windiss) targ_emul=elf32mipswindiss ;;
-mips64*el-*-linux-*) targ_emul=elf32ltsmipn32
- targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip"
+mips64*el-*-linux-*) targ_emul=elf64ltsmip
+ targ_extra_emuls="elf32ltsmipn32 elf32btsmipn32 elf32ltsmip elf32btsmip elf64btsmip"
targ_extra_libpath=$targ_extra_emuls ;;
-mips64*-*-linux-*) targ_emul=elf32btsmipn32
- targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip"
+mips64*-*-linux-*) targ_emul=elf64btsmip
+ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32btsmip elf32ltsmip elf64ltsmip"
targ_extra_libpath=$targ_extra_emuls ;;
mips*el-*-linux-*) targ_emul=elf32ltsmip
targ_extra_emuls="elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip"

View File

@ -1,24 +0,0 @@
diff -durN binutils-2.21.1.orig/configure binutils-2.21.1/configure
--- binutils-2.21.1.orig/configure 2011-06-27 09:39:00.000000000 +0200
+++ binutils-2.21.1/configure 2011-09-12 13:39:06.292251293 +0200
@@ -3180,7 +3180,7 @@
noconfigdirs="$noconfigdirs target-libffi target-qthreads"
libgloss_dir=arm
;;
- arm*-*-linux-gnueabi)
+ arm*-*-linux-*gnueabi)
noconfigdirs="$noconfigdirs target-qthreads"
case ${with_newlib} in
no) noconfigdirs="$noconfigdirs target-newlib target-libgloss"
diff -durN binutils-2.21.1.orig/configure.ac binutils-2.21.1/configure.ac
--- binutils-2.21.1.orig/configure.ac 2011-06-27 11:08:53.000000000 +0200
+++ binutils-2.21.1/configure.ac 2011-09-12 13:39:06.308917895 +0200
@@ -652,7 +652,7 @@
noconfigdirs="$noconfigdirs target-libffi target-qthreads"
libgloss_dir=arm
;;
- arm*-*-linux-gnueabi)
+ arm*-*-linux-*gnueabi)
noconfigdirs="$noconfigdirs target-qthreads"
case ${with_newlib} in
no) noconfigdirs="$noconfigdirs target-newlib target-libgloss"

View File

@ -1,42 +0,0 @@
diff -durN binutils-2.21.1.orig/configure binutils-2.21.1/configure
--- binutils-2.21.1.orig/configure 2011-09-12 13:39:06.292251293 +0200
+++ binutils-2.21.1/configure 2011-09-12 13:39:07.135581381 +0200
@@ -3148,7 +3148,7 @@
am33_2.0-*-linux*)
noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
;;
- sh-*-linux*)
+ sh*-*-linux*)
noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
;;
sh*-*-pe|mips*-*-pe|*arm-wince-pe)
@@ -3487,7 +3487,7 @@
romp-*-*)
noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
;;
- sh-*-* | sh64-*-*)
+ sh*-*-* | sh64-*-*)
case "${host}" in
i[3456789]86-*-vsta) ;; # don't add gprof back in
i[3456789]86-*-go32*) ;; # don't add gprof back in
diff -durN binutils-2.21.1.orig/configure.ac binutils-2.21.1/configure.ac
--- binutils-2.21.1.orig/configure.ac 2011-09-12 13:39:06.308917895 +0200
+++ binutils-2.21.1/configure.ac 2011-09-12 13:39:07.145581342 +0200
@@ -620,7 +620,7 @@
am33_2.0-*-linux*)
noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
;;
- sh-*-linux*)
+ sh*-*-linux*)
noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
;;
sh*-*-pe|mips*-*-pe|*arm-wince-pe)
@@ -959,7 +959,7 @@
romp-*-*)
noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
;;
- sh-*-* | sh64-*-*)
+ sh*-*-* | sh64-*-*)
case "${host}" in
i[[3456789]]86-*-vsta) ;; # don't add gprof back in
i[[3456789]]86-*-go32*) ;; # don't add gprof back in

View File

@ -1,24 +0,0 @@
diff -durN binutils-2.21.1.orig/ld/Makefile.am binutils-2.21.1/ld/Makefile.am
--- binutils-2.21.1.orig/ld/Makefile.am 2011-03-16 09:37:30.000000000 +0100
+++ binutils-2.21.1/ld/Makefile.am 2011-09-12 13:39:07.962244866 +0200
@@ -37,7 +37,7 @@
# We put the scripts in the directory $(scriptdir)/ldscripts.
# We can't put the scripts in $(datadir) because the SEARCH_DIR
# directives need to be different for native and cross linkers.
-scriptdir = $(tooldir)/lib
+scriptdir = $(libdir)
EMUL = @EMUL@
EMULATION_OFILES = @EMULATION_OFILES@
diff -durN binutils-2.21.1.orig/ld/Makefile.in binutils-2.21.1/ld/Makefile.in
--- binutils-2.21.1.orig/ld/Makefile.in 2011-03-16 09:37:30.000000000 +0100
+++ binutils-2.21.1/ld/Makefile.in 2011-09-12 13:39:07.962244866 +0200
@@ -365,7 +365,7 @@
# We put the scripts in the directory $(scriptdir)/ldscripts.
# We can't put the scripts in $(datadir) because the SEARCH_DIR
# directives need to be different for native and cross linkers.
-scriptdir = $(tooldir)/lib
+scriptdir = $(libdir)
BASEDIR = $(srcdir)/..
BFDDIR = $(BASEDIR)/bfd
INCDIR = $(BASEDIR)/include

View File

@ -1,21 +0,0 @@
diff -durN binutils-2.21.1.orig/ld/emultempl/elf32.em binutils-2.21.1/ld/emultempl/elf32.em
--- binutils-2.21.1.orig/ld/emultempl/elf32.em 2011-06-27 09:39:14.000000000 +0200
+++ binutils-2.21.1/ld/emultempl/elf32.em 2011-09-12 13:39:08.808908274 +0200
@@ -1272,6 +1272,8 @@
&& command_line.rpath == NULL)
{
lib_path = (const char *) getenv ("LD_RUN_PATH");
+ if ((lib_path) && (strlen (lib_path) == 0))
+ lib_path = NULL;
if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
force))
break;
@@ -1499,6 +1501,8 @@
rpath = command_line.rpath;
if (rpath == NULL)
rpath = (const char *) getenv ("LD_RUN_PATH");
+ if ((rpath) && (strlen (rpath) == 0))
+ rpath = NULL;
for (abfd = link_info.input_bfds; abfd; abfd = abfd->link_next)
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)

View File

@ -1,31 +0,0 @@
r10231 | lethal | 2005-05-02 09:58:00 -0400 (Mon, 02 May 2005) | 13 lines
Likewise, binutils has no idea about any of these new targets either, so we
fix that up too.. now we're able to actually build a real toolchain for
sh2a_nofpu- and other more ineptly named toolchains (and yes, there are more
inept targets than that one, really. Go look, I promise).
diff -durN binutils-2.22.orig/configure binutils-2.22/configure
--- binutils-2.22.orig/configure 2011-08-14 14:28:15.000000000 +0200
+++ binutils-2.22/configure 2011-12-14 19:49:40.284777434 +0100
@@ -3570,7 +3570,7 @@
mips*-*-*)
noconfigdirs="$noconfigdirs gprof"
;;
- sh-*-* | sh64-*-*)
+ sh*-*-* | sh64-*-*)
case "${target}" in
sh*-*-elf)
;;
diff -durN binutils-2.22.orig/configure.ac binutils-2.22/configure.ac
--- binutils-2.22.orig/configure.ac 2011-11-21 12:58:27.000000000 +0100
+++ binutils-2.22/configure.ac 2011-12-14 19:49:40.316777436 +0100
@@ -1006,7 +1006,7 @@
mips*-*-*)
noconfigdirs="$noconfigdirs gprof"
;;
- sh-*-* | sh64-*-*)
+ sh*-*-* | sh64-*-*)
case "${target}" in
sh*-*-elf)
;;

View File

@ -1,24 +0,0 @@
diff -durN binutils-2.22.orig/ld/Makefile.am binutils-2.22/ld/Makefile.am
--- binutils-2.22.orig/ld/Makefile.am 2011-07-22 22:22:37.000000000 +0200
+++ binutils-2.22/ld/Makefile.am 2011-12-14 19:50:25.760779164 +0100
@@ -37,7 +37,7 @@
# We put the scripts in the directory $(scriptdir)/ldscripts.
# We can't put the scripts in $(datadir) because the SEARCH_DIR
# directives need to be different for native and cross linkers.
-scriptdir = $(tooldir)/lib
+scriptdir = $(libdir)
EMUL = @EMUL@
EMULATION_OFILES = @EMULATION_OFILES@
diff -durN binutils-2.22.orig/ld/Makefile.in binutils-2.22/ld/Makefile.in
--- binutils-2.22.orig/ld/Makefile.in 2011-07-22 22:22:37.000000000 +0200
+++ binutils-2.22/ld/Makefile.in 2011-12-14 19:50:25.784779163 +0100
@@ -366,7 +366,7 @@
# We put the scripts in the directory $(scriptdir)/ldscripts.
# We can't put the scripts in $(datadir) because the SEARCH_DIR
# directives need to be different for native and cross linkers.
-scriptdir = $(tooldir)/lib
+scriptdir = $(libdir)
BASEDIR = $(srcdir)/..
BFDDIR = $(BASEDIR)/bfd
INCDIR = $(BASEDIR)/include

View File

@ -1,21 +0,0 @@
diff -durN binutils-2.22.orig/ld/emultempl/elf32.em binutils-2.22/ld/emultempl/elf32.em
--- binutils-2.22.orig/ld/emultempl/elf32.em 2011-11-21 10:29:39.000000000 +0100
+++ binutils-2.22/ld/emultempl/elf32.em 2011-12-14 19:52:12.880783238 +0100
@@ -1273,6 +1273,8 @@
&& command_line.rpath == NULL)
{
lib_path = (const char *) getenv ("LD_RUN_PATH");
+ if ((lib_path) && (strlen (lib_path) == 0))
+ lib_path = NULL;
if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
force))
break;
@@ -1500,6 +1502,8 @@
rpath = command_line.rpath;
if (rpath == NULL)
rpath = (const char *) getenv ("LD_RUN_PATH");
+ if ((rpath) && (strlen (rpath) == 0))
+ rpath = NULL;
for (abfd = link_info.input_bfds; abfd; abfd = abfd->link_next)
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)

View File

@ -1,12 +0,0 @@
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -12408,7 +12408,8 @@ elf32_arm_check_relocs (bfd *abfd, struc
/* If the symbol is a function that doesn't bind locally,
this relocation will need a PLT entry. */
- root_plt->refcount += 1;
+ if (root_plt->refcount != -1)
+ root_plt->refcount += 1;
if (!call_reloc_p)
arm_plt->noncall_refcount++;

View File

@ -1,42 +0,0 @@
diff -ur binutils-2.22.org/bfd/bfd-in2.h binutils-2.22/bfd/bfd-in2.h
--- binutils-2.22.org/bfd/bfd-in2.h 2011-09-16 03:15:18.000000000 +0200
+++ binutils-2.22/bfd/bfd-in2.h 2012-11-03 18:25:20.365668349 +0100
@@ -32,6 +32,8 @@
#ifndef __BFD_H_SEEN__
#define __BFD_H_SEEN__
+#include <sys/stat.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -308,8 +310,6 @@
&& (sec)->sec_info_type != ELF_INFO_TYPE_MERGE \
&& (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)
-/* Forward define. */
-struct stat;
typedef enum bfd_print_symbol
{
diff -ur binutils-2.22.org/bfd/bfd-in.h binutils-2.22/bfd/bfd-in.h
--- binutils-2.22.org/bfd/bfd-in.h 2011-09-16 03:15:18.000000000 +0200
+++ binutils-2.22/bfd/bfd-in.h 2012-11-03 18:24:43.397783645 +0100
@@ -25,6 +25,8 @@
#ifndef __BFD_H_SEEN__
#define __BFD_H_SEEN__
+#include <sys/stat.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -301,8 +303,6 @@
&& (sec)->sec_info_type != ELF_INFO_TYPE_MERGE \
&& (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)
-/* Forward define. */
-struct stat;
typedef enum bfd_print_symbol
{

View File

@ -1,72 +0,0 @@
http://bugs.gentoo.org/392645
http://sourceware.org/bugzilla/show_bug.cgi?id=13470
2011-12-03 Alan Modra <amodra@gmail.com>
PR ld/13470
* elf32-ppc.c (ppc_elf_copy_indirect_symbol): Revert substantive
change in 2011-07-01 commit. Comment.
* elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Likewise.
diff -durN binutils-2.22.orig/bfd/elf32-ppc.c binutils-2.22/bfd/elf32-ppc.c
--- binutils-2.22.orig/bfd/elf32-ppc.c 2011-11-21 10:29:21.000000000 +0100
+++ binutils-2.22/bfd/elf32-ppc.c 2011-12-14 19:52:43.308784395 +0100
@@ -2987,10 +2987,6 @@
edir->elf.needs_plt |= eind->elf.needs_plt;
edir->elf.pointer_equality_needed |= eind->elf.pointer_equality_needed;
- /* If we were called to copy over info for a weak sym, that's all. */
- if (eind->elf.root.type != bfd_link_hash_indirect)
- return;
-
if (eind->dyn_relocs != NULL)
{
if (edir->dyn_relocs != NULL)
@@ -3022,6 +3018,16 @@
eind->dyn_relocs = NULL;
}
+ /* If we were called to copy over info for a weak sym, that's all.
+ You might think dyn_relocs need not be copied over; After all,
+ both syms will be dynamic or both non-dynamic so we're just
+ moving reloc accounting around. However, ELIMINATE_COPY_RELOCS
+ code in ppc_elf_adjust_dynamic_symbol needs to check for
+ dyn_relocs in read-only sections, and it does so on what is the
+ DIR sym here. */
+ if (eind->elf.root.type != bfd_link_hash_indirect)
+ return;
+
/* Copy over the GOT refcount entries that we may have already seen to
the symbol which just became indirect. */
edir->elf.got.refcount += eind->elf.got.refcount;
diff -durN binutils-2.22.orig/bfd/elf64-ppc.c binutils-2.22/bfd/elf64-ppc.c
--- binutils-2.22.orig/bfd/elf64-ppc.c 2011-11-21 10:29:24.000000000 +0100
+++ binutils-2.22/bfd/elf64-ppc.c 2011-12-14 19:52:43.336784395 +0100
@@ -4435,10 +4435,6 @@
edir->elf.ref_regular_nonweak |= eind->elf.ref_regular_nonweak;
edir->elf.needs_plt |= eind->elf.needs_plt;
- /* If we were called to copy over info for a weak sym, that's all. */
- if (eind->elf.root.type != bfd_link_hash_indirect)
- return;
-
/* Copy over any dynamic relocs we may have on the indirect sym. */
if (eind->dyn_relocs != NULL)
{
@@ -4471,6 +4467,16 @@
eind->dyn_relocs = NULL;
}
+ /* If we were called to copy over info for a weak sym, that's all.
+ You might think dyn_relocs need not be copied over; After all,
+ both syms will be dynamic or both non-dynamic so we're just
+ moving reloc accounting around. However, ELIMINATE_COPY_RELOCS
+ code in ppc64_elf_adjust_dynamic_symbol needs to check for
+ dyn_relocs in read-only sections, and it does so on what is the
+ DIR sym here. */
+ if (eind->elf.root.type != bfd_link_hash_indirect)
+ return;
+
/* Copy over got entries that we may have already seen to the
symbol which just became indirect. */
if (eind->elf.got.glist != NULL)

View File

@ -1,33 +0,0 @@
r10231 | lethal | 2005-05-02 09:58:00 -0400 (Mon, 02 May 2005) | 13 lines
Likewise, binutils has no idea about any of these new targets either, so we
fix that up too.. now we're able to actually build a real toolchain for
sh2a_nofpu- and other more ineptly named toolchains (and yes, there are more
inept targets than that one, really. Go look, I promise).
diff --git a/configure b/configure
index 87677bc..2d916f1 100755
--- a/configure
+++ b/configure
@@ -3812,7 +3812,7 @@ case "${target}" in
or1k*-*-*)
noconfigdirs="$noconfigdirs gdb"
;;
- sh-*-* | sh64-*-*)
+ sh*-*-* | sh64-*-*)
case "${target}" in
sh*-*-elf)
;;
diff --git a/configure.ac b/configure.ac
index 8fe0eca..b10a99f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1140,7 +1140,7 @@ case "${target}" in
or1k*-*-*)
noconfigdirs="$noconfigdirs gdb"
;;
- sh-*-* | sh64-*-*)
+ sh*-*-* | sh64-*-*)
case "${target}" in
sh*-*-elf)
;;

View File

@ -1,26 +0,0 @@
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 9575f1f..84df0bf 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -54,7 +54,7 @@ endif
# We put the scripts in the directory $(scriptdir)/ldscripts.
# We can't put the scripts in $(datadir) because the SEARCH_DIR
# directives need to be different for native and cross linkers.
-scriptdir = $(tooldir)/lib
+scriptdir = $(libdir)
EMUL = @EMUL@
EMULATION_OFILES = @EMULATION_OFILES@
diff --git a/ld/Makefile.in b/ld/Makefile.in
index 9f56ca1..272860f 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -388,7 +388,7 @@ AM_CFLAGS = $(WARN_CFLAGS)
# We put the scripts in the directory $(scriptdir)/ldscripts.
# We can't put the scripts in $(datadir) because the SEARCH_DIR
# directives need to be different for native and cross linkers.
-scriptdir = $(tooldir)/lib
+scriptdir = $(libdir)
BASEDIR = $(srcdir)/..
BFDDIR = $(BASEDIR)/bfd
INCDIR = $(BASEDIR)/include

View File

@ -1,22 +0,0 @@
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 137446f..bb8391a 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -1195,6 +1195,8 @@ fragment <<EOF
&& command_line.rpath == NULL)
{
lib_path = (const char *) getenv ("LD_RUN_PATH");
+ if ((lib_path) && (strlen (lib_path) == 0))
+ lib_path = NULL;
if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
force))
break;
@@ -1458,6 +1460,8 @@ gld${EMULATION_NAME}_before_allocation (void)
rpath = command_line.rpath;
if (rpath == NULL)
rpath = (const char *) getenv ("LD_RUN_PATH");
+ if ((rpath) && (*rpath == '\0'))
+ rpath = NULL;
for (abfd = link_info.input_bfds; abfd; abfd = abfd->link.next)
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)

View File

@ -1,11 +0,0 @@
--- binutils-2.25.orig/gold/binary.cc 2015-06-09 10:48:32.000000000 +0100
+++ binutils-2.25/gold/binary.cc 2015-06-09 10:49:23.000000000 +0100
@@ -23,7 +23,7 @@
#include "gold.h"
#include <cerrno>
-#include <cstring>
+#include <string>
#include "safe-ctype.h"
#include "elfcpp.h"

View File

@ -1,77 +0,0 @@
From c39479f4ab4d372b518957871e1f205a03e7c3d6 Mon Sep 17 00:00:00 2001
From: Andrew Hsieh <andrewhsieh@google.com>
Date: Wed, 18 Mar 2015 10:57:24 +0800
Subject: [PATCH] Fix darwin build
1. In Drawin PTHREAD_ONCE_INIT is {0x30B1BCBA, {0}} and the GCC < 4.4
doesn't support ended initializer list
2. wcsncasecmp doesn't exist in MacSDK10.6.x
Change-Id: I69204a72f853f5263dffedc448379d75ed4eca2e
---
binutils-2.25/bfd/peXXigen.c | 22 ++++++++++++++++++++++
binutils-2.25/gold/gold-threads.cc | 15 ++++++++++++---
2 files changed, 34 insertions(+), 3 deletions(-)
diff --git binutils-2.25.orig/bfd/peXXigen.c binutils-2.25/bfd/peXXigen.c
index 13e39e4..7a98306 100644
--- binutils-2.25.orig/bfd/peXXigen.c
+++ binutils-2.25/bfd/peXXigen.c
@@ -3522,6 +3522,28 @@ u16_mbtouc (wchar_t * puc, const unsigned short * s, unsigned int n)
}
#endif /* HAVE_WCHAR_H and not Cygwin/Mingw */
+#ifdef __APPLE__
+/* wcsncasecmp isn't always defined in Mac SDK */
+static int
+wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n)
+{
+ wchar_t c1, c2;
+
+ if (n == 0)
+ return (0);
+ for (; *s1; s1++, s2++)
+ {
+ c1 = towlower(*s1);
+ c2 = towlower(*s2);
+ if (c1 != c2)
+ return ((int)c1 - c2);
+ if (--n == 0)
+ return (0);
+ }
+ return (-*s2);
+}
+#endif
+
/* Perform a comparison of two entries. */
static signed int
rsrc_cmp (bfd_boolean is_name, rsrc_entry * a, rsrc_entry * b)
diff --git binutils-2.25.orig/gold/gold-threads.cc binutils-2.25/gold/gold-threads.cc
index ff5a8ac..45140e0 100644
--- binutils-2.25.orig/gold/gold-threads.cc
+++ binutils-2.25/gold/gold-threads.cc
@@ -284,9 +284,18 @@ Condvar::~Condvar()
class Once_initialize
{
public:
- Once_initialize()
- : once_(PTHREAD_ONCE_INIT)
- { }
+ Once_initialize()
+#if !defined(__APPLE__)
+ : once_(PTHREAD_ONCE_INIT)
+ { }
+#else
+// In Drawin PTHREAD_ONCE_INIT is {0x30B1BCBA, {0}} and the GCC < 4.4 doesn't support
+// extended initializer list as above */
+ {
+ pthread_once_t once_2 = PTHREAD_ONCE_INIT;
+ once_ = once_2;
+ }
+#endif
// Return a pointer to the pthread_once_t variable.
pthread_once_t*
--
2.1.3