summaryrefslogtreecommitdiffstats
path: root/contrib/binutils/ld
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2010-10-25 19:43:22 +0000
committerdim <dim@FreeBSD.org>2010-10-25 19:43:22 +0000
commitb985ffce133dbdaa89aeb0cca7488146762ccb4e (patch)
treeae4ea5dc92334339c2cca917a49b3894a21e9391 /contrib/binutils/ld
parent6582686305de16b3784e4e34cf5ef47268efc9c0 (diff)
downloadFreeBSD-src-b985ffce133dbdaa89aeb0cca7488146762ccb4e.zip
FreeBSD-src-b985ffce133dbdaa89aeb0cca7488146762ccb4e.tar.gz
Apply commit f6c8fecc6fe3d5532691867a7f27820bb1c426a9 from upstream
(still under GPLv2 at that time): Author: H.J. Lu <hjl@lucon.org> Date: Wed Sep 27 04:18:16 2006 +0000 PR ld/3223 PR ld/3267 * bfd/elf.c (assign_file_positions_for_non_load_sections): Don't warn zero size allocated sections. * ld/ldlang.h (lang_output_section_statement_type): Add section_relative_symbol. * ld/ldlang.c (strip_excluded_output_sections): Don't strip a section with a symbol relative to it. (lang_size_sections_1): Mark if an output section has a symbol symbol relative to it. This prevents warnings like the following during stripping of debug info from kernel modules on i386: ===> zlib (all) ... objcopy --only-keep-debug zlib.ko.debug zlib.ko.symbols objcopy --strip-debug --add-gnu-debuglink=zlib.ko.symbols zlib.ko.debug zlib.ko BFD: zlib.ko: warning: allocated section `.plt' not in segment BFD: zlib.ko: warning: allocated section `.got' not in segment
Diffstat (limited to 'contrib/binutils/ld')
-rw-r--r--contrib/binutils/ld/ldlang.c11
-rw-r--r--contrib/binutils/ld/ldlang.h3
2 files changed, 13 insertions, 1 deletions
diff --git a/contrib/binutils/ld/ldlang.c b/contrib/binutils/ld/ldlang.c
index 761be6f..2d04ae4 100644
--- a/contrib/binutils/ld/ldlang.c
+++ b/contrib/binutils/ld/ldlang.c
@@ -3244,6 +3244,7 @@ strip_excluded_output_sections (void)
continue;
exclude = (output_section->rawsize == 0
+ && !os->section_relative_symbol
&& (output_section->flags & SEC_KEEP) == 0
&& !bfd_section_removed_from_list (output_bfd,
output_section));
@@ -4442,11 +4443,19 @@ lang_size_sections_1
case lang_assignment_statement_enum:
{
bfd_vma newdot = dot;
+ etree_type *tree = s->assignment_statement.exp;
- exp_fold_tree (s->assignment_statement.exp,
+ exp_fold_tree (tree,
output_section_statement->bfd_section,
&newdot);
+ /* This symbol is relative to this section. */
+ if ((tree->type.node_class == etree_provided
+ || tree->type.node_class == etree_assign)
+ && (tree->assign.dst [0] != '.'
+ || tree->assign.dst [1] != '\0'))
+ output_section_statement->section_relative_symbol = 1;
+
if (!output_section_statement->ignored)
{
if (output_section_statement == abs_output_section)
diff --git a/contrib/binutils/ld/ldlang.h b/contrib/binutils/ld/ldlang.h
index 8b0d492..3257959 100644
--- a/contrib/binutils/ld/ldlang.h
+++ b/contrib/binutils/ld/ldlang.h
@@ -155,7 +155,10 @@ typedef struct lang_output_section_statement_struct
enum section_type sectype;
unsigned int processed : 1;
unsigned int all_input_readonly : 1;
+ /* If this section should be ignored. */
unsigned int ignored : 1;
+ /* If there is a symbol relative to this section. */
+ unsigned int section_relative_symbol : 1;
} lang_output_section_statement_type;
typedef struct
OpenPOWER on IntegriCloud