summaryrefslogtreecommitdiff
path: root/output/outdbg.c
Commit message (Collapse)AuthorAgeFilesLines
* Replace nasm_error(ERR_WARNING|...) with nasm_warn()H. Peter Anvin (Intel)2019-08-061-1/+1
| | | | | | Remove a few remaining instances of nasm_error(ERR_WARNING). Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* Add group aliases for all prefixed warnings.H. Peter Anvin2019-06-061-1/+1
| | | | | | | For example, -w+float will now enable all warnings with names staring with float-*. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Remove #includes already provided by "compiler.h"H. Peter Anvin2018-12-271-2/+0
| | | | | | | | "compiler.h" already includes a bunch of common include files. There is absolutely no reason to duplicate them in individual files, and in fact it robs us of central control of how these files are used. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Replace <ctype.h> includes with "nctype.h"H. Peter Anvin2018-12-271-1/+1
| | | | | | | For almost everything we should use "nctype.h". Right now we don't have a nasm_toupper() to use <ctype.h> for things that need toupper(). Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Move <string.h> inclusion to compiler.hH. Peter Anvin2018-12-261-1/+0
| | | | | | | There is absolutely no reason not to include <string.h> globally, and with the inline function for mempcpy() we need it there anyway. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Clean up the handling of various passesH. Peter Anvin (Intel)2018-12-181-12/+11
| | | | | | | | | The use of pass0, pass1, pass2, and "pass" passed as an argument is really confusing and already caused a severe bug in the 2.14.01 release cycle. Clean them up and be far more explicit about what various passes mean. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* warnings: rename ERR_WARN_* to WARN_*H. Peter Anvin (Intel)2018-12-121-1/+1
| | | | | | | | | | The prefix ERR_WARN_ is unnecessarily long and may be a disincentive to create new warning categories. Change it to WARN_*, it is still plenty distinctive. This is equivalent to nasm-2.14.xx checkin 77f53ba6d4cb90e5a7e09b33357ed7c1fe9f6b9d. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* Merge branch 'nasm-2.14.xx'Cyrill Gorcunov2018-10-151-2/+5
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * nasm-2.14.xx: (83 commits) NASM 2.14rc16 doc: Update changes preproc: expand_smacro -- Fix nil dereference on error path eval: Eliminate division by zero doc: Update changes opflags: Convert is_class and is_reg_class to helpers preproc: Fix out of range access in expand mmacro doc: Update changes parser: Fix sigsegv on certain equ instruction parsing labels: Make sure nil label is never passed labels: Don't nil dereference if no label provided macho: Add warning message in macho_output() macho/reloc: Fix addr size sensitive conditions macho/reloc: Fix macho_output() to get the offset adjustments by add_reloc() macho/reloc: Fixed offset adjustment in add_reloc() macho/reloc: Allow absolute relocation when forcing a symbol reference macho/reloc: Adjust SUB relocation information macho/reloc: Fixed in handling GOT/GOTLOAD/TLV relocations macho/reloc: Simplified relocation for REL/BRANCH macho/sym: Record initial symbol number always ... Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
| * subsections: don't lose the offset in the parent sectionH. Peter Anvin (Intel)2018-06-271-2/+5
| | | | | | | | | | | | | | | | | | We don't want to lose the offset into the parent section when we create a subsection, at least not for the MachO backend which is currently the only user of subsections. Allow ofmt->herelabel() to set a flag to copy the section offset from the previous section. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
| * Make limits 64 bits, add globallines limit to configurable limitsH. Peter Anvin2018-06-151-1/+2
| | | | | | | | | | | | | | | | Make all limit counters 64 bits, in case someone really has a usage for an insanely large program. The globallines limit was omitted, add it to the list of configurable limits. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* | Make limits 64 bits, add globallines limit to configurable limitsH. Peter Anvin2018-06-151-1/+2
| | | | | | | | | | | | | | | | Make all limit counters 64 bits, in case someone really has a usage for an insanely large program. The globallines limit was omitted, add it to the list of configurable limits. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* | output: centralize the null definition of ofmt->segbaseH. Peter Anvin2018-06-141-6/+1
|/ | | | | | | Only two output formats (obj and ieee) actually need ofmt->segbase, so move the common dummy definion into nullout.c. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* labels: add a subsection field available for backend useH. Peter Anvin2018-06-141-6/+8
| | | | | | | Allow the subsection to store a subsection value directly in the label, rather than having to do strange encoding hacks. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* Cleanup of label renaming infrastructure, add subsection supportH. Peter Anvin2018-06-011-5/+6
| | | | | | | | | | | | | | In order to support Mach-O better, add support for subsections, as used by Mach-O "subsections_via_symbols". We also want to add infrastructure to support this by downcalling to the backend to indicate if a new subsection is needed. Currently this supports a maximum of 2^14 subsections per section for Mach-O; this can be addressed by adding a level of indirection (or cleaning up the handling of sections so we have an actual data structure.) Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* Add support for backend-defined subsections and label hacksH. Peter Anvin2018-05-301-4/+29
| | | | | | | | | | MachO has this odd thing called "subsections via symbols", by which a symbol can magically start what effectively is a new section. To support this, add support for a calldown into the backend when a new symbol is defined *at the current output location*, and allow it to switch the current segment. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* Eliminate filename length restrictions, remote ofmt->filename()H. Peter Anvin2017-12-201-6/+3
| | | | | | | | | | | Get rid of remaining dependencies on FILENAME_MAX, which ought to have been removed a long time ago. Remove ofmt->filename(); all implementations pretty much do the same thing and there is absolutely no reason to duplicate that functionality all over the place. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* Merge remote-tracking branch 'origin/nasm-2.13.xx'H. Peter Anvin2017-06-231-3/+3
|\ | | | | | | | | | | | | Resolved Conflicts: common/common.c Signed-off-by: H. Peter Anvin <hpa@zytor.com>
| * outdbg: make the output for relative relocations more clearH. Peter Anvin2017-06-221-3/+3
| | | | | | | | | | | | | | Make the output for relative relocations more clear, so it can be actually comprehended. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* | Sanitize the handling of segments a bitH. Peter Anvin2017-05-031-22/+61
|/ | | | | | | | | | | Make the internal handling of segment numbers just a little more sane. The whole use of when we have done ofmt->segbase or not is crazy, though... In the meantime, add a few more hacks to the dbg output format to make it more useful. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* Fix errors uncovered by clang warningsChang S. Bae2017-04-171-1/+1
| | | | | | | | 1. One incorrect variable use(!) 2. One possibly uninitialized variable. Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* Add generic perfect string hashes, use for directivesH. Peter Anvin2017-04-031-15/+3
| | | | | | | | | | | | | | Add a generic facility for generating perfect string hashes, where all that is needed is an enum and a string table. The existing mechanism using a custom Perl script wrapped around a module continues to be available for any use case where this particular approach isn't sophisticated enough. Much of this patch comes from renaming "enum directives" to "enum directive" as a result of the string hash generator expecting a set of uniform naming conventions. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* outdbg: add %pragma for maximum size of a raw data dumpH. Peter Anvin2017-03-311-5/+29
| | | | | | | | A raw data dump can potentially be very large, especially when incbin is used. Allow a %pragma for setting the maximum dump size (defaults to 128 bytes.) Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* output: remove the completely unused set_info methodH. Peter Anvin2017-03-311-8/+0
| | | | | | | Every single backend has this method set to NULL. It is also a rather strange interface. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* outdbg: update to dump new backend interface dataH. Peter Anvin2017-03-311-20/+155
| | | | | | | | Update the debug output format to dump (most of) the information that is available via the new backend format, as well as the legacy backend format -- probably the only backend ever which will ever want both! Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* output: make the return value from the directives method more meaningfulH. Peter Anvin2017-03-071-3/+4
| | | | | | | | | The directives code is already trying to do a bit more unified error handling, so give ourselves a bit richer interface. At this point, the conversion was pretty automatic so we probably return DIRR_OK instead of DIRR_ERROR in a fair number of places, but that's okay. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* Add a generic pragma-handling infrastructureH. Peter Anvin2017-03-071-1/+3
| | | | | | | Add infrastructure for handling %pragmas with a variety of namespaces, etc., etc... Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* backend: move wrapper for legacy output functions to a library routineH. Peter Anvin2016-09-241-0/+2
| | | | | | | Move the wrapper for legacy output into a library routine so the backends can be ported one at a time. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Reorganize the source code into subdirectoriesH. Peter Anvin2016-05-251-1/+1
| | | | | | | Make the source code easier to understand and keep track of by organizing it into subdirectories depending on the function. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* lib: split library into stdlib and nasmlib; header handling fixesH. Peter Anvin2016-03-081-1/+0
| | | | | | | | | | | | | Split lib/ into nasmlib/ (for nasm-specific functions) and stdlib/ (for replacements for C library functions which may be missing.) Rename the ersatz inttypes.h to nasmint.h so we can use a simple test in compiler.h instead of dealing with include path magic. Remove tests in configure.in for ancient missing functions (which will break the build anyway.) Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Merge remote-tracking branch 'origin/nasm-2.12.xx'H. Peter Anvin2016-03-081-2/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Resolved Conflicts: output/codeview.c output/outelf32.c output/outelf64.c output/outelfx32.c output/outform.c output/outform.h output/outieee.c output/outobj.c Signed-off-by: H. Peter Anvin <hpa@zytor.com>
| * ofmt: get rid of the debuginfo parameter to ofmt->cleanup()H. Peter Anvin2016-03-071-2/+1
| | | | | | | | | | | | | | | | | | | | Get rid of the completely pointless "debuginfo" parameter to ofmt->cleanup(). Most backends completely ignore it, and the two that care (obj, ieee) can simply test dfmt instead. Also, dfmt is never NULL, so any test for a NULL dfmt is bogus. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
| * Remove ofmt->current_dfmt indirectionH. Peter Anvin2016-03-071-1/+1
| | | | | | | | | | | | | | | | | | | | Move ofmt->current_dfmt into a separate global variable. This should allow us to make ofmt readonly and removes some additional gratuitious differences between backends. From master branch checkin a7bc15dd0aa963ab56a98ee04bc08ce6d9e3baea Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* | Make a few more data items static and constH. Peter Anvin2016-02-181-1/+1
| | | | | | | | | | | | A few more data items that should be static and const. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* | More constification, mostly of struct dfmtH. Peter Anvin2016-02-181-2/+2
| | | | | | | | | | | | | | Make struct dfmt and the struct dfmt arrays const across the board, and make them static whereever possible. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* | output: make all instances of struct ofmt readonlyH. Peter Anvin2016-02-171-2/+2
| | | | | | | | | | | | | | With current_dfmt gone, we can make all instances of struct ofmt const (read-only). Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* | Remove ofmt->current_dfmt indirectionH. Peter Anvin2016-02-171-1/+1
|/ | | | | | | | Move ofmt->current_dfmt into a separate global variable. This should allow us to make ofmt readonly and removes some additional gratuitious differences between backends. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* Replace global maxbits variable with field in struct ofmtH. Peter Anvin2016-02-111-0/+1
| | | | | | | maxbits is strictly a property of the output format, so get rid of this ad hoc method of reporting. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* output: dbg,aout,elf32 -- Fix out for signed relocationsCyrill Gorcunov2015-02-211-1/+1
| | | | | | | | @size might be negative for signed relocations but its length is abs value. This is rather a fix for future use because at moment we can't hit this problems but better be on a safe side. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* Add missing static declaration in output/outdbg.cH. Peter Anvin2014-11-251-1/+1
| | | | Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* output: Allow OUT_ADDRESS with a negative size to mean signed relocationH. Peter Anvin2013-11-261-4/+7
| | | | | | This only matters for ELF64/ELFx32, at least for now. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Fixed wrong format specifier in format stringPhilipp Kloke2013-04-011-2/+2
| | | | | Signed-off-by: Philipp Kloke <philipp.kloke@web.de> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* Add support for one-byte relocationsH. Peter Anvin2010-05-061-0/+4
| | | | | | | | | 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>
* Rename SEGALIGN to SECTALIGNCyrill Gorcunov2010-04-211-2/+2
| | | | | | | "sectalign" is preferred over "segalign" since it operates over section attributes. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* ofmt: Implement null_segalign stubsCyrill Gorcunov2010-04-211-0/+7
| | | | | | Set stubs for all targets Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* Remove function pointers in output, simplify error handlingH. Peter Anvin2009-07-181-36/+24
| | | | | | | | | | | | | | | 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>
* Hash even backend-specific directives, unify null functionsH. Peter Anvin2009-07-121-2/+2
| | | | | | | | | 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>
* Don't fclose() the output in the backendH. Peter Anvin2009-07-121-1/+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>
* outdbg: be excrutiatingly correct...H. Peter Anvin2009-07-071-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>
* outdbg: fix OUT_REL*ADR, add OUT_REL8ADRH. Peter Anvin2009-07-071-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>
* Make it possible for outputs to be either text or binaryH. Peter Anvin2009-07-051-1/+1
| | | | | | | | | | | 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>