summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* rdflib: actually get the timemachomergeH. Peter Anvin2016-02-121-1/+2
| | | | | | sizeof(t = time(NULL)) doesn't ever actually call time(). Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* outmacho: rename outmac.c to outmacho.cH. Peter Anvin2016-02-126-20/+21
| | | | | | We already have outmacho.mac, so name this file outmacho.c. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* outmac: generate section-relative relocations for local symbolsH. Peter Anvin2016-02-121-42/+13
| | | | | | | | | | | We generate section-relative relocations for local symbols for all the other output formats, and we should do the same for MachO; this was done in MachO-32 but not in MachO-64, presumably because the MachO spec implies that such relocations shouldn't exist in 64-bit code. They are indeed rare, but that is a programmer's decision, and the spec is clear that they are legal. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* assemble.c: when converting an address to RAWDATA, need to update sizeH. Peter Anvin2016-02-121-2/+3
| | | | | | | When converting an address to RAWDATA we have to copy the address size into the size variable, as the size variable may be negative. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* outmac: correct the format name for macho32H. Peter Anvin2016-02-121-3/+3
| | | | | | | The name for the macho32 output format was incorrectly set to macho64, which means neither macho32 nor macho64 worked correctly. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* output: outmac -- Fix few nits during mergeCyrill Gorcunov2016-02-121-4/+3
| | | | | | | - typo in @if statement - unused @originalIndex Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* outmac: allow section alignment to be declared more than onceH. Peter Anvin2016-02-121-21/+10
| | | | | | | | Allow section alignment to be declared more than once, with different values. The strictest alignment value via either a section or sectalign directive becomes the controlling parameter. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* outmac: default to bits 32 for macho32 output formatH. Peter Anvin2016-02-121-2/+2
| | | | | | Default to 32 bits for macho32; default to 64 bits for macho64. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* outmac: move the format definitions down to the format-specific codeH. Peter Anvin2016-02-121-22/+22
| | | | | | | Move the format definitions down the to where the format-specific initialization code lives. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Merge the macho32 and macho64 (outmac32/64) backendsH. Peter Anvin2016-02-127-1626/+340
| | | | | | | | Merge the two Mach-O backends for cleanliness and maintainability. This should also make the recent fixes to MachO-64 available in MachO-32. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* realpath: prefer the buffer size given by pathconf()H. Peter Anvin2016-02-121-8/+12
| | | | | | | | If realpath(..., NULL) doesn't work, we have to allocate a buffer blindly. Use the value returned from pathconf() in preference from compile-time constants. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* macho64: remove -64 suffix from static variablesH. Peter Anvin2016-02-121-34/+34
| | | | | | | | When the macho64 backend was forked, instead of fixing variables which ought to have been static all along, the porter added a -64 suffix to prevent namespace conflict. Fix it by making those variables static. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* macho: make a bunch of global variables staticH. Peter Anvin2016-02-122-12/+12
| | | | | | | These variables should never have been anything but static in the first place. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* assemble.c: fix the handling of zero-extending unsigned relocationsH. Peter Anvin2016-02-111-1/+2
| | | | | | | | First of all we printed the wrong error message, and second of all we need to set the segments to NO_SEG before passing them to the output format generator. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* assemble.c: handle oversized relative relocationsH. Peter Anvin2016-02-111-3/+26
| | | | | | | | | | Handle the case of oversized (larger than permitted by the output format) relative relocations. Relative relocations are always signed, and quite likely to actually have the sign bits set, so zero-extending them is not an option. Fortunately oversized relative relocations are rare, as no CPU instruction support 64-bit relative addresses. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Replace global maxbits variable with field in struct ofmtH. Peter Anvin2016-02-1116-17/+26
| | | | | | | 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>
* Set warning name to zext-reloc and fix the warning messageH. Peter Anvin2016-02-112-2/+2
| | | | | | Adjustment to the warning about zero-extended relocations. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Merge branch 'machofix'H. Peter Anvin2016-02-1115-61/+78
|\ | | | | | | | | | | | | This fixes the macho64 output. However, macho32 has the same problems and the code either needs to be backported or, better yet, unified. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
| * outmac64.c: Fix memory clobber bug, clean up memory freemachofixH. Peter Anvin2016-02-111-5/+6
| | | | | | | | | | | | | | Fix an array that was way too small resulting in memory overwrite errors, and free a few more dynamic data structures. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
| * macho64: remove LC_DATA_IN_CODE, change reloc type to 1H. Peter Anvin2016-02-111-10/+1
| | | | | | | | | | | | | | Change the relocation type to SIGNED instead of BRANCH, this is probably more correct. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
| * macho64: fix alignment problems, add LC_DATA_IN_CODEH. Peter Anvin2016-02-111-20/+33
| | | | | | | | | | | | | | | | | | | | | | | | Hopefully actually fix the issues with alignment this time. Avoid a linear search of segments for each symbol emitted. Issue an empty LC_DATA_IN_CODE command since that seems to be expected. With this, ffmpeg builds but still crashes on startup, which seems very strange. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
| * LLVM portability fix for abs(size)H. Peter Anvin2016-02-0513-14/+14
| | | | | | | | | | | | | | | | | | size is actually an uint64_t, and LLVM drops the abs() on the principle that the uint64_t should always be positive. Make it explicit that we are converting to a signed integer first, by using abs((int)size) instead. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
| * codeview.c: remove superfluous pointer testH. Peter Anvin2016-02-051-2/+2
| | | | | | | | | | | | | | | | A pointer to a field in a structure can never be NULL so remove the test. There is no reason to test the field for an empty string either, since we immediately thereafter do a strcmp(). Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
| * nasmlib.h: remove system definitions of ALIGN and ALIGN_MASKH. Peter Anvin2016-02-051-0/+2
| | | | | | | | | | | | | | | | Apparently some BSD flavors define these macros in a system header file; this includes MacOS X. Assume we can just #undef them without causing any additional issues; otherwise we may need to rename them. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
| * outmac64: Fix the handling of section data alignmentH. Peter Anvin2016-02-051-20/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix a number of places which failed to account for padding to alignment of section data. Also, fix confusion between aligning section data in the linkable object code and final address alignment; LLVM/Xcode always align section data to 4 bytes (with a comment saying that it probably should be 8 bytes for 64-bit output) independent of the section alignment. This will need to be ported to the macho32 backend, as well; ideally the two should be merged as they are really very similar and we don't want to have these kinds of cross-porting problems. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* | nasmdoc.src: update copyright dateH. Peter Anvin2016-02-081-1/+1
| |
* | Remove the --allow-64-bits option and make it a warningH. Peter Anvin2016-02-085-29/+29
| | | | | | | | | | | | | | | | | | | | | | | | Remove the --allow-64-bits relocation, and instead make it a suppressible warning in the case of a zero-extended relocation, and an error in the case of a sign-extended relocation. Relocations which can be losslessly represented in the output format do not issue any diagnostic at all, as there is no problem in that case. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* | nasmlib.h: Add #undef for ZERO_BUF_SIZEH. Peter Anvin2016-02-081-0/+1
| | | | | | | | | | | | | | If we are redefining ZERO_BUF_SIZE, add an #undef to avoid nuisance compiler warnings. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* | nasmlib: Factor out common code from the panic() macroH. Peter Anvin2016-02-082-1/+7
| | | | | | | | | | | | | | There is no reason to pass a constant and a string from each call site. Move that into a separate out of line function. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* | Merge branch 'master' of ssh://repo.or.cz/srv/git/nasmH. Peter Anvin2016-02-087-10/+26
|\ \ | |/
| * nasmlib: Add generic panic() macro, and no-return nasm_panic()H. Peter Anvin2016-02-023-7/+23
| | | | | | | | | | | | | | | | | | Add a generic panic() macro which we can simply insert where an internal error happens. Also, create a nasm_panic() function the only purpose of which is to let the compiler know that we will never return after a panic. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
| * Use a more optimal value for the UNUSED slotH. Peter Anvin2016-01-294-4/+4
| | | | | | | | | | | | | | | | Instead of ~1/4 the range we can use ~1/3 the range for better distance. It is possible that using ~1/2 - 1 might be even better, but this is a trivial tweak. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* | nasmlib.h: If BUFSIZ is bigger than the default ZERO_BUF_SIZE, adjustH. Peter Anvin2016-01-281-2/+5
|/ | | | | | | | If BUFSIZ exists and is bigger than the default ZERO_BUF_SIZE, expand ZERO_BUF_SIZE so we don't end up unnecessarily double buffering in the stdio library. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* NASM 2.12rc2nasm-2.12rc2H. Peter Anvin2016-01-271-1/+1
|
* compiler.h: disable __STRICT_ANSI__ for djgppH. Peter Anvin2016-01-271-1/+6
| | | | | | | | Undefine __STRICT_ANSI__ for djgpp; it removes the prototypes for non-ANSI functions which is not at all what this symbol is intended for. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* realpath.c: remove testing #ifdef unintentionally left inH. Peter Anvin2016-01-271-1/+1
| | | | | | | Remove the #if 0 for canonicalize_file_name(). This was added to test the realpath() code, and inadvertently left in. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* Add option to allow 64-bit code in any output formatKnut St. Osmundsen2016-01-262-15/+38
| | | | | | | | | | | | | | | | | | | | Add the option --allow-64-bit to permit the generation of 64-bit code even for a 16/32-bit output format. Using NASM to do some boot strapping code and ran into trouble when trying to emit a few 64-bit instructions in the OMF object file doing the mode switching. While I can see how the "error: obj output format does not support 64-bit code" message can be a useful reality check for application programmers, it prevents low-level programmers from doing what they want. It if was just a harmless warning, it wouldn't be so bad, but it turns BITS 64 into BITS 16. The main trick to mixing 64-bit code into OMF and other 32-bit output formats is to avoid 64-bit sized fixups, which normally isn't too hard. [hpa: shortened the option name to --allow-64-bit, minor code cleanups] Signed-off-by: Knut St. Osmundsen <bird-nasm@anduin.net> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* make alldeps to remove unnecessary dependencies for realpath.cH. Peter Anvin2016-01-265-15/+5
| | | | | | | The previous commit contained unnecessary dependencies for realpath.c so run make alldeps to remove those. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* NASM 2.12rc1nasm-2.12rc1H. Peter Anvin2016-01-261-1/+1
|
* Portability improvements to nasm_realpath()H. Peter Anvin2016-01-268-22/+201
| | | | | | | | Try harder to nasm_realpath() to be as portable as possible. Move it to a separate file since it has gotten complex enough that it is cleaner that way. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* coff: Add support for the Codeview 8 debug formatJim Kukunas2016-01-245-162/+927
| | | | | | | | | | | Codeview is a debug format for win32/win64 PE/COFF files. It adds two sections, .debug$S (symbols) and .debug$T (types), to the generated object file. These sections are then used by the linker to generate a PDB file which can be used by various debuggers (WinDbg, Visual Studio, etc). Signed-off-by: Jim Kukunas <james.t.kukunas@linux.intel.com> Acked-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* Add a MD5 implementationJim Kukunas2016-01-244-2/+274
| | | | | | | | | | | | This implementation was written by Colin Plumb and is in the public domain. I've updated it to use stdint.h and the standard C types rather than sys/types.h for portability. Signed-off-by: Jim Kukunas <james.t.kukunas@linux.intel.com> Acked-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* nasmlib: Add nasm_realpath()Jim Kukunas2016-01-242-0/+19
| | | | | | | | Converts a relative pathname to an absolute pathname. Signed-off-by: Jim Kukunas <james.t.kukunas@linux.intel.com> Acked-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* NASM 2.11.09rc2nasm-2.11.09rc2H. Peter Anvin2016-01-151-1/+1
|
* smartalign.mac: Ignore smartalign in preprocess-only modeH. Peter Anvin2016-01-151-1/+3
| | | | | | | | | | | | | | When running in preprocess-only mode generate the equivalent of standard alignment using nops. This at the very least allows some kind of reasonable output and allows for dependency generation to proceed; the only way to *really* address this problem is to move alignment generation into the assembler proper; this would also allow the align/alignb distinction to be removed and handle padding with instructions which are more than one byte. This should resolve bug 3392319. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* disasm: Drop unused variableCyrill Gorcunov2015-11-051-2/+0
| | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* disasm: Fix disassembling of evex prefixCyrill Gorcunov2015-11-051-3/+3
| | | | | | | | | | | | | | | | | As been pointed by @hpa evex is pretty fine in ia-32. Quoting Peter | This is wrong, though; EVEX is permitted in 32-bit mode just as VEX is. | The key thing is that bits [7:5] have to be 1 in 32-bit mode. It is | unclear what happens if these bits are 110 as that depends on if it is | decoded using the modr/m decoder or not. For VEX prefixes we accept | them as VEX in that case, which may not match the CPU. This is a fix for commit db6ecf9b76a2 Reported-by: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* output: macho64 -- Fix OUT_REL4ADR on bigendiansCyrill Gorcunov2015-11-051-4/+5
| | | | | | | | | | | | We're converting address value into bigendian (on BE machine) and then continue doing arithmetics on top, which is of course incorrect. Instead do all operations first then convert to BE and write it into image. Reported-by: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* Restore AC_C_INLINEH. Peter Anvin2015-11-041-0/+1
| | | | | | | Checkin 7729edf7224e39628bd342c3a3bb44c1753bdfb0 removed AC_C_INLINE, presumably inadvertently. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* disasm: Fix for disassembly of BOUNDMark Scott2015-11-031-1/+1
| | | | | | | | | | | | | The opcode for BOUND, 62h, has a different meaning in long mode - it is the prefix for EVEX instructions. ndisasm did not take this into account and always tried to disassemble 62h back to an EVEX instruction. Attached patch only permits EVEX disassembly if bitness is 64. In 16/32 bit mode 62h will be not be a prefix and so disassemble to BOUND. Signed-off-by: Mark Scott <nasm@mscott.cx> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>