aboutsummaryrefslogtreecommitdiff
path: root/ld/ldexp.c
diff options
context:
space:
mode:
authorNick Bowler <nbowler@draconx.ca>2019-03-06 15:20:29 +0000
committerNick Clifton <nickc@redhat.com>2019-03-06 15:20:29 +0000
commit912ebfa0d748b4a762dbc4311364c38692c7f626 (patch)
treed0fe417e8140a11e1c6fa67390a9829e36a3b2f2 /ld/ldexp.c
parent67a3048c0fe804ab1e36d4074e7fd2dadeb8bc0b (diff)
downloadgdb-912ebfa0d748b4a762dbc4311364c38692c7f626.zip
gdb-912ebfa0d748b4a762dbc4311364c38692c7f626.tar.gz
gdb-912ebfa0d748b4a762dbc4311364c38692c7f626.tar.bz2
Allow the use of the ORIGIN and LENGTH attributes in expressions inside MEMORY regions.
PR 24289 * ldexp.c (fold_name): Allow lookups of the LENGTH and ORIGIN attributes during the first phase.
Diffstat (limited to 'ld/ldexp.c')
-rw-r--r--ld/ldexp.c44
1 files changed, 20 insertions, 24 deletions
diff --git a/ld/ldexp.c b/ld/ldexp.c
index 60b17ef..daf0f2e 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -864,34 +864,30 @@ fold_name (etree_type *tree)
case LENGTH:
{
- if (expld.phase != lang_first_phase_enum)
- {
- lang_memory_region_type *mem;
-
- mem = lang_memory_region_lookup (tree->name.name, FALSE);
- if (mem != NULL)
- new_number (mem->length);
- else
- einfo (_("%F%P:%pS: undefined MEMORY region `%s'"
- " referenced in expression\n"),
- tree, tree->name.name);
- }
+ lang_memory_region_type *mem;
+
+ mem = lang_memory_region_lookup (tree->name.name, FALSE);
+ if (mem != NULL)
+ new_number (mem->length);
+ else
+ einfo (_("%F%P:%pS: undefined MEMORY region `%s'"
+ " referenced in expression\n"),
+ tree, tree->name.name);
}
break;
case ORIGIN:
- if (expld.phase != lang_first_phase_enum)
- {
- lang_memory_region_type *mem;
-
- mem = lang_memory_region_lookup (tree->name.name, FALSE);
- if (mem != NULL)
- new_rel_from_abs (mem->origin);
- else
- einfo (_("%F%P:%pS: undefined MEMORY region `%s'"
- " referenced in expression\n"),
- tree, tree->name.name);
- }
+ {
+ lang_memory_region_type *mem;
+
+ mem = lang_memory_region_lookup (tree->name.name, FALSE);
+ if (mem != NULL)
+ new_rel_from_abs (mem->origin);
+ else
+ einfo (_("%F%P:%pS: undefined MEMORY region `%s'"
+ " referenced in expression\n"),
+ tree, tree->name.name);
+ }
break;
case CONSTANT: