aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/bfd-in2.h11
-rw-r--r--bfd/linker.c15
-rw-r--r--include/ChangeLog4
-rw-r--r--include/bfdlink.h5
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/ldexp.c1
7 files changed, 46 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index d4ae7ed..008d416 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2018-07-17 Maciej W. Rozycki <macro@mips.com>
+
+ * linker.c (bfd_is_abs_symbol): New macro.
+ * bfd-in2.h: Regenerate.
+
2018-07-16 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
* elf-bfd.h (elfcore_write_ppc_tar): Add prototype.
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 93745bd..3414682 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -7802,6 +7802,17 @@ bfd_boolean bfd_set_format (bfd *abfd, bfd_format format);
const char *bfd_format_string (bfd_format format);
/* Extracted from linker.c. */
+/* Return TRUE if the symbol described by a linker hash entry H
+ is going to be absolute. Linker-script defined symbols can be
+ converted from absolute to section-relative ones late in the
+ link. Use this macro to correctly determine whether the symbol
+ will actually end up absolute in output. */
+#define bfd_is_abs_symbol(H) \
+ (((H)->type == bfd_link_hash_defined \
+ || (H)->type == bfd_link_hash_defweak) \
+ && bfd_is_abs_section ((H)->u.def.section) \
+ && !(H)->rel_from_abs)
+
bfd_boolean bfd_link_split_section (bfd *abfd, asection *sec);
#define bfd_link_split_section(abfd, sec) \
diff --git a/bfd/linker.c b/bfd/linker.c
index 6b4c8e5..9fee90d 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -484,7 +484,20 @@ _bfd_link_hash_table_init
/* Look up a symbol in a link hash table. If follow is TRUE, we
follow bfd_link_hash_indirect and bfd_link_hash_warning links to
- the real symbol. */
+ the real symbol.
+
+.{* Return TRUE if the symbol described by a linker hash entry H
+. is going to be absolute. Linker-script defined symbols can be
+. converted from absolute to section-relative ones late in the
+. link. Use this macro to correctly determine whether the symbol
+. will actually end up absolute in output. *}
+.#define bfd_is_abs_symbol(H) \
+. (((H)->type == bfd_link_hash_defined \
+. || (H)->type == bfd_link_hash_defweak) \
+. && bfd_is_abs_section ((H)->u.def.section) \
+. && !(H)->rel_from_abs)
+.
+*/
struct bfd_link_hash_entry *
bfd_link_hash_lookup (struct bfd_link_hash_table *table,
diff --git a/include/ChangeLog b/include/ChangeLog
index 035b3ca..a3b1af8 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,7 @@
+2018-07-17 Maciej W. Rozycki <macro@mips.com>
+
+ * bfdlink.h (bfd_link_hash_entry): Add `rel_from_abs' member.
+
2018-07-06 Alan Modra <amodra@gmail.com>
* diagnostics.h: Comment on macro usage.
diff --git a/include/bfdlink.h b/include/bfdlink.h
index 773407f..2491081 100644
--- a/include/bfdlink.h
+++ b/include/bfdlink.h
@@ -115,6 +115,11 @@ struct bfd_link_hash_entry
/* Symbol defined in a linker script. */
unsigned int ldscript_def : 1;
+ /* Symbol will be converted from absolute to section-relative. Set for
+ symbols defined by a script from "dot" (also SEGMENT_START or ORIGIN)
+ outside of an output section statement. */
+ unsigned int rel_from_abs : 1;
+
/* A union of information depending upon the type. */
union
{
diff --git a/ld/ChangeLog b/ld/ChangeLog
index f5af858..0a0fa15 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2018-07-17 Maciej W. Rozycki <macro@mips.com>
+
+ * ldexp.c (exp_fold_tree_1) <etree_assign, etree_provide>
+ <etree_provided>: Copy expression's `rel_from_abs' flag to the
+ link hash.
+
2018-07-12 Maciej W. Rozycki <macro@mips.com>
* testsuite/ld-mips-elf/mips-elf.exp (run_dump_test_abi)
diff --git a/ld/ldexp.c b/ld/ldexp.c
index 6fa251e..4ca812e 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -1200,6 +1200,7 @@ exp_fold_tree_1 (etree_type *tree)
h->u.def.section = expld.result.section;
h->linker_def = ! tree->assign.type.lineno;
h->ldscript_def = 1;
+ h->rel_from_abs = expld.rel_from_abs;
if (tree->assign.hidden)
bfd_link_hide_symbol (link_info.output_bfd,
&link_info, h);