From 2ba3bf20b93ad904f9831adfdcc2cc0444047c23 Mon Sep 17 00:00:00 2001 From: Nicholas Clifton Date: Jun 09 2010 15:02:07 +0000 Subject: Allow GOLD linker to parse "-l" directives inside INPUT statements in linker scripts. (BZ 600553) --- diff --git a/binutils-2.20.51.0.7-gold-INPUT.patch b/binutils-2.20.51.0.7-gold-INPUT.patch new file mode 100644 index 0000000..f1ccbb4 --- /dev/null +++ b/binutils-2.20.51.0.7-gold-INPUT.patch @@ -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(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 ')' diff --git a/binutils.spec b/binutils.spec index c976684..898e175 100644 --- a/binutils.spec +++ b/binutils.spec @@ -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 - 2.20.51.0.7-4 +- Allow GOLD linker to parse "-l" directives inside INPUT statements in linker scripts. (BZ 600553) + * Tue May 4 2010 Nick Clifton - 2.20.51.0.7-3 - Allow unique symbols in archive maps.