summaryrefslogtreecommitdiff
path: root/output
AgeCommit message (Collapse)AuthorFilesLines
2014-02-18outelf: Error out on "section align" without valueH. Peter Anvin1-9/+14
If someone specifies "section align" without =value, error out. Reported-by: Ilya Albrekht <ilya.albrekht@gmail.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2014-02-15BR3392274: output: Elf -- Don't crash on erronious syntaxCyrill Gorcunov1-1/+1
Elf align section attribute requires syntax "align=value", but in case if '=' is missed we pass nil pointer into atoi function which cause libc to crash. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-10-03coff: Better handling of section redefinitionMarat Dukhan1-3/+36
Currently, if we try to define an already defined section and specify section flags, NASM will output "warning: section attributes ignored on redeclaration of section %SECTIONNAME%". The patch modifies this behaviour: 1. If the previous section definition differs only in alignment flags, no warning is generated 2. If the new definition implies larger alignment, it overrides the previous section alignment 3. If the new definition specifies any section alignment, the content of the section will be aligned on the new boundary (i.e. the effect is the same as if there was ALIGN macro) Signed-off-by: Marat Dukhan <maratek@gmail.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-09-21coff: Support for section names longer than 8 bytesMarat Dukhan1-11/+52
http://bugzilla.nasm.us/show_bug.cgi?id=3392233 Signed-off-by: Marat Dukhan <maratek@gmail.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-04-01Fixed wrong format specifier in format stringPhilipp Kloke1-2/+2
Signed-off-by: Philipp Kloke <philipp.kloke@web.de> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-04-01Remove unnecessary calls to memsetPhilipp Kloke1-3/+0
The C standard guarantees that strncpy pads the string with zeros if source string is smaller than destination buffer. Signed-off-by: Philipp Kloke <philipp.kloke@web.de> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-25Fix warnings generated by clang 3.0Andrew Nayenko3-3/+3
Fix warnings like this: output/outelf32.c:2120:33: warning: equality comparison with extraneous parentheses [-Wparentheses-equality] if ((match->section == index)) { ~~~~~~~~~~~~~~~^~~~~~~~ output/outelf32.c:2120:33: note: remove extraneous parentheses around the comparison to silence this warning if ((match->section == index)) { ~ ^ ~ output/outelf32.c:2120:33: note: use '=' to turn this equality comparison into an assignment if ((match->section == index)) { ^~ = 1 warning generated. Signed-off-by: Andrew Nayenko <resver@gmail.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2012-11-28BR3392232: Fix relocations in MachO64Keith Kanios1-1/+1
Signed-off-by: Keith Kanios <keith@kanios.net> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2012-11-16output: Add more Elf unificationCyrill Gorcunov2-26/+24
One day the elf output routines would be abstracted enough to be merged in one file. This patch simply removes some differences from elf32/64 code. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2012-11-06BR3392231: Fix get_closest_section_symbol_by_offsetCyrill Gorcunov1-23/+6
This patch changes get_closest_section_symbol_by_offset logic to lookup only the closest symbols which are at or before the supplied offset. Signed-off-by: Keith Kanios <keith@kanios.net> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2012-02-03backend: add support for x32 ELFH.J. Lu3-2/+2209
Add an x32 ELF (32-bit code with the CPU in 64-bit mode) backend.
2011-08-28elf64: Make linelist to look the same as elf32Cyrill Gorcunov1-3/+3
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-08-28elf32: Drop holes in linelist structureCyrill Gorcunov1-3/+3
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-08-28outobj: Reorder Segment members to eliminate holesCyrill Gorcunov1-4/+4
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-08-28outieee: Reorder ieeeSection members to eliminate holesCyrill Gorcunov1-4/+4
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-07-17elf64: Drop unused 'zero' variableCyrill Gorcunov1-3/+1
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-04-11BR3282788: Fix 64-bit Mach-O bug that crashes NASM due to NULL symbolsKeith Kanios1-8/+26
2011-04-06Merge branch 'nasm-2.09.xx'Cyrill Gorcunov2-10/+10
Conflicts: nasm.h version Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-04-06ofmt: Alias shortname must be used for __OUTPUT_FORMAT__ macroCyrill Gorcunov2-10/+10
__OUTPUT_FORMAT__ must consist of shortname of output format or its alias, otherwise userspace ABI gets broken. For example source code still can refer to __OUTPUT_FORMAT__=elf, instead of __OUTPUT_FORMAT__=elf32. BR3246990 Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-02-28output/outbin.c: initialize section align/start attributes upon creationKeith Kanios1-0/+4
2011-02-28elf64: Use nasm_zalloc helperCyrill Gorcunov1-19/+11
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-02-28outelf32: Use nasm_zalloc helperCyrill Gorcunov1-20/+12
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-02-28outcoff: Use nasm_zalloc helperCyrill Gorcunov1-6/+1
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-02-28bin: Use nasm_zalloc for default section creationCyrill Gorcunov1-12/+7
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-02-28bin: Use nasm_zalloc helper for section allocation in a sake of simplicityCyrill Gorcunov1-25/+19
Instead of opencoded zero assignments better to use nasm_zalloc and set fields which are supposed to be non-nil. This simplifies code and makes it more readable. Also note the field 'ifollows' renamed to 'prev' as it should be from the very beginning in terms of lists. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-02-27output/outbin.c: initialize section align/start attributes upon creationKeith Kanios1-0/+4
2010-11-20coff: Handle massive relocationsCyrill Gorcunov2-3/+44
The backport of 4db724fdd76e3a6cd0f5124ef86de976c495d666 359b63f8976375f071edc33092daea57efa768fb 01102ee8e6a967830bcd6f0134efe8976f473121 2672af737954fb17ec0ebf17e787219a504c4400 so coff output target to be able to handle massive relocations. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-11-07coff: Cover 'else' with cond compilationCyrill Gorcunov1-1/+1
It was a nit in first place. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-11-06coff: Handle massive relocationsCyrill Gorcunov1-5/+40
In case if relocations number exceed 16bit values we have to hande such case by a special way, as described in COFF specification. "IMAGE_SCN_LNK_NRELOC_OVFL indicates that the count of relocations for the section exceeds the 16 bits that are reserved for it in the section header. If the bit is set and the NumberOfRelocations field in the section header is 0xffff, the actual relocation count is stored in the 32-bit VirtualAddress field of the first relocation. It is an error if IMAGE_SCN_LNK_NRELOC_OVFL is set and there are fewer than 0xffff relocations in the section." [ BR3092924 ] Reported-by: Robert Yates Investigated-by: nasm64developer Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-11-06coff: Issue fatal signal on relocations more then 0xffffCyrill Gorcunov1-0/+4
Actually it's temporary action. We have to support more relocations then that but it requires some more code rework. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-11-05coff: Add IMAGE_SCN_MAX_RELOC constantCyrill Gorcunov1-0/+2
We will need it to analyze if section relocations are overflowed. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-10-27BR3079550: NASM crash on run-time for OMF output formatCyrill Gorcunov2-4/+4
We could have accessed malloc'ed data on external symbols in obj and ieee output formats. Fix it by using nasm_zalloc. Reported-by: Jiri Malak Patch-by: Jiri Malak Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-10-02BR3079550: NASM crash on run-time for OMF output formatCyrill Gorcunov2-4/+4
We could have accessed malloc'ed data on external symbols in obj and ieee output formats. Fix it by using nasm_zalloc. Reported-by: Jiri Malak Patch-by: Jiri Malak Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-30elf: Move stabs symbol table format into outelf.hCyrill Gorcunov3-16/+9
Get rid of code duplication Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-06outbin: Cleanup bin_cleanupCyrill Gorcunov1-5/+7
No need for 'q' variable. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-06outbin: Simplify reverse address computingCyrill Gorcunov1-2/+2
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-06BR3025702: outbin -- Fix byte orderingCyrill Gorcunov1-2/+2
In commit 55ae12052cd1 we occasionally broke byte ordering. Fix it. Note that current stable version 2.08.01 is not affected by this bug. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-06-15Rename filenames to 8.3 formatH. Peter Anvin2-1/+1
Apparently some people still care about compiling native on MS-DOS, and we don't have a significant number of files which need adjustment. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-06-07outobj: handle compilers without 64-bit switch() supportH. Peter Anvin1-1/+5
OpenWatcom, in particular, doesn't handle switch() statements with 64-bit expressions, sigh. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-06-07outelf32: handle compilers without 64-bit switch() supportH. Peter Anvin1-14/+22
OpenWatcom, in particular, doesn't handle switch() statements with 64-bit expressions, sigh. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-06-03nasmlib: Rename elements() macro to ARRAY_SIZECyrill Gorcunov1-2/+2
ARRAY_SIZE is a well known name pointing out that we're dealing with array in macro argument. Also to be on a safe side prefix_name helper should check the index been in bounds more precisely. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-05-06outobj: update error messageH. Peter Anvin1-2/+2
The possible sizes we can encounter are 1, 2, 4, 8... make sure we get a proper error message. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-05-06outobj: properly error on unsupported relocationsH. Peter Anvin1-12/+38
Error out on any relocations not supported by the backend. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-05-06outelf64: update copyright dateH. Peter Anvin1-1/+1
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-05-06ELF support for 8-bit relocationsH. Peter Anvin2-35/+92
Support 8-bit relocations (OUT_ADDRESS and OUT_REL1ADR) in ELF. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-05-06Add support for one-byte relocationsH. Peter Anvin3-30/+34
Add OUT_REL1ADR (one-byte relative address) and support for OUT_ADDRESs with size == 1. Add support for it in outbin and outdbg. *It still needs to be added to other backends*, both the OUT_REL*ADR and OUT_ADDRESS codepaths need to be handled. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-04-28MachO: Fix misprinted macho_sectalignCyrill Gorcunov2-4/+4
macho_sectalign was occasionally misprinted with macho_setcalign, fix it. No change on functionality. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-25obj: Implement sectalign helperCyrill Gorcunov1-1/+44
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-25macho: Implement sectalign handlerCyrill Gorcunov2-2/+36
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-25ieee: Fix section index match in sectalign handlerCyrill Gorcunov1-1/+1
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>