Răsfoiți Sursa

* objcprotocol symbols have to be weak in the non-fragile abi to prevent
conflicts in case a protocol is adopted by classes in multiple object
files part of the same binary (mantis #20875)

git-svn-id: trunk@19865 -

Jonas Maebe 13 ani în urmă
părinte
comite
40a9762ac6

+ 3 - 0
.gitattributes

@@ -9734,7 +9734,10 @@ tests/test/packages/cocoaint/tobjc33a.pp svneol=native#text/plain
 tests/test/packages/cocoaint/tobjcnh1.pp svneol=native#text/plain
 tests/test/packages/cocoaint/tvarpara.pp svneol=native#text/plain
 tests/test/packages/cocoaint/tw16329.pp svneol=native#text/plain
+tests/test/packages/cocoaint/tw20875.pp svneol=native#text/plain
 tests/test/packages/cocoaint/tw20876.pp svneol=native#text/plain
+tests/test/packages/cocoaint/uw20875a.pp svneol=native#text/plain
+tests/test/packages/cocoaint/uw20875b.pp svneol=native#text/plain
 tests/test/packages/fcl-base/tascii85.pp svneol=native#text/plain
 tests/test/packages/fcl-base/tgettext1.pp svneol=native#text/plain
 tests/test/packages/fcl-db/assertions.pas svneol=native#text/plain

+ 1 - 0
compiler/objcgutl.pas

@@ -1123,6 +1123,7 @@ procedure tobjcrttiwriter_nonfragile.gen_objc_protocol(list: tasmlist; protocol:
     }
     lbl:=current_asmdata.DefineAsmSymbol(protocol.rtti_mangledname(objcclassrtti),AB_PRIVATE_EXTERN,AT_DATA);
     list.Concat(tai_symbol.Create_Global(lbl,0));
+    list.Concat(tai_directive.Create(asd_weak_definition,lbl.name));
     protocollabel:=lbl;
 
     { protocol's isa - always nil }

+ 12 - 0
tests/test/packages/cocoaint/tw20875.pp

@@ -0,0 +1,12 @@
+{ %norun }
+
+program testlink;
+
+{$MODE Delphi}
+{$modeswitch ObjectiveC1}
+
+uses
+  uw20875a,uw20875b;
+  
+begin
+end.

+ 24 - 0
tests/test/packages/cocoaint/uw20875a.pp

@@ -0,0 +1,24 @@
+unit uw20875a;
+
+{$MODE Delphi}
+{$modeswitch ObjectiveC1}
+
+interface
+
+uses
+  CocoaAll;
+
+type
+  TController1 = objcclass(NSWindowController, NSWindowDelegateProtocol)
+  public
+    function init : id; override;
+  end;
+
+implementation
+
+function TController1.init : id;
+begin
+  Result := inherited init;
+end;
+
+end.

+ 24 - 0
tests/test/packages/cocoaint/uw20875b.pp

@@ -0,0 +1,24 @@
+unit uw20875b;
+
+{$MODE Delphi}
+{$modeswitch ObjectiveC1}
+
+interface
+
+uses
+  CocoaAll;
+
+type
+  TController2 = objcclass(NSWindowController, NSWindowDelegateProtocol)
+  public
+    function init : id; override;
+  end;
+
+implementation
+
+function TController2.init : id;
+begin
+  Result := inherited init;
+end;
+
+end.