summaryrefslogtreecommitdiff
path: root/output/outelf64.c
AgeCommit message (Collapse)AuthorFilesLines
2013-02-25Fix warnings generated by clang 3.0Andrew Nayenko1-1/+1
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-16output: Add more Elf unificationCyrill Gorcunov1-20/+21
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>
2011-08-28elf64: Make linelist to look the same as elf32Cyrill Gorcunov1-3/+3
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-02-28elf64: Use nasm_zalloc helperCyrill Gorcunov1-19/+11
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-30elf: Move stabs symbol table format into outelf.hCyrill Gorcunov1-8/+0
Get rid of code duplication Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.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 Anvin1-10/+33
Support 8-bit relocations (OUT_ADDRESS and OUT_REL1ADR) in ELF. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-04-21Rename SEGALIGN to SECTALIGNCyrill Gorcunov1-3/+3
"sectalign" is preferred over "segalign" since it operates over section attributes. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-21Elf64: Implement segalign handlerCyrill Gorcunov1-1/+19
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-21ofmt: Implement null_segalign stubsCyrill Gorcunov1-0/+1
Set stubs for all targets Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-21Elf: Rename SEG_ALIGN to SEC_FILEALIGNCyrill Gorcunov1-3/+3
It's Elf specifics. To not mess with segment alignment. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-10Elf: Some unification snippets for 32/64 bit versionsCyrill Gorcunov1-5/+8
Nothing serious, comments and style movements. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-10Elf: Merge WRITE_STAB to outelf.hCyrill Gorcunov1-9/+0
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-10Elf: Drop never used SOC helperCyrill Gorcunov1-2/+0
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-10Elf: Introduce section_attrib helperCyrill Gorcunov1-47/+2
In a sake of removing code duplication. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-02-11Use ALIGN helperCyrill Gorcunov1-3/+3
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-01-03ELF: Explicitly point out SYM_GLOBAL, SYM_LOCAL bindingCyrill Gorcunov1-2/+1
Instead of implicit declaration of global symbols obtained by STB_GLOBAL << 4, and local symbols by STB_LOCAL << 4 use ELF32_ST_MKBIND helpers. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-01-03output/outelfX.c: Use definitions from stabs.hCyrill Gorcunov1-7/+1
Also made Makefile.in to handle dependency. There are some makefiles in Mkfiles\ should be fixed as well. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-01-03outelfX.c: Trivial cleanupCyrill Gorcunov1-224/+224
Some tab\space convertions together with trivial style nitfix. No change on binary level. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-01-02Elf: Allow symbols binding to undefined sectionCyrill Gorcunov1-4/+2
Commit 2ddcd03900d134772e98acf8cab17a12cc0c3f2a did bind symbols (in case of omitted SECTION directive) to .text section but break COMMON binding. Fix it. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-12-10Elf: bind labels to text section by defaultCyrill Gorcunov1-11/+12
In case if SECTION directive is omitted but the real code exist we form .text section by default and put compiled code here. In turn labels are not handled in a same manner. So lets bind them to text section by default as well. [ BR: 2835192 ] Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-06outelf32/64 - various cleanups in a sake of unificationCyrill Gorcunov1-146/+139
Make a small step forward elf32/64 unification procedure. Mostly style fixes. Nothing serious. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-06dwarfX_output: dont check for "ln" twiceCyrill Gorcunov1-45/+35
And make dwarf64 version to be more familiar to 32bit version (preparation work for merge). Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-06output/outelf64.c: simplify stabs64_cleanup, dwarf64_cleanupCyrill Gorcunov1-26/+13
nasm_free is failsafe against NULL passed Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-06Merge elf header filesCyrill Gorcunov1-1/+1
Merge elfcommon.h, elf32.h, elf64.h into single elf.h -- we do support both elf32 and elf64 anyway. Let put them into common place. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-31output/outelf32-64: use string helpersCyrill Gorcunov1-16/+6
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-31Remove outdated commentsCyrill Gorcunov1-2/+2
From Frank Kotler: | ... | > - stdscan_bufptr = saveme; /* bugfix? fbk 8/10/00 */ | > + stdscan_set(saveme); /* bugfix? fbk 8/10/00 */ | | While you're at it, you could remove my comment(s - it seems to have | reproduced). It *is* a bugfix (apparently). "saveme" might have a better | name, too... So get rid of the comments. Reported-by: Frank Kotler <fbkotler@zytor.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-31stdscan: switch to stdscan_get/set routinesCyrill Gorcunov1-4/+4
Instead of manipulating stdscan buffer pointer directly we switch to a routine interface. This allow us to unify stdscan access: ie caller should "talk" to stdscan via stdscan_get/set routines. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-09-14elf,stabs: stabs32/64_generate -- append ending tokenCyrill Gorcunov1-9/+11
This represent "end of compilation unit" token. Since gcc does (almost) the same lets be on the same side. Though to be precise gcc puts offset which points to the first byte right after the last instruction issued but in fact string index is analyzed only so we may safely write zero here (without relocation as well). Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-08-11Fix some format strings for nasm_errorVictor van den Elzen1-9/+11
Added a format attribute to nasm_error (only for GCC) and used the resulting warnings to fix some format strings.
2009-07-18Drop the ofmt and errfunc arguments to label definition functionsH. Peter Anvin1-12/+6
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 Anvin1-104/+92
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-13Merge branch 'master' into new-preprocH. Peter Anvin1-0/+4
Conflicts: .gitignore
2009-07-13ELF: add debug support for TY_YWORDH. Peter Anvin1-0/+4
Add debug support for TY_YWORD (256 bits/32 bytes). Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-12Hash even backend-specific directives, unify null functionsH. Peter Anvin1-4/+6
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 Anvin1-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>
2009-07-05Make it possible for outputs to be either text or binaryH. Peter Anvin1-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>
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 Anvin1-6/+36
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-27Move backend-specific code to output/; break out null debug stuffH. Peter Anvin1-2/+2
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 Anvin1-10/+1
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-25ELF: make debugging functions staticH. Peter Anvin1-32/+35
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 Anvin1-5/+9
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 Anvin1-20/+30
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: eliminate hard-coded section numbersH. Peter Anvin1-31/+51
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 Anvin1-3/+3
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 Anvin1-174/+31
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-03-18outelf32/64: fix uninitialized rbtreeMichael Scherer1-0/+2
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.
2009-02-21outelf32/64: remove align_str in favor of fwritezero()H. Peter Anvin1-4/+2
Drop the use of yet another local all-zero buffer, align_str, in favor of calling fwritezero().