From 74f03a0ed2fed504f037711aee75dd1a00d15b17 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 9 Feb 2024 12:13:13 +1030 Subject: 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. --- bfd/xcofflink.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'bfd') diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c index 6ef9abc..49ac8ef 100644 --- a/bfd/xcofflink.c +++ b/bfd/xcofflink.c @@ -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); -- cgit v1.1