Commit graph

1142 commits

Author SHA1 Message Date
Anonymous Maarten
8c717107dd
Emit an error when seeing an invalid condition code in a macro (nasm mode) (#316)
Some checks failed
Build / Build - Ubuntu (push) Failing after 4s
Build / Build - MSVC (push) Has been cancelled
Build / Build - macOS (push) Has been cancelled
make-check: check .errwarn file first if yasm failed
2026-07-28 17:44:34 -07:00
Anonymous Maarten
d196fb3cb9
Fix -Wtautological-compare warning (self-comparison always evaluates to true) (#312) 2026-07-25 09:59:44 -05:00
Anonymous Maarten
baceff9d12
Fix -Wdeclaration-after-statement warning (ISO C90 forbids mixed declarations and code) (#313) 2026-07-25 09:58:34 -05:00
Anonymous Maarten
7a7762c337
cmake: support CMake 4.0 and cross building (#307) 2026-07-20 22:36:19 -07:00
Anonymous Maarten
baa3b160ce
Don't output absolute output path in binfmt mapfile for tests (#305) 2026-07-20 22:31:42 -07:00
Anonymous Maarten
430e4f55c0
subminor of a macho buildversion is optional (#304)
This fixes a difference in behavior between yasm built by autotools and cmake (due to different compile flags)
2026-07-20 22:30:44 -07:00
Anonymous Maarten
3199a84f0c
Ensure all reference hex files have trailing spaces (#303) 2026-07-20 22:29:56 -07:00
Anonymous Maarten
1f09fa089d
cmake: register all modules in yasm_init_plugin (#301)
Some modules were not registered when dynamically loading yasmstd.
2026-07-20 22:29:03 -07:00
Yao Zi
a2f8bdf075 dwarf2: Correctly initialize dwarf2_line_info.errwarns
Forgetting to this causes unexpected control flow transfers and even
misoptimizations. When building with LLVM 20.1.4 and LTO enabled,
misoptimizations will ultimately lead to segfaults in
dwarf2_gen64_test.sh.

Signed-off-by: Yao Zi <ziyao@disroot.org>
2026-01-03 16:18:40 -08:00
jca
b9c3fe6399 Add support for endbr32/endbr64 (#156) 2026-01-03 13:46:44 -08:00
jca
e2c133fe29 Add support for four bytes instructions 2026-01-03 13:46:44 -08:00
dataisland
ecb47f1c87
Fix handle_dot_label heap-out-of-bound (#243) 2023-09-21 22:21:10 -07:00
Andrei Karas
721134a8ae
Fix memory leak if masm mode enabled in parsers (#239) 2023-09-21 22:04:09 -07:00
Andrei Karas
dfc1c9e841
Fix access field adress on null pointer in x86bc.c (#238) 2023-09-12 15:21:23 -07:00
Peter Johnson
2cd3bb50e2
elf.c: Fix NULL deref on bad xsize expression (#234) 2023-06-30 08:08:55 -07:00
PoroCYon
4dc8c3bf03
Add support for NASM %warning preprocessor directive (#232)
Regular NASM supports this, while Yasm doesn't seem to. This fixes the
discrepancy.
2023-06-17 23:44:01 -07:00
Katsuhiko Gondow
b2cc5a1693
Fix memory leak in bin-objfmt (#231) 2023-06-12 13:00:47 -07:00
Biswapriyo Nath
f79f5e37f0
Fix function declaration warnings with clang (#226)
This fixes the following compiler warnings with clang

tools/genperf/perfect.c:65:6: warning: a function definition without a prototype
is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]

frontends/yasm/yasm.c:1379:23: warning: a function declaration without a prototype
is deprecated in all versions of C [-Wstrict-prototypes]

modules/objfmts/elf/elf.c:225:18: warning: a function declaration without a prototype
is deprecated in all versions of C [-Wstrict-prototypes]
2023-05-17 15:23:32 -07:00
Ulya Trofimovich
811f24d0bf
GAS preprocessor: don't cut comments inside of string literals. (#81) 2023-05-12 21:23:13 -07:00
bird2tori
241bf4c42c
More makedep features (#80)
yasm.c: Added -MD, -MT and -MP options similar to gcc. Also added --makedep-dos2unix-slash for helping users of NUG make (and similar) on Windows. The -MD option does both assembling and Makefile dependency generation in one go, which convenient and a little quicker.

nasm-preproc.c: Have to always gather dependencies to support -MD. Minimal cost.

Co-authored-by: knut st. osmundsen <bird-skylake@anduin.net>
2023-05-12 21:22:36 -07:00
Duncan Ogilvie
8b6c7b237c
Fix allocator mismatch (#107) 2023-05-12 21:19:37 -07:00
Kaz Wesley
8a87860db7
Enable AES on westmere (#97)
Prior to this change: cpu_lcd(['AVX'], ['AVX','AES']) == ['AVX'],
causing AES instructions to be treated as unsupported when "cpu
WESTMERE" is used, or even "cpu WESTMERE AES".

Fixed by reordering ordered_cpu_features such that now,
cpu_lcd(['AVX'], ['AVX','AES']) == ['AES']. I don't know if there are
CPUs this would not be correct for, but this is the value that's
consistent with all extant CPU definitions.
2023-05-12 21:18:15 -07:00
Peter Meerwald-Stadler
f2f9f157df
Allow sha256rnds2 to have memory as 2nd operand (#108) 2023-05-12 21:17:09 -07:00
squidcc
3bbfd9d8f9
Fix 128-bit variant of VPBLENDVB incorrectly marked as AVX2 instead of AVX (#112) 2023-05-12 21:16:26 -07:00
kalebskeithley
0799f381d5
Update elf-objfmt.c (#148) 2023-05-12 21:15:02 -07:00
Fighter19
529c14bfdc
Fix badly freed pointer on indented code block after rept (#189) 2023-05-12 21:13:44 -07:00
cryptobro
fa9e004383
gas preproc: Fix UB/crashes (#186) 2023-05-12 21:12:54 -07:00
Peter Meerwald-Stadler
93a960bc7d
Fix memleak of codeview leaf (#114) 2023-05-12 21:10:17 -07:00
liuxiang88
bfe1bc257d
Add EM for loongarch (#192) 2023-05-12 21:08:50 -07:00
Biswapriyo Nath
a277a590f0
Fix detecting Windows platform (#204)
This replaces _MSC_VER macro with _WIN32 because the
former one is for MSVC and Visual Studio only and is
not defined in mingw environment. Wherease, _WIN32
macro is the proper way to check Windows platform
irrespective of compiler toolchain.

See the following official link for more info
https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros
2023-05-12 21:06:53 -07:00
Peter Johnson
41762bead1
Update Mach-O for newer macOS (#180)
- Create a dummy .llvmasm section for bitcode
- Add [buildversion] directive for setting minos and sdk versions, e.g. [buildversion minos="10.14" sdk="10.14"]. This defaults to 10.5 on x64 and 10.4 on x86.
2021-07-10 12:12:45 -07:00
Peter Johnson
f01afb6b51
Fix test failures (#177)
These were caused by the addition of the segreg-in-64bit warning.
2021-07-09 13:42:53 -07:00
Denis Denisov
bd283fe523
Revert optimizations added in #68 (#146) 2020-05-03 23:36:45 -07:00
Ozkan Sezer
976d2e0934
Fix info.stab / info.stabstr typo in stabs-dbgfmt.c (#96) 2020-05-03 23:35:04 -07:00
mostynb
e256985c49 avoid 'return value of ftruncate ignored' warnings (#76) 2017-09-23 15:14:23 -07:00
Matt Oliver
6eac25ff8c allow movbe to be suffixed with wlq in gas syntax. 2017-09-23 15:11:49 -07:00
Matt Oliver
7418458622 fix memory errors when using gas processor with coff object output. 2017-09-23 15:11:49 -07:00
bird2tori
4808260d62 Leak fixes (#79)
* preproc/nasm: Close the input file; addressed a few memory leaks.

* yasm.c: delete include paths before we exit

* cv-dbgfmt.c: Free cv_filename::filename too.
2017-09-23 15:08:58 -07:00
Paul Blinzer
91d628ac60 New AMD Excavator MONITORX, MWAITX instruction support (for 32bit/64bit) (#78)
MONITORX has opcode "0F 01 FA".
rAX contains address to be monitored
ECX specifies optional extensions
EDX specifies optional hints

MWAITX has opcode "0F 01 FA".
EAX specifies optional hints
ECX specifies optional extensions

Public documentation: http://support.amd.com/TechDocs/24594.pdf

New CLZERO instruction support (for 32bit/64bit)
		* clzero has opcode "0F 01 FC".
		* clzero gets enabled with CPUID, 8000_0008, EBX[0] =1.
		* clzero instruction zero's out the 64 byte cache line specified in rAX. Bits 5:0 of rAX are ignored

Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved.
Redistributed under simplified 2-clause BSD licence
2017-09-23 15:08:03 -07:00
Peter Johnson
51af4082cc Added -Wno-segreg-in-64bit.
This allows suppressing the annoying 'segment register ignored in 64-bit mode'
warning.
2015-11-06 20:15:04 -08:00
Henrik Gramner
32ad9c46ce Support numbers prefixed with + or - in %ifnum 2015-10-17 21:50:15 +02:00
Peter Johnson
bf8411efa8 Merge pull request #68 from jix/master
Optimization and improved @jix
2015-01-01 21:51:00 -08:00
Denis Denisov
0c2d90c6b3 Fix yasm segfaults GNU assembler files on OS X
Bug: http://tortall.lighthouseapp.com/projects/78676/tickets/269
2014-11-15 23:37:54 +02:00
Peter Johnson
1910e91479 COFF/PE: Always set paddr and vaddr to 0.
It appears that GNU binutils always interpret PE/COFF object files as if
they were executable files, namely that the paddr field is a rounded-up
section size (aka virtual size).  Yasm previously followed the Microsoft
specification which stated that for object files this field should be set
to the "physical address" of the section (e.g. the sum of all previous
section sizes).  However, several other sources state this field should be
set to 0 in object files, and it appears that Microsoft tools accept this.

For compatibility with the GNU tools, this commit makes Yasm always set the
paddr/vsize field to 0.

This commit also eliminates the COFF_SET_VMA customization for COFF
files.  Previously this was used to set LMA=VMA in COFF, but LMA=0 in PE.
Now that VMA is always 0, this is no longer required (LMA=VMA=0 in both
PE and COFF).
2014-09-26 21:12:42 -07:00
Peter Johnson
4c2772c3f9 Add missing objfmt_x64 to CMakeLists.txt.
This caused cmake builds to not recognize "x64" as an object format.

Reported by: Brian Gladman
2014-09-19 00:46:15 -07:00
Peter Johnson
636dc92558 Allow building of static executables with cmake. 2014-08-10 23:18:46 -07:00
Peter Johnson
00c85278d1 Warnings cleanup. 2014-08-10 11:39:20 -07:00
Peter Johnson
86fc07b574 coff-objfmt.c: Add missing break.
[#268 state:resolved]
2014-04-13 23:00:03 -07:00
Peter Johnson
047c49b542 Add cpu ivybridge, haswell, broadwell, skylake. 2014-04-05 23:34:27 -07:00
Peter Johnson
0ca0ffc65f Add Intel ADX, RDSEED, and SMAP instructions. 2014-04-05 00:17:13 -07:00