forked from Imagelibrary/binutils-gdb
* ld.texinfo (Expression Section): Describe treatment of numbers
and absolute symbols. * ldemul.c (after_open_default): Look up __ld_compatibility. * ldexp.c (fold_name): Convert absolute symbols to numbers when inside output section definitions, or when __ld_compatibility >= 221. (exp_fold_tree_1): Convert numbers to absolute when not in output section definition and __ld_compatibility < 221. Don't always convert values outside an output section definition to absolute. * ldexp.h (uses_defined): Comment. * ldlang.c (ld_compatibility): New variable. * ldlang.h (ld_compatibility): Declare. * emultempl/aix.em, * emultempl/armcoff.em, * emultempl/beos.em, * emultempl/elf32.em, * emultempl/genelf.em, * emultempl/lnk960.em, * emultempl/m68kcoff.em, * emultempl/mmo.em, * emultempl/pe.em, * emultempl/pep.em, * emultempl/sunos.em, * emultempl/z80.em: Call after_open_default from after_open function.
This commit is contained in:
16
ld/ldexp.c
16
ld/ldexp.c
@@ -553,7 +553,9 @@ fold_name (etree_type *tree)
|
||||
" referenced in expression\n"),
|
||||
tree->name.name);
|
||||
}
|
||||
else if (output_section == bfd_abs_section_ptr)
|
||||
else if (output_section == bfd_abs_section_ptr
|
||||
&& (expld.section != bfd_abs_section_ptr
|
||||
|| ld_compatibility >= 221))
|
||||
new_number (h->u.def.value + h->u.def.section->output_offset);
|
||||
else
|
||||
new_rel (h->u.def.value + h->u.def.section->output_offset,
|
||||
@@ -700,7 +702,11 @@ exp_fold_tree_1 (etree_type *tree)
|
||||
switch (tree->type.node_class)
|
||||
{
|
||||
case etree_value:
|
||||
new_number (tree->value.value);
|
||||
if (expld.section == bfd_abs_section_ptr
|
||||
&& ld_compatibility < 221)
|
||||
new_abs (tree->value.value);
|
||||
else
|
||||
new_number (tree->value.value);
|
||||
expld.result.str = tree->value.str;
|
||||
break;
|
||||
|
||||
@@ -860,12 +866,6 @@ exp_fold_tree_1 (etree_type *tree)
|
||||
memset (&expld.result, 0, sizeof (expld.result));
|
||||
break;
|
||||
}
|
||||
|
||||
/* Any value not inside an output section statement is an
|
||||
absolute value. */
|
||||
if (expld.result.valid_p
|
||||
&& expld.section == bfd_abs_section_ptr)
|
||||
make_abs ();
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user