summaryrefslogtreecommitdiff
path: root/output
AgeCommit message (Collapse)AuthorFilesLines
2009-08-09output: change null_debug_routine to null_debug_directiveH. Peter Anvin4-5/+5
This is the null implementation of the function debug_directive. For some reason it ended up getting mangled as "null_debug_routine". Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-08-01output/outbin.c -- use list helpersCyrill Gorcunov1-15/+15
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-07-28outaout.c -- use list helpersCyrill Gorcunov1-6/+4
Note that we use list_for_each(var,var) sometime which actually brings in at least one redundant assignment in case of NULL being passed but save us a few lines of code. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-07-26Merge branch 'nasm-2.07.xx'H. Peter Anvin1-6/+6
2009-07-26BR 2827397: fix invalid C in outcoff AddExports()H. Peter Anvin1-6/+6
The construct: if (i == nsects) directive_sec = sects[coff_make_section (EXPORT_SECTION_NAME, EXPORT_SECTION_FLAGS)]; ... where coff_make_section() can change the global variable "sects" is undefined C, since there is no sequence point involved in the [] operator, and it is therefore fully permitted for the C compiler to read the sects variable first. Change this construct into two statements to enforce defined behavior; this also ends up with the code slightly simpler. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-18Drop the ofmt and errfunc arguments to label definition functionsH. Peter Anvin8-57/+35
We never set ofmt and errfunc to anything but the global values. Dropping them from the label definition function command line simplifies the code. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-18Remove function pointers in output, simplify error handlingH. Peter Anvin16-931/+799
Remove a bunch of function pointers in the output stage; they are never changed and don't add any value. Also make "ofile" a global variable and let the backend use it directly. All we ever did with these variables were stashing it in locals and using them as-is anyway for no benefit. Also change the global error function, nasm_error() into a true function which invokes a function pointer internally. That lets us use direct calls to it. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-17Merge commit 'nasm-2.07rc7' into new-preprocH. Peter Anvin2-5/+5
2009-07-16outcoff: fix invalid reference to ofmtH. Peter Anvin1-1/+1
ofmt is a static in nasm.c (why?), not a global... Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-16outcoff: this is COFF, not binaryH. Peter Anvin1-2/+2
Fix error message in outcoff to say COFF, not binary format... Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-16outform.h: update comments regarding macho32/macho64Keith Kanios1-4/+4
2009-07-14outobj: don't fclose() the outputH. Peter Anvin1-1/+0
Missed fclose() in outobj when converting system to global fclose(). Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-13Merge branch 'master' into new-preprocH. Peter Anvin2-1/+9
Conflicts: .gitignore
2009-07-13ELF: add debug support for TY_YWORDH. Peter Anvin2-0/+8
Add debug support for TY_YWORD (256 bits/32 bytes). Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-13elf32: debug32_typevalue - fix TY_OWORD sizeCyrill Gorcunov1-1/+1
TY_OWORD is 8 * TY_WORD = 16 bytes length Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-12Hash even backend-specific directives, unify null functionsH. Peter Anvin14-128/+147
Hash all directives, even the ones that are backend-specific, and instead pass the backend an already-parsed directive number. Furthermore, unify null functions across various backends. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-12Don't fclose() the output in the backendH. Peter Anvin12-17/+0
We fopen() the output file in common code but fclose() it in the backend. This is bad for a variety of reasons: 1. it is generally an awkward interface to change ownership. 2. we should use ferror() to test for write errors, and that is better done in common code. 3. it requires more code. 4. we still need to fclose() in common code during error handing. Thus, move the fclose() of the output out of the backends, and add fflush() so we can test ferror() on output. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-08macho64: Manually merge macho64 branch with master branch.Keith Kanios4-18/+1584
2009-07-07outmacho.c: fix section/relocation alignment issueKeith Kanios1-3/+7
2009-07-07outdbg: be excrutiatingly correct...H. Peter Anvin1-1/+1
outdbg is actually a good starting point to make a new backend, so we really should endeavor to make it do things "right". Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-07outdbg: fix OUT_REL*ADR, add OUT_REL8ADRH. Peter Anvin1-3/+8
The OUT_REL*ADR types pass a pointer which points to an int64_t which then should be truncated down to size. This matters on bigendian platforms. Add OUT_REL8ADR. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-06outbin: be consistent in spelling "Intel hex" with those capsH. Peter Anvin1-1/+1
The documentation uses "Intel hex", with that capitalization (Intel being a proper noun, hex being descriptive) so make the help message match. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-06outmacho: fixed section/relocation alignment issueKeith Kanios1-4/+4
2009-07-06NASM: relicense under the 2-clause BSD licenseH. Peter Anvin9-108/+0
*To the best of my knowledge*, we now have authorization from everyone who has significantly contributed to NASM in the past. As such, change the license to the 2-clause BSD license. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-06outbin: minor cleanupsH. Peter Anvin1-6/+8
- add assert so we don't try to write 2^64 bytes of zero - explicitly track the Intel hex "LBA" (64K page) instead of playing games with the last byte written. This way it is more explicit what we're doing and why. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-05outbin: when using saa_rnbytes() we have to saa_rewind()H. Peter Anvin1-0/+2
Using saa_fpwrite() to dump a section to a file automatically does saa_rewind(), but if we use saa_rnbytes() to do bit by bit then we manually need to to saa_rewind() before we start. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-05outbin: when writing S-records, write head recordH. Peter Anvin1-0/+3
When writing S-record output, we should write the head record (S0), too. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-05outbin: add support for Intel hex and Motorola S-recordsH. Peter Anvin2-29/+293
Add support for directly generating Intel hex or Motorola S-records. These formats are commonly used with ROM burners. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-05Make it possible for outputs to be either text or binaryH. Peter Anvin12-57/+62
Allow the backend to specify that an output format is either text or binary. For future uses, define this as a flag word so we can define other flags in the future if it would make sense. Currently, the ieee and dbg formats are text; all the others are binary. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-01outobj: handle the case of SEG <undefined> in pass 0H. Peter Anvin1-4/+12
SEG <undefined> can happen, validly, for a common symbol during the optimization passes. It better not happen during the real passes, however! Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-30outmacho: change license to 2-BSDH. Peter Anvin1-12/+0
Received authorization from Apple to change the license of outmacho.c to the 2-clause BSD license. Thanks! Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-30ELF64: fix incorrect type for the .strtab section headerCyrill Gorcunov1-1/+1
The .strtab section is SHT_STRTAB, not SHT_SYMTAB. Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-28Add new copyright headers to the output modulesH. Peter Anvin23-83/+798
Add new copyright headers to the new output modules. As far as I know, the only module which we still don't have a green light to release under 2-BSD is outmacho. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-28Add copyright headers to macro filesH. Peter Anvin9-0/+405
These are definitely overly restrictive, need auditing to pare them down to proper BSD licensing. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-27Move prototypes for null_debug to outform.h and outlib.hH. Peter Anvin5-0/+17
Move the prototypes for the null debugging format to outform.h (for the top-level structure declaration only) and outlib.h (for the internal routines.) Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-27Move backend-specific code to output/; break out null debug stuffH. Peter Anvin18-20/+475
Move backend-specific code into the output/ directory, and make the null debugging backend a separate file (it certainly isn't needed for ndisasm...) Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-27debug: make *all* the null debug routines available as a libraryH. Peter Anvin2-20/+2
Make all the null debug routines available as a library, so we can use them whenever appropriate. We really don't need to have a bunch of dummy functions scattered all over the code. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-27output: call debug init from a central locationH. Peter Anvin3-5/+1
We already call current_dfmt->init in the same place (at the very end of ofmt->init) in all the backends that do it; instead call it centrally in nasm.c after ofmt->init. This fixes invalid ELF files with when compiling with -F dwarf, since the dwarf initialization routine never got called. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-27outelf.c: add appropriate #ifdefsH. Peter Anvin1-0/+5
Only build outelf.c if ELF32 or ELF64 is included. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-27outdbg: make outdbg.c compile cleanlyH. Peter Anvin1-10/+12
Make outdbg.c compile cleanly again. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-25ELF: make debugging functions staticH. Peter Anvin2-65/+70
The debugging functions can and should all be static. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-25ELF: remove loop invariant calculation of global offsetH. Peter Anvin2-6/+18
The global symbol offset is a loop invariant; no need to compute it over and over. The compiler probably will not be able to do this for us due to global variables and function calls. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-25ELF: clean up the arithmetic for global symbolsH. Peter Anvin2-32/+52
Clean up the arithmetic for global symbols; in particular, make it clear where the dependency on the debug format comes from (DWARF needs three symbol table entries all by itself.) Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-25ELF: bump GLOBAL_TEMP_BASEH. Peter Anvin1-1/+1
Bump GLOBAL_TEMP_BASE so far that it *cannot* conflict for ELF32 (which has 24-bit symbol table indicies) and is *unlikely* to conflict for ELF64 (which has 32-bit symbol table indicies.) Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-25ELF: eliminate hard-coded section numbersH. Peter Anvin3-81/+143
Eliminiate hard-coded section numbers, at least to the best of our ability. There is still a very odd piece of computation in elf_build_reltab() which I can't really figure out... Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-25Handle the new ELF headers in the dependency generationH. Peter Anvin5-11/+11
The dependency machinery relies on properly rooted includes, so give it to them... the path syntax munging machinery in the dependency script handles it from a Makefile syntax perspective, and then we can hope that C compilers are smart enough to deal with forward-slash paths even when that is not the native syntax. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-25ELF: add header files, begin merging common code, drop .commentH. Peter Anvin8-314/+661
Add something approaching real ELF header files. Begin merging the common ELF code, beginning with the section name detection. Drop automatic generation of .comment section, and in particular the treatment of .common as a special section (if we decide generating .comment is still a good idea, we should just do it as a macro.) Augment the list of known sections, and make it table-driven. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-04-30outbin: replace fprintf(rf, not_defined); with fputs(not_defined, rf);H. Peter Anvin1-5/+5
Some vendors get nervous about parameterized printf patterns; furthermore, it's completely unnecessary in this case. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-03-18outcoff: BR 2685756: fix SAFESEH with an internal symbolAndy Polyakov1-1/+3
Fix the SAFESEH directive for the specific case of a symbol internal to the program. With the optimizer enabled, it would otherwise fail unless the symbol is external.
2009-03-18outelf32/64: fix uninitialized rbtreeMichael Scherer2-0/+4
Fix crash caused by uninitialised memory that lead to dangling pointer in the rbtree. This can be seen by compiling zsnes 1.50, with a file that define many symbols, such as fxemu2c.asm.