Allow GOLD linker to parse "-l<name>" directives inside INPUT statements in

linker scripts. (BZ 600553)
This commit is contained in:
Nicholas Clifton 2010-06-09 15:02:07 +00:00
parent b429324655
commit 2ba3bf20b9
2 changed files with 67 additions and 1 deletions

View File

@ -0,0 +1,61 @@
diff -rcp ../binutils-2.20.51.0.7-original/gold/script.cc gold/script.cc
*** ../binutils-2.20.51.0.7-original/gold/script.cc 2010-06-09 15:18:46.000000000 +0100
--- gold/script.cc 2010-06-09 15:20:49.000000000 +0100
*************** script_add_file(void* closurev, const ch
*** 2589,2594 ****
--- 2589,2612 ----
closure->inputs()->add_file(file);
}
+ // Called by the bison parser to add a library to the link.
+
+ extern "C" void
+ script_add_library(void* closurev, const char* name, size_t length)
+ {
+ Parser_closure* closure = static_cast<Parser_closure*>(closurev);
+ std::string name_string(name, length);
+
+ if (name_string[0] != 'l')
+ gold_error(_("library name must be prefixed with -l"));
+
+ Input_file_argument file(name_string.c_str() + 1,
+ Input_file_argument::INPUT_FILE_TYPE_LIBRARY,
+ "", false,
+ closure->position_dependent_options());
+ closure->inputs()->add_file(file);
+ }
+
// Called by the bison parser to start a group. If we are already in
// a group, that means that this script was invoked within a
// --start-group --end-group sequence on the command line, or that
diff -rcp ../binutils-2.20.51.0.7-original/gold/script-c.h gold/script-c.h
*** ../binutils-2.20.51.0.7-original/gold/script-c.h 2010-06-09 15:18:47.000000000 +0100
--- gold/script-c.h 2010-06-09 15:21:05.000000000 +0100
*************** script_add_extern(void* closure, const c
*** 222,227 ****
--- 222,232 ----
extern void
script_add_file(void* closure, const char*, size_t);
+ /* Called by the bison parser to add a library to the link. */
+
+ extern void
+ script_add_library(void* closure, const char*, size_t);
+
/* Called by the bison parser to start and stop a group. */
extern void
diff -rcp ../binutils-2.20.51.0.7-original/gold/yyscript.y gold/yyscript.y
*** ../binutils-2.20.51.0.7-original/gold/yyscript.y 2010-06-09 15:18:46.000000000 +0100
--- gold/yyscript.y 2010-06-09 15:21:21.000000000 +0100
*************** input_list:
*** 314,319 ****
--- 314,321 ----
input_list_element:
string
{ script_add_file(closure, $1.value, $1.length); }
+ | '-' STRING
+ { script_add_library(closure, $2.value, $2.length); }
| AS_NEEDED
{ script_start_as_needed(closure); }
'(' input_list ')'

View File

@ -17,7 +17,7 @@
Summary: A GNU collection of binary utilities
Name: %{?cross}binutils%{?_with_debug:-debug}
Version: 2.20.51.0.7
Release: 3%{?dist}
Release: 4%{?dist}
License: GPLv3+
Group: Development/Tools
URL: http://sources.redhat.com/binutils
@ -34,6 +34,7 @@ Patch08: binutils-2.20.51.0.2-copy-osabi.patch
Patch09: binutils-2.20.51.0.7-do-not-bind-unique-symbols-locally.patch
Patch10: binutils-2.20.51.0.7-dwarf4.patch
Patch11: binutils-2.20.51.0.7-unique-archive-symbols.patch
Patch12: binutils-2.20.51.0.7-gold-INPUT.patch
%define gold_arches %ix86 x86_64
@ -128,6 +129,7 @@ using libelf instead of BFD.
%patch09 -p0 -b .do-not-bind-unique~
%patch10 -p0 -b .dwarf4~
%patch11 -p0 -b .unique~
%patch12 -p0 -b .gold-input~
# We cannot run autotools as there is an exact requirement of autoconf-2.59.
@ -410,6 +412,9 @@ exit 0
%endif # %{isnative}
%changelog
* Wed Jun 9 2010 Nick Clifton <nickc@redhat.com> - 2.20.51.0.7-4
- Allow GOLD linker to parse "-l<name>" directives inside INPUT statements in linker scripts. (BZ 600553)
* Tue May 4 2010 Nick Clifton <nickc@redhat.com> - 2.20.51.0.7-3
- Allow unique symbols in archive maps.