public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PR 14962 testcase xcoff failure
@ 2024-02-09  2:26 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2024-02-09  2:26 UTC (permalink / raw)
  To: binutils

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.

diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c
index 6ef9abcd883..49ac8efd1e8 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);

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-09  2:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-09  2:26 PR 14962 testcase xcoff failure Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).