Commit graph

350 commits

Author SHA1 Message Date
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
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
Peter Johnson
2cd3bb50e2
elf.c: Fix NULL deref on bad xsize expression (#234) 2023-06-30 08:08:55 -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
kalebskeithley
0799f381d5
Update elf-objfmt.c (#148) 2023-05-12 21:15:02 -07:00
liuxiang88
bfe1bc257d
Add EM for loongarch (#192) 2023-05-12 21:08:50 -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
Denis Denisov
bd283fe523
Revert optimizations added in #68 (#146) 2020-05-03 23:36:45 -07:00
mostynb
e256985c49 avoid 'return value of ftruncate ignored' warnings (#76) 2017-09-23 15:14:23 -07:00
Matt Oliver
7418458622 fix memory errors when using gas processor with coff object output. 2017-09-23 15:11:49 -07:00
Peter Johnson
bf8411efa8 Merge pull request #68 from jix/master
Optimization and improved @jix
2015-01-01 21:51:00 -08: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
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
c3aa2478c6 Unbreak distcheck. 2013-06-21 10:03:05 -07:00
Peter Johnson
1db998a3d3 Add support for "function" decorator in win32/win64.
This can be used on global directives (e.g. global _foo:function) to
indicate the global is a function.  This is useful for incremental
linking in MSVC.
2012-10-19 17:25:27 -07:00
H.J. Lu
510c8dd7e6 Add support for x32
X32 is a 32-bit psABI for x86-64 with 32-bit pointer size.  More info
can be found at:

https://sites.google.com/site/x32abi/
2012-08-30 23:47:41 -07:00
Jannis Harder
c02c6c72d0 Interpret vstart as linear address
Changed segment:offset calculations so that vstart = 16*segment +
offset and vseg = segment instead of vstart = offset. Without this the
existing code to infer vstart addresses is not useful.
2012-08-01 15:32:21 +02:00
Jannis Harder
15e9012b77 Generate segmented addresses for labels
- Labels defined inside sections with vseg have segment:offset
  addresses
- The section.<section name>.vstart label has a segment:offset
  address
2012-08-01 15:32:21 +02:00
Jannis Harder
aaea0fc138 Add segments to label addresses
Generate addresses with a segment part for labels inside a section
with a defined vseg
2012-08-01 15:32:21 +02:00
Jannis Harder
d36aecd48c squashme 2012-08-01 15:30:50 +02:00
Jannis Harder
8da658af79 Overrides and dummy value finalization for bin
- Added support for overriding certain functions
- Override value_finalize with dummy function for the bin objfmt
2012-07-31 13:01:22 +02:00
Jannis Harder
90a8e215d6 Add vseg section option
- Added vseg and ivseg to bin_section_data
- Parsing of vseg option as expression
- Conversion to integer ivsg
- Output of vseg in mapfiles
2012-07-31 13:01:15 +02:00
Scott Graham
51b1f7ef98 fix a couple warnings when building on win32 2012-05-09 20:48:16 -07:00
Nico Weber
203bc94f39 Don't use a C++ comment in a C source file. 2012-03-10 22:52:34 -08:00
Nico Weber
01ab853e68 In the Mach-O writer, only warn on ignored flags if the new flags
are different from the old flags.

Fixes http://tortall.lighthouseapp.com/projects/78676-yasm/tickets/246
2012-03-06 17:40:41 -08:00
Peter Johnson
b334347286 win64: Default to nobase for .xdata section.
Also add ..imagebase special symbol to force use of a nobase relocation.

[#135 state:resolved]
2011-10-30 22:21:57 -07:00
Peter Johnson
e11ea9df14 Add missing macho32-pext test case. 2011-09-03 21:18:08 -07:00
Peter Johnson
7d58243134 macho: Support N_PEXT bit.
Can be enabled via use of "private_extern" in NASM syntax.

Patch by: Hironori Bono

[#215 state:resolved]
2011-08-27 10:01:26 -07:00
Peter Johnson
94ab1135a3 Remove $Id$ and RCSID() usage.
These are useless now that we're using git.
2011-08-19 10:43:16 -07:00
Peter Johnson
502eebd339 Fix const warning in elf_machine_ssym usage.
Reported by: Pierre Muller

[#237 state:resolved]
2011-08-19 10:21:10 -07:00
Peter Johnson
d8d1a5ad90 win64-except.c: Fix incorrect dereference.
Reported by: Pierre Muller

[#236 state:resolved]
2011-08-19 10:14:31 -07:00
Peter Johnson
de38127f1c Fix "times" relocation handling.
Previously a line such as "times 4 mov rax, [rel foobar]" would result
in incorrect relocations being generated.

Patch by: bird-yasm@anduin.net

[#211 state:resolved]
2011-06-25 23:32:22 -07:00
Peter Johnson
bafc905860 coff: Add support for gas .secrel32 directive.
svn path=/trunk/yasm/; revision=2365
2010-08-18 06:23:30 +00:00
Peter Johnson
2f82e3a7ba coff dir_def(): Use symtab_use() instead of symtab_get().
svn path=/trunk/yasm/; revision=2361
2010-08-17 05:36:18 +00:00
Peter Johnson
5fb3213be3 coff/win32/win64: Add support for .def, .scl, .type, and .endef directives.
These can be used to set a specific value for the coff sclass and type
symbol fields.

svn path=/trunk/yasm/; revision=2360
2010-08-17 05:32:46 +00:00
Peter Johnson
a0a5404f14 win32: Make external safeseh work again (broken in [2343]).
svn path=/trunk/yasm/; revision=2347
2010-08-01 17:31:12 +00:00
Peter Johnson
abaf3f7d49 macho32: Correctly output pc-relative non-external intersegment.
Reported by: Justin Lebar <justin.lebar@gmail.com>

svn path=/trunk/yasm/; revision=2345
2010-08-01 01:27:40 +00:00
Peter Johnson
a4024ab0ca macho: Fix relocation table file location.
svn path=/trunk/yasm/; revision=2344
2010-08-01 01:05:04 +00:00
Peter Johnson
86534657f2 Fix #139: Fix a number of issues with win32 safeseh support.
- Always create a non-global absolute symbol @feat.00 with value of 1.
- Set type field to 0x20 (function) for safeseh-declared symbols.
- Force safeseh-declared symbols into the symbol table, but don't force
  them to be global.

svn path=/trunk/yasm/; revision=2343
2010-07-31 10:17:05 +00:00
Peter Johnson
472838271c Fix #212: Set LC_SEGMENT vmsize correctly.
svn path=/trunk/yasm/; revision=2338
2010-07-23 03:08:24 +00:00
Peter Johnson
d5ae195703 Fix #202 (incorrect GOT offset generated in NASM mode).
Don't generate an additional offset for _GLOBAL_OFFSET_TABLE_ if a WRT was
specified (the NASM usage).  In GAS, _GLOBAL_OFFSET_TABLE_ doesn't have a WRT
but instead has special handling.

This isn't quite *exactly* the right fix; a better fix would be to recognize
the _GLOBAL_OFFSET_TABLE_ case in the GAS parser and adjust the value
appropriately there.  However, this fix seems to do the right thing in the
meantime for both GAS and NASM cases.

svn path=/trunk/yasm/; revision=2321
2010-05-15 07:45:48 +00:00
Peter Johnson
323153d55a Instead of initializing unknown sections en-masse during objfmt_output(),
add new objfmt interface function init_new_section() to initialize as we
go.

This fixes several issues, primarily with debug formats that create sections.

Reported by: Brian Gladman

svn path=/trunk/yasm/; revision=2310
2010-03-28 19:28:54 +00:00
Peter Johnson
d61b43941d Allow gas flags input to bin objfmt (ignored and not used).
Contributed by: Alexei Svitkine

svn path=/trunk/yasm/; revision=2275
2010-01-14 08:24:13 +00:00
Peter Johnson
c30e4abfd3 Update autoconf/automake scripts.
Also remove ltmain.sh as we no longer use libtool.

Patch submitted by: Roumen Petrov <bugtrack@roumenpetrov.info>

svn path=/trunk/yasm/; revision=2269
2010-01-07 07:00:05 +00:00
Peter Johnson
8500270339 bin-objfmt.c: Comment out unused function (kept in the code for debugging).
svn path=/trunk/yasm/; revision=2263
2010-01-03 02:47:28 +00:00
Peter Johnson
5501768adb Use queue.h HEAD macros more portably (also avoiding compiler warning).
svn path=/trunk/yasm/; revision=2258
2010-01-03 01:04:18 +00:00