瀏覽代碼

* emit custom Objective-C names in the LLVM assembler writer

git-svn-id: trunk@32912 -
Jonas Maebe 9 年之前
父節點
當前提交
5959f45694
共有 1 個文件被更改,包括 15 次插入8 次删除
  1. 15 8
      compiler/llvm/agllvm.pas

+ 15 - 8
compiler/llvm/agllvm.pas

@@ -85,6 +85,7 @@ implementation
       SysUtils,
       cutils,cfileutl,
       fmodule,verbose,
+      objcasm,
       aasmcnst,symconst,symdef,symtable,
       llvmbase,aasmllvm,itllvm,llvmdef,
       cgbase,cgutils,cpubase,llvminfo;
@@ -994,8 +995,6 @@ implementation
                     writer.AsmWrite('thread_local ');
                   if ldf_unnamed_addr in taillvmdecl(hp).flags then
                     writer.AsmWrite('unnamed_addr ');
-                  { todo: handle more different section types (mainly
-                      Objective-C }
                   if taillvmdecl(hp).sec in [sec_rodata,sec_rodata_norel] then
                     writer.AsmWrite('constant ')
                   else
@@ -1023,12 +1022,20 @@ implementation
                       dec(fdecllevel);
                     end;
                   { custom section name? }
-                  if taillvmdecl(hp).sec=sec_user then
-                    begin
-                      writer.AsmWrite(', section "');
-                      writer.AsmWrite(taillvmdecl(hp).secname);
-                      writer.AsmWrite('"');
-                    end;
+                  case taillvmdecl(hp).sec of
+                    sec_user:
+                      begin
+                        writer.AsmWrite(', section "');
+                        writer.AsmWrite(taillvmdecl(hp).secname);
+                        writer.AsmWrite('"');
+                      end;
+                    low(TObjCAsmSectionType)..high(TObjCAsmSectionType):
+                      begin
+                        writer.AsmWrite(', section "');
+                        writer.AsmWrite(objc_section_name(taillvmdecl(hp).sec));
+                        writer.AsmWrite('"');
+                      end;
+                  end;
                   { alignment }
                   writer.AsmWrite(', align ');
                   writer.AsmWriteln(tostr(taillvmdecl(hp).alignment));