summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--contrib/binutils/bfd/elf.c13
-rw-r--r--contrib/binutils/ld/ldlang.c11
-rw-r--r--contrib/binutils/ld/ldlang.h3
3 files changed, 20 insertions, 7 deletions
diff --git a/contrib/binutils/bfd/elf.c b/contrib/binutils/bfd/elf.c
index 6888880..c2ee684 100644
--- a/contrib/binutils/bfd/elf.c
+++ b/contrib/binutils/bfd/elf.c
@@ -4787,12 +4787,13 @@ assign_file_positions_except_relocs (bfd *abfd,
hdr->sh_offset = hdr->bfd_section->filepos;
else if ((hdr->sh_flags & SHF_ALLOC) != 0)
{
- ((*_bfd_error_handler)
- (_("%B: warning: allocated section `%s' not in segment"),
- abfd,
- (hdr->bfd_section == NULL
- ? "*unknown*"
- : hdr->bfd_section->name)));
+ if (hdr->sh_size != 0)
+ ((*_bfd_error_handler)
+ (_("%B: warning: allocated section `%s' not in segment"),
+ abfd,
+ (hdr->bfd_section == NULL
+ ? "*unknown*"
+ : hdr->bfd_section->name)));
if ((abfd->flags & D_PAGED) != 0)
off += vma_page_aligned_bias (hdr->sh_addr, off,
bed->maxpagesize);
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