Browse Source

+ support for emitting weak symbols with the high level typed constant builder

git-svn-id: trunk@32883 -
Jonas Maebe 9 years ago
parent
commit
53bf43983a
2 changed files with 8 additions and 1 deletions
  1. 6 1
      compiler/aasmcnst.pas
  2. 2 0
      compiler/llvm/agllvm.pas

+ 6 - 1
compiler/aasmcnst.pas

@@ -126,7 +126,9 @@ type
      { item in the above list }
      tcalo_vectorized_dead_strip_item,
      { end of the above list }
-     tcalo_vectorized_dead_strip_end
+     tcalo_vectorized_dead_strip_end,
+     { symbol should be weakle defined }
+     tcalo_weak
    );
    ttcasmlistoptions = set of ttcasmlistoption;
 
@@ -941,6 +943,9 @@ implementation
            prelist.concat(tai_symbol.Create_Global(sym,0))
        else
          prelist.concat(tai_label.Create(tasmlabel(sym)));
+
+       if tcalo_weak in options then
+         prelist.concat(tai_directive.Create(asd_weak_definition,sym.name));
        { insert the symbol information before the data }
        fasmlist.insertlist(prelist);
        { end of the symbol }

+ 2 - 0
compiler/llvm/agllvm.pas

@@ -988,6 +988,8 @@ implementation
                   writer.AsmWrite(' =');
                   WriteLinkageVibilityFlags(taillvmdecl(hp).namesym.bind);
                   writer.AsmWrite(' ');
+                  if ldf_weak in taillvmdecl(hp).flags then
+                    writer.AsmWrite('weak ');
                   if (ldf_tls in taillvmdecl(hp).flags) then
                     writer.AsmWrite('thread_local ');
                   if ldf_unnamed_addr in taillvmdecl(hp).flags then