Age | Commit message (Collapse) | Author | Files | Lines |
|
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>
|
|
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>
|
|
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
Get rid of code duplication
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
|
|
Support 8-bit relocations (OUT_ADDRESS and OUT_REL1ADR) in ELF.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
|
|
"sectalign" is preferred over "segalign"
since it operates over section attributes.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
Set stubs for all targets
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
It's Elf specifics. To not mess with segment alignment.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
Nothing serious, comments and style movements.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
In a sake of removing code duplication.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
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>
|
|
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>
|
|
Some tab\space convertions together with
trivial style nitfix.
No change on binary level.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
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>
|
|
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>
|
|
Make a small step forward elf32/64 unification procedure.
Mostly style fixes. Nothing serious.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
And make dwarf64 version to be more familiar to
32bit version (preparation work for merge).
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
nasm_free is failsafe against NULL passed
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
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>
|
|
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
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>
|
|
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>
|
|
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>
|
|
Added a format attribute to nasm_error (only for GCC) and
used the resulting warnings to fix some format strings.
|
|
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>
|
|
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>
|
|
Conflicts:
.gitignore
|
|
Add debug support for TY_YWORD (256 bits/32 bytes).
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
The debugging functions can and should all be static.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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.
|
|
Drop the use of yet another local all-zero buffer, align_str, in favor
of calling fwritezero().
|