From 52c5a0932d2fd596c5872f4e668212233f08e93e Mon Sep 17 00:00:00 2001
From: Sven/Sarah Barth <pascaldragon@gmail.com>
Date: Fri, 7 Jun 2024 15:14:01 +0200
Subject: [PATCH] * allow the COMDAT selection to be 0 in which case we'll
 simply assume that we don't have a COMDAT section (but we'll nevertheless
 look up a potentially associative section)

---
 compiler/ogcoff.pas | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/compiler/ogcoff.pas b/compiler/ogcoff.pas
index bca163ec8e..f3a48d42db 100644
--- a/compiler/ogcoff.pas
+++ b/compiler/ogcoff.pas
@@ -2577,7 +2577,11 @@ const pemagic : array[0..3] of byte = (
                       comdatsel:=oscs_largest;
                     else begin
                       comdatsel:=oscs_none;
-                      Message2(link_e_comdat_select_unsupported,inttostr(secrec.select),objsym.objsection.name);
+                      { there are object files out here that have comdat symbols
+                        including an associative section, but with a comdat selection
+                        of 0; it seems that other linkers just ignore those... }
+                      if secrec.select<>0 then
+                        Message2(link_e_comdat_select_unsupported,inttostr(secrec.select),objsym.objsection.name);
                     end;
                   end;