Browse Source

* fixed r27320 for darwin, as its mangled names get prefixed with '_'
and hence the generated mangled name did not start with a '$' as
expected

git-svn-id: trunk@27357 -

Jonas Maebe 11 năm trước cách đây
mục cha
commit
0edb7b2288
1 tập tin đã thay đổi với 11 bổ sung1 xóa
  1. 11 1
      compiler/ninl.pas

+ 11 - 1
compiler/ninl.pas

@@ -392,7 +392,17 @@ implementation
               not (def.typ in [arraydef,recorddef,variantdef,objectdef,procvardef]) or
               ((def.typ=objectdef) and not is_object(def)) then
             internalerror(201202101);
-          defaultname:=make_mangledname('$zero',def.owner,def.typesym.Name);
+          { extra '$' prefix because on darwin the result of makemangledname
+            is prefixed by '_' and hence adding a '$' at the start of the
+            prefix passed to makemangledname doesn't help (the whole point of
+            the copy() operation below is to ensure that the id does not start
+            with a '$', because that is interpreted specially by the symtable
+            routines -- that's also why we prefix with '$_', so it will still
+            work if make_mangledname() would somehow return a name that already
+            starts with '$' }
+          defaultname:='$_'+make_mangledname('zero',def.owner,def.typesym.Name);
+          { can't hardcode the position of the '$', e.g. on darwin an underscore
+            is added }
           hashedid.id:=copy(defaultname,2,255);
           { the default sym is always part of the current procedure/function }
           srsymtable:=current_procinfo.procdef.localst;