summaryrefslogtreecommitdiff
path: root/output
Commit message (Collapse)AuthorAgeFilesLines
* warnings: define warning classes at point of usemkwarningsH. Peter Anvin (Intel)2018-12-131-0/+5
| | | | | | | | | | | | It is extremely desirable to allow the user fine-grained control of warnings, but this has been complicated by the fact that a warning class has had to be defined in no less than three places (error.h, error.c, nasmdoc.src) before it can be used in source code. Instead, use a script to define these via magic comments at the point of use. This hopefully will encourage creating new classes as needed. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* warnings: Make WARN_ constants consistent with -w optionsH. Peter Anvin (Intel)2018-12-121-2/+2
| | | | | | Not only does this make it consistent, but allows for automation. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* warnings: rename ERR_WARN_* to WARN_*H. Peter Anvin (Intel)2018-12-122-3/+3
| | | | | | | | | | 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>
* strlist: merge the strtbl and strlist interfacesH. Peter Anvin (Intel)2018-12-113-175/+1
| | | | | | | | The currently-unused strtbl was basically a slightly different version of strlist, with the find and linearize capabilities. Merge these two together by augmenting strlist to have the same capabilities. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* hashtbl: revamp the hash table interface, support binary keysH. Peter Anvin (Intel)2018-12-113-10/+8
| | | | | | | Add binary key support to the hash table interface. Clean up the interface to contain less extraneous crud. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* output: elf -- Use nasm_error helpersCyrill Gorcunov2018-12-021-117/+107
| | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* output: obj -- Use nasm_error helpersCyrill Gorcunov2018-12-021-77/+63
| | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* output: ieee -- Use nasm_error helpersCyrill Gorcunov2018-12-021-18/+14
| | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* output: coff -- Use nasm_error helpersCyrill Gorcunov2018-12-021-42/+37
| | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* output: bin -- Use nasm_error helpersCyrill Gorcunov2018-12-011-81/+64
| | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* output: as86 -- Use nasm_error helpersCyrill Gorcunov2018-12-011-17/+17
| | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* output: aout -- Use nasm_error helpersCyrill Gorcunov2018-12-011-50/+47
| | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* output: codeview -- Use nasm_error helpersCyrill Gorcunov2018-12-011-3/+3
| | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* Merge remote-tracking branch 'origin/nasm-2.14.xx'H. Peter Anvin2018-11-281-2/+2
|\ | | | | | | | | | | | | | | Resolved Conflicts: asm/nasm.c version Signed-off-by: H. Peter Anvin <hpa@zytor.com>
| * BR 3392532: outobj: fix forward references to the SEG of external symbolsH. Peter Anvin2018-11-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | External symbols are defined via deflabel(), but deflabel() is not called until pass0 == 1. Until that happens, segbase has no way to know what the proper segment base of the segment actually is. Thus, testing for pass0 == 0 will always fail for a forward reference; correct the test to test for pass0 < 2, i.e. the assert should fail only for the final code-generation pass. Reported-by: <stsp@list.ru> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* | version: Make them dynamic for regression tests sakeCyrill Gorcunov2018-11-244-6/+6
| | | | | | | | | | | | | | | | When we are running regression tests we compare binary forms and the strings better to be the constants to not trigger false positives. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* | output: obj -- Fix nil dereference if no deps neededCyrill Gorcunov2018-11-111-1/+1
| | | | | | | | | | | | Occasionally sneaked in by f7106d06e4e4865fab2fb704736ab2addc967bd7 Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* | stabs: Convert style and add commentsCyrill Gorcunov2018-10-281-91/+97
| | | | | | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* | elf: Convert header to linux styleCyrill Gorcunov2018-10-281-373/+373
| | | | | | | | | | | | No functional changes. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* | dwarf: Update header and drop redundant spaceCyrill Gorcunov2018-10-281-2/+2
| | | | | | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* | dwarf: Update definitions for v4 and v5Cyrill Gorcunov2018-10-281-1/+31
| | | | | | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* | strlist: use a hash tableH. Peter Anvin (Intel)2018-10-251-2/+2
| | | | | | | | | | | | | | Use a hash table to enforce uniqueness in a string list. It is still an ordered list, however, and can be walked in insertion order. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* | output: macho -- Rename sect_attribs to macho_known_section_attrCyrill Gorcunov2018-10-251-2/+2
| | | | | | | | | | | | To unify with macho_known_section in namings. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* | output: macho -- Use lookup_known_section helperCyrill Gorcunov2018-10-251-24/+35
| | | | | | | | | | | | To make it similar to elf code. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* | output: macho -- Beautify known sectionsCyrill Gorcunov2018-10-241-27/+27
| | | | | | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* | output: macho -- Move constants into the headerCyrill Gorcunov2018-10-242-75/+283
| | | | | | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* | Merge branch 'nasm-2.14.xx'Cyrill Gorcunov2018-10-153-48/+60
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
| * macho: Add warning message in macho_output()Chang S. Bae2018-10-091-0/+3
| | | | | | | | | | Based-on-code-from: zenith432 <zenith432@users.sourceforge.net> Signed-off-by: Chang S. Bae <changseok.bae@gmail.com>
| * macho/reloc: Fix addr size sensitive conditionsChang S. Bae2018-10-091-1/+1
| | | | | | | | | | | | | | TLVP relocation helps GOT that is 64-bit only. Based-on-code-from: zenith432 <zenith432@users.sourceforge.net> Signed-off-by: Chang S. Bae <changseok.bae@gmail.com>
| * macho/reloc: Fix macho_output() to get the offset adjustments by add_reloc()Chang S. Bae2018-10-091-1/+4
| | | | | | | | | | | | | | | | | | Unlike the relative relocations, OUT_ADDRESS had ignored the adjustments made by add_reloc(), and writes the offset of the target symbol in the target section. Based-on-code-from: zenith432 <zenith432@users.sourceforge.net> Signed-off-by: Chang S. Bae <changseok.bae@gmail.com>
| * macho/reloc: Fixed offset adjustment in add_reloc()Chang S. Bae2018-10-091-6/+6
| | | | | | | | | | | | | | | | | | | | | | If the target symbol is in the same file, add_reloc() emits an internal reloc for the target section, and the offset written is the offset in the target section. If the target symbol is external, its offset is zero (or an explicit addend), and add_reloc() emits an external reloc for the symbol. Based-on-code-from: zenith432 <zenith432@users.sourceforge.net> Signed-off-by: Chang S. Bae <changseok.bae@gmail.com>
| * macho/reloc: Allow absolute relocation when forcing a symbol referenceChang S. Bae2018-10-091-4/+7
| | | | | | | | | | | | | | | | | | The (fake) section for absolute symbols is not in the linked list. So, when the section is not found from the index, now it simply points to the special section. Based-on-code-from: zenith432 <zenith432@users.sourceforge.net> Signed-off-by: Chang S. Bae <changseok.bae@gmail.com>
| * macho/reloc: Adjust SUB relocation informationChang S. Bae2018-10-091-2/+4
| | | | | | | | | | | | | | | | As SUB relocation getting deprecated, reset external reference seems to be enough. Also, print a warning message for this. Based-on-code-from: zenith432 <zenith432@users.sourceforge.net> Signed-off-by: Chang S. Bae <changseok.bae@gmail.com>
| * macho/reloc: Fixed in handling GOT/GOTLOAD/TLV relocationsChang S. Bae2018-10-091-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | - Changed to search all symbols, instead of only global symbols. - Will do immediate exits when unsupported use of WRT - Fixed to mark (got)pcrel flag only for macho64 output. GOT is supported only for 64-bit. Based-on-code-from: zenith432 <zenith432@users.sourceforge.net> Signed-off-by: Chang S. Bae <changseok.bae@gmail.com>
| * macho/reloc: Simplified relocation for REL/BRANCHChang S. Bae2018-10-091-16/+2
| | | | | | | | | | | | | | | | | | It seems like the relocation for the relative reference to absolute addresses only cares external reference info. Instead of exiting, reset the external reference flag. Based-on-code-from: zenith432 <zenith432@users.sourceforge.net> Signed-off-by: Chang S. Bae <changseok.bae@gmail.com>
| * macho/sym: Record initial symbol number alwaysChang S. Bae2018-10-091-3/+3
| | | | | | | | | | | | | | The special segment may need this information for future fix-ups. Based-on-code-from: zenith432 <zenith432@users.sourceforge.net> Signed-off-by: Chang S. Bae <changseok.bae@gmail.com>
| * obj: Fix to initialize segment listChang S. Bae2018-09-151-4/+5
| | | | | | | | | | | | | | | | | | | | Recent labeling mechanism changes seem to bring the case, where segment() procedure is called when the segment list is empty. Now, it will simply check and initalize the segment list. Reported-by: Ozkan Sezer <sezeroz@gmail.com> Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
| * macho: Fix relocation type for relative direct branchChang S. Bae2018-08-241-0/+2
| | | | | | | | | | | | | | | | | | | | Previously, X86_64_RELOC_BRANCH is only set for external relocations. Internal relocation also needs this type to be set, instead of the default (X86_64_RELOC_SIGNED) or anything. Reported-by: <zenith432@users.sourceforge.net> Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
| * macho: Turn off jump-match optimization for subsections_via_symbolsChang S. Bae2018-08-161-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The jump-match optimization tends to remove labels. When the "subsections_via_symbols" pragma is declared, all the labels should be emitted. Disabling the optimization (only) makes the pragma effective. It might be cleaner to extend the OFMT interface to support callback function. In this case, the reconfiguration can be done through the callback interface, rather than direct access to the global variable. Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
| * subsections: don't lose the offset in the parent sectionH. Peter Anvin (Intel)2018-06-272-5/+10
| | | | | | | | | | | | | | | | | | 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>
| * RAA: make pointer vs integer RAAs type safeH. Peter Anvin2018-06-181-3/+3
| | | | | | | | | | | | | | Use pseudo-types to make it impossible to confuse RAAs made of integers and RAAs made of pointers. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
| * outmacho: don't use raa_read() for pointer valuesH. Peter Anvin2018-06-181-1/+1
| | | | | | | | | | | | | | If we write pointers, we have to read pointers. This unbreaks non-64-bit bigendian systems. Signed-off-by: H. Peter Anvin <hpa@linux.intel.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>
* | errors: simplify nasm_fatal() and nasm_panic()H. Peter Anvin2018-06-159-73/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Nearly all instances of nasm_fatal() and nasm_panic() take a flags argument of zero. Simplify the code by making nasm_fatal and nasm_panic default to no flags, and add an alternate version if flags really are desired. This also means that every call site doesn't have to initialize a zero argument. Furthermore, ERR_NOFILE is now often not necessary, as the error code will no longer cause a null reference if there is no current file. Therefore, we can remove many instances of ERR_NOFILE which only deprives the user of information. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* | outbin: remove ERR_NOFILEH. Peter Anvin2018-06-151-9/+9
| | | | | | | | | | | | | | | | The current error interface fully supports the case where there is no current filename, so specifying ERR_NOFILE just deprives the user of information. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* | outelf: remove additional tests for [ABSOLUTE]H. Peter Anvin2018-06-151-20/+0
| | | | | | | | | | | | This test is now centralized, no reason to duplicate everywhere. 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: remove ABSOLUTE handling, OUT_RAWDATA assertsH. Peter Anvin2018-06-159-104/+0
| | | | | | | | | | | | | | | | | | | | | | ABSOLUTE handling can be done centrally, and shouldn't need to be in every backend. Simply drop the call to ofmt->output(). Many backends have an assert for OUT_RAWDATA not having a target segment; this doesn't make any sense as output/legacy.c will not allow that to happen. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* | output: centralize the null definition of ofmt->segbaseH. Peter Anvin2018-06-1410-56/+22
|/ | | | | | | 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>
* outmacho: don't do encoding magic in the segment indexH. Peter Anvin2018-06-141-49/+73
| | | | | | | | | | | | | | | | | Encoding magic (in this case, subsection number) by bitfields in the segment index has several problems: 1. It limits the number of *external symbols* as well as segments/subsections. 2. It is inefficient for the assembler (creates a very large RAA). This is also a really good opportunity for removing linear lookups in the MachO backend. We now use an RAA to do look up segment by index, and a hash table to look up segment by name. Subsections are simply handled by allocating a new index using seg_alloc() but still point it to the same section structure in the index RAA. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>