Build assembly files with AMBuild. (#481)

* Remove prebuilt nasm-generated object files from the tree, and use AMBuild to compile them.

* Add commands in VS project to build the object files

* Rename elf to elf32 for consistency
This commit is contained in:
David Anderson
2018-08-26 11:28:25 -07:00
committed by Vincent Herbet
parent 9bcabfeb1f
commit 46d1ef68bd
21 changed files with 127 additions and 32 deletions

View File

@ -9,36 +9,25 @@ binary.compiler.defines += [
'HAVE_STDINT_H',
]
AMXX.AddAssembly(builder, binary, 'helpers-x86.asm', 'helpers-asm.obj')
AMXX.AddAssembly(builder, binary, 'natives-x86.asm', 'natives-asm.obj')
AMXX.AddAssembly(builder, binary, 'amxexecn.asm', 'amxexecn-asm.obj',
includes=['amxdefn.asm'])
AMXX.AddAssembly(builder, binary, 'amxjitsn.asm', 'amxjitsn-asm.obj',
includes=['amxdefn.asm'],
# Opcode sizes must be maximum width for patching to work.
extra_argv=['-O0'])
if builder.target_platform == 'mac':
jit_objects = [
binary.Dep('JIT/amxexecn-darwin.o'),
binary.Dep('JIT/amxjitsn-darwin.o'),
binary.Dep('JIT/natives-darwin-x86.o'),
binary.Dep('JIT/helpers-darwin-x86.o'),
]
binary.compiler.postlink += [
'-Wl,-read_only_relocs,suppress'
]
elif builder.target_platform == 'linux':
jit_objects = [
binary.Dep('JIT/amxexecn.o'),
binary.Dep('JIT/amxjitsn.o'),
binary.Dep('JIT/natives-x86.o'),
binary.Dep('JIT/helpers-x86.o'),
]
elif builder.target_platform == 'windows':
jit_objects = [
binary.Dep('JIT/amxexecn.obj'),
binary.Dep('JIT/amxjitsn.obj'),
binary.Dep('JIT/helpers-x86.obj'),
binary.Dep('JIT/natives-x86.obj'),
]
binary.compiler.linkflags += [
'/EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1',
'/SECTION:.data,RW',
]
binary.compiler.linkflags += jit_objects
binary.compiler.linkflags += [AMXX.zlib.binary, AMXX.hashing.binary, AMXX.utf8rewind.binary]
binary.sources = [

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -96,6 +96,14 @@
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<SpecifySectionAttributes>.data,RW</SpecifySectionAttributes>
</Link>
<PreBuildEvent>
<Command>cd ..
md -p JIT 2&gt;NUL
%NASM_PATH%nasm.exe -f win32 helpers-x86.asm -o JIT/helpers-x86.obj
%NASM_PATH%nasm.exe -f win32 natives-x86.asm -o JIT/natives-x86.obj
%NASM_PATH%nasm.exe -f win32 amxexecn.asm -o JIT/amxexecn.obj
%NASM_PATH%nasm.exe -O0 -f win32 amxjitsn.asm -o JIT/amxjitsn.obj</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='JITRelease|Win32'">
<Midl>
@ -148,6 +156,14 @@
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<SpecifySectionAttributes>.data,RW</SpecifySectionAttributes>
</Link>
<PreBuildEvent>
<Command>cd ..
md -p JIT 2&gt;NUL
%NASM_PATH%nasm.exe -f win32 helpers-x86.asm -o JIT/helpers-x86.obj
%NASM_PATH%nasm.exe -f win32 natives-x86.asm -o JIT/natives-x86.obj
%NASM_PATH%nasm.exe -f win32 amxexecn.asm -o JIT/amxexecn.obj
%NASM_PATH%nasm.exe -O0 -f win32 amxjitsn.asm -o JIT/amxjitsn.obj</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\public\memtools\CDetour\asm\asm.c" />
@ -474,4 +490,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>