PR 14962 testcase xcoff failure

Like https://sourceware.org/pipermail/binutils/2002-August/021279.html
but for symbols defined in an xcoff object but then made absolute by a
linker script.

	* xcofflink.c (xcoff_link_input_bfd): Set n_scnum correctly
	for symbols made absolute by a linker script.
This commit is contained in:
Alan Modra 2024-02-09 12:13:13 +10:30
parent ae60db705c
commit 74f03a0ed2

View File

@ -5482,7 +5482,13 @@ xcoff_link_input_bfd (struct xcoff_final_link_info *flinfo,
&& isym.n_sclass != C_DECL
&& isym.n_scnum > 0)
{
isym.n_scnum = (*csectpp)->output_section->target_index;
if (*sym_hash != NULL
&& ((*sym_hash)->root.type == bfd_link_hash_defined
|| (*sym_hash)->root.type == bfd_link_hash_defweak)
&& (*sym_hash)->root.u.def.section == bfd_abs_section_ptr)
isym.n_scnum = N_ABS;
else
isym.n_scnum = (*csectpp)->output_section->target_index;
isym.n_value += ((*csectpp)->output_section->vma
+ (*csectpp)->output_offset
- (*csectpp)->vma);