diff options
author | H. Peter Anvin <hpa@zytor.com> | 2009-06-25 12:30:50 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2009-06-25 12:30:50 -0700 |
commit | d219a3e46f0a9fe2b997eee8acd6bbe212bef4da (patch) | |
tree | 2b0ccd7055c93a75a332f3f805d17a2a43e8025f /output/outelf.c | |
parent | 538628803ba8c0b6cf9d11f83f43fb678fd05e87 (diff) | |
download | nasm-d219a3e46f0a9fe2b997eee8acd6bbe212bef4da.tar.gz nasm-d219a3e46f0a9fe2b997eee8acd6bbe212bef4da.tar.bz2 nasm-d219a3e46f0a9fe2b997eee8acd6bbe212bef4da.zip |
ELF: add header files, begin merging common code, drop .comment
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>
Diffstat (limited to 'output/outelf.c')
-rw-r--r-- | output/outelf.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/output/outelf.c b/output/outelf.c new file mode 100644 index 0000000..69acf3f --- /dev/null +++ b/output/outelf.c @@ -0,0 +1,29 @@ +/* + * Common code for outelf32 and outelf64 + */ + +#include "compiler.h" + +#include <stdio.h> +#include <stdlib.h> +#include <inttypes.h> + +#include "nasm.h" + +#include "elfcommon.h" +#include "dwarf.h" +#include "outelf.h" + +const struct elf_known_section elf_known_sections[] = { + { ".text", SHT_PROGBITS, SHF_ALLOC|SHF_EXECINSTR, 16 }, + { ".rodata", SHT_PROGBITS, SHF_ALLOC, 4 }, + { ".lrodata", SHT_PROGBITS, SHF_ALLOC, 4 }, + { ".data", SHT_PROGBITS, SHF_ALLOC|SHF_WRITE, 4 }, + { ".ldata", SHT_PROGBITS, SHF_ALLOC|SHF_WRITE, 4 }, + { ".bss", SHT_NOBITS, SHF_ALLOC|SHF_WRITE, 4 }, + { ".lbss", SHT_NOBITS, SHF_ALLOC|SHF_WRITE, 4 }, + { ".tdata", SHT_PROGBITS, SHF_ALLOC|SHF_WRITE|SHF_TLS, 4 }, + { ".tbss", SHT_NOBITS, SHF_ALLOC|SHF_WRITE|SHF_TLS, 4 }, + { ".comment", SHT_PROGBITS, 0, 1 }, + { NULL, SHT_PROGBITS, SHF_ALLOC, 1 } /* default */ +}; |