Jelajahi Sumber

* fixes for nasm writer, resolves #38074
+ test

git-svn-id: trunk@47413 -

florian 4 tahun lalu
induk
melakukan
bf7961a901
3 mengubah file dengan 28 tambahan dan 4 penghapusan
  1. 1 0
      .gitattributes
  2. 11 4
      compiler/x86/agx86nsm.pas
  3. 16 0
      tests/webtbs/tw38074.pp

+ 1 - 0
.gitattributes

@@ -18529,6 +18529,7 @@ tests/webtbs/tw38022.pp svneol=native#text/pascal
 tests/webtbs/tw3805.pp svneol=native#text/plain
 tests/webtbs/tw38051.pp svneol=native#text/pascal
 tests/webtbs/tw38054.pp svneol=native#text/plain
+tests/webtbs/tw38074.pp svneol=native#text/pascal
 tests/webtbs/tw3814.pp svneol=native#text/plain
 tests/webtbs/tw3827.pp svneol=native#text/plain
 tests/webtbs/tw3829.pp svneol=native#text/plain

+ 11 - 4
compiler/x86/agx86nsm.pas

@@ -390,7 +390,7 @@ interface
             begin
               if (ops=1) and (opcode<>A_RET) then
                writer.AsmWrite(sizestr(s,dest));
-              writer.AsmWrite(tostr(longint(o.val)));
+              writer.AsmWrite(tostr(o.val));
             end;
           top_ref :
             begin
@@ -634,8 +634,14 @@ interface
         if target_info.system in systems_darwin then
           writer.AsmWrite(':private_extern')
         else
-          { no colon }
-          writer.AsmWrite(' hidden')
+          case sym.typ of
+            AT_FUNCTION:
+              writer.AsmWrite(':function hidden');
+            AT_DATA:
+              writer.AsmWrite(':data hidden');
+            else
+              Internalerror(2020111301);
+          end;
       end;
 
     procedure TX86NasmAssembler.ResetSectionsList;
@@ -1000,9 +1006,10 @@ interface
                if tai_symbol(hp).is_global or SmartAsm then
                 begin
                   writer.AsmWrite(#9'GLOBAL ');
-                  writer.AsmWriteLn(ApplyAsmSymbolRestrictions(tai_symbol(hp).sym.name));
+                  writer.AsmWrite(ApplyAsmSymbolRestrictions(tai_symbol(hp).sym.name));
                   if tai_symbol(hp).sym.bind=AB_PRIVATE_EXTERN then
                     WriteHiddenSymbolAttribute(tai_symbol(hp).sym);
+                  writer.AsmLn;
                 end;
                writer.AsmWrite(ApplyAsmSymbolRestrictions(tai_symbol(hp).sym.name));
                if SmartAsm then

+ 16 - 0
tests/webtbs/tw38074.pp

@@ -0,0 +1,16 @@
+{ %cpu=x86_64 }
+{ %opt=Anasm}
+{$ASMMODE INTEL}
+const
+  value : int64 =$1234567898765432;
+
+function Test:Int64;assembler;
+asm
+  mov RAX, $1234567898765432
+end;
+
+begin
+  if Test<>value then
+    halt(1);
+  writeln('ok');
+end.