From 6334ea16abab84bc6c8c74604a474a09864fcbdf Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Thu, 15 Oct 2020 00:11:13 +0300 Subject: [PATCH] travis: add cofftest Lets run it as win32 since they are sharing backends in most places but win32 is a way more widely used. Signed-off-by: Cyrill Gorcunov --- travis/test/cofftest.asm | 85 +++++++++++++++++++++++++++++++++++++ travis/test/cofftest.json | 12 ++++++ travis/test/cofftest.obj.t | Bin 0 -> 791 bytes 3 files changed, 97 insertions(+) create mode 100644 travis/test/cofftest.asm create mode 100644 travis/test/cofftest.json create mode 100644 travis/test/cofftest.obj.t diff --git a/travis/test/cofftest.asm b/travis/test/cofftest.asm new file mode 100644 index 000000000..6b845e2ee --- /dev/null +++ b/travis/test/cofftest.asm @@ -0,0 +1,85 @@ +;Cannot be automatically tested because it differs every time, +;I guess because of a date/time field. + +; test source file for assembling to COFF +; build with (under DJGPP, for example): +; nasm -f coff cofftest.asm +; gcc -o cofftest cofftest.c cofftest.o + +; This file should test the following: +; [1] Define and export a global text-section symbol +; [2] Define and export a global data-section symbol +; [3] Define and export a global BSS-section symbol +; [4] Define a non-global text-section symbol +; [5] Define a non-global data-section symbol +; [6] Define a non-global BSS-section symbol +; [7] Define a COMMON symbol +; [8] Define a NASM local label +; [9] Reference a NASM local label +; [10] Import an external symbol +; [11] Make a PC-relative call to an external symbol +; [12] Reference a text-section symbol in the text section +; [13] Reference a data-section symbol in the text section +; [14] Reference a BSS-section symbol in the text section +; [15] Reference a text-section symbol in the data section +; [16] Reference a data-section symbol in the data section +; [17] Reference a BSS-section symbol in the data section + + BITS 32 + GLOBAL _lrotate ; [1] + GLOBAL _greet ; [1] + GLOBAL _asmstr ; [2] + GLOBAL _textptr ; [2] + GLOBAL _selfptr ; [2] + GLOBAL _integer ; [3] + EXTERN _printf ; [10] + COMMON _commvar 4 ; [7] + + SECTION .text + +; prototype: long lrotate(long x, int num); +_lrotate: ; [1] + push ebp + mov ebp,esp + mov eax,[ebp+8] + mov ecx,[ebp+12] +.label rol eax,1 ; [4] [8] + loop .label ; [9] [12] + mov esp,ebp + pop ebp + ret + +; prototype: void greet(void); +_greet mov eax,[_integer] ; [14] + inc eax + mov [localint],eax ; [14] + push dword [_commvar] + mov eax,[localptr] ; [13] + push dword [eax] + push dword [_integer] ; [1] [14] + push dword _printfstr ; [13] + call _printf ; [11] + add esp,16 + ret + + SECTION .data + +; a string +_asmstr db 'hello, world', 0 ; [2] + +; a string for Printf +_printfstr db "integer==%d, localint==%d, commvar=%d" + db 10, 0 + +; some pointers +localptr dd localint ; [5] [17] +_textptr dd _greet ; [15] +_selfptr dd _selfptr ; [16] + + SECTION .bss + +; an integer +_integer resd 1 ; [3] + +; a local integer +localint resd 1 ; [6] diff --git a/travis/test/cofftest.json b/travis/test/cofftest.json new file mode 100644 index 000000000..ec0170b70 --- /dev/null +++ b/travis/test/cofftest.json @@ -0,0 +1,12 @@ +[ + { + "description": "Test coff format", + "id": "cofftest", + "format": "win32", + "source": "cofftest.asm", + "option": "-Ox", + "target": [ + { "output": "cofftest.obj" } + ] + } +] diff --git a/travis/test/cofftest.obj.t b/travis/test/cofftest.obj.t new file mode 100644 index 0000000000000000000000000000000000000000..54c267c0d01c3ba8c1f06495acb97728beb851ea GIT binary patch literal 791 zcmZWny-EW?5T474#-R9%SV=&vl*<(g76z`dQ?#*^bCc}Fz{U%EYqS)sLVStfiwN3S z`U-+z;UkD~zTHa153H{USY}wubb1jq zgb@~TCgNp*>zuGcP&uOTDX3+c1#(lI408XD^Uiu7{ljAac<$}#{k!*d{ye~D^f<+K zxCei*3paGZybSafecgi=Z zRt;)h8QGM&THR{wlvP?6iV+vp({{TnH1Cvb-6cMKz>5A{7yIlLYy{lh9V9I!IfDEQ ziJD$eFe{~b zko)l|?r5Gd8CNP$oR5kLAdD!T8e!}p=nx&a3BjT5nc}9FlIwyOmlKPuof(Z(d%~Ss z;Rw%Yry$F5$7rzVkQiT)krA7GdnQ%F2v|i9Bl$aVU^ytbI*g)cJ3B>*6eb8m^x`JP Q-xy62C{dGYG(5We1;n9um;e9( literal 0 HcmV?d00001