diff --git a/usr.bin/elf2aout/elf2aout.c b/usr.bin/elf2aout/elf2aout.c index 972b764bed47..a02a1558564f 100644 --- a/usr.bin/elf2aout/elf2aout.c +++ b/usr.bin/elf2aout/elf2aout.c @@ -1,4 +1,4 @@ -/* $NetBSD: elf2aout.c,v 1.6 1998/11/27 05:09:49 simonb Exp $ */ +/* $NetBSD: elf2aout.c,v 1.7 1999/11/02 21:13:17 drochner Exp $ */ /* * Copyright (c) 1995 @@ -49,13 +49,6 @@ #include -/* Elf Program segment permissions, in program header flags field */ - -#define PF_X (1 << 0)/* Segment is executable */ -#define PF_W (1 << 1)/* Segment is writable */ -#define PF_R (1 << 2)/* Segment is readable */ -#define PF_MASKPROC 0xF0000000 /* Processor-specific reserved bits */ - struct sect { unsigned long vaddr; unsigned long len; @@ -163,12 +156,12 @@ usage: qsort(ph, ex.e_phnum, sizeof(Elf32_Phdr), phcmp); for (i = 0; i < ex.e_phnum; i++) { /* Section types we can ignore... */ - if (ph[i].p_type == Elf_pt_null || ph[i].p_type == Elf_pt_note || - ph[i].p_type == Elf_pt_phdr || ph[i].p_type == Elf_pt_mips_reginfo) + if (ph[i].p_type == PT_NULL || ph[i].p_type == PT_NOTE || + ph[i].p_type == PT_PHDR || ph[i].p_type == PT_MIPS_REGINFO) continue; /* Section types we can't handle... */ else - if (ph[i].p_type != Elf_pt_load) + if (ph[i].p_type != PT_LOAD) errx(1, "Program header %d type %d can't be converted.", i, ph[i].p_type); /* Writable (data) segment? */ if (ph[i].p_flags & PF_W) { @@ -248,7 +241,7 @@ usage: for (i = 0; i < ex.e_phnum; i++) { /* Unprocessable sections were handled above, so just verify * that the section can be loaded before copying. */ - if (ph[i].p_type == Elf_pt_load && ph[i].p_filesz) { + if (ph[i].p_type == PT_LOAD && ph[i].p_filesz) { if (cur_vma != ph[i].p_vaddr) { unsigned long gap = ph[i].p_vaddr - cur_vma; char obuf[1024]; @@ -355,26 +348,26 @@ translate_syms(out, in, symoff, symsize, stroff, strsize) outbuf[i].n_un.n_strx = nsp - newstrings + 4; nsp += strlen(nsp) + 1; - type = ELF_SYM_TYPE(inbuf[i].st_info); - binding = ELF_SYM_BIND(inbuf[i].st_info); + type = ELF32_ST_TYPE(inbuf[i].st_info); + binding = ELF32_ST_BIND(inbuf[i].st_info); /* Convert ELF symbol type/section/etc info into a.out * type info. */ - if (type == Elf_estt_file) + if (type == STT_FILE) outbuf[i].n_type = N_FN; else - if (inbuf[i].st_shndx == Elf_eshn_undefined) + if (inbuf[i].st_shndx == SHN_UNDEF) outbuf[i].n_type = N_UNDF; else - if (inbuf[i].st_shndx == Elf_eshn_absolute) + if (inbuf[i].st_shndx == SHN_ABS) outbuf[i].n_type = N_ABS; else - if (inbuf[i].st_shndx == Elf_eshn_common || - inbuf[i].st_shndx == Elf_eshn_mips_acommon) + if (inbuf[i].st_shndx == SHN_COMMON || + inbuf[i].st_shndx == SHN_MIPS_ACOMMON) outbuf[i].n_type = N_COMM; else outbuf[i].n_type = symTypeTable[inbuf[i].st_shndx]; - if (binding == Elf_estb_global) + if (binding == STB_GLOBAL) outbuf[i].n_type |= N_EXT; /* Symbol values in executables should be compatible. */ outbuf[i].n_value = inbuf[i].st_value; diff --git a/usr.bin/elf2ecoff/elf2ecoff.c b/usr.bin/elf2ecoff/elf2ecoff.c index 505dc62f6a19..43f35b19d675 100644 --- a/usr.bin/elf2ecoff/elf2ecoff.c +++ b/usr.bin/elf2ecoff/elf2ecoff.c @@ -1,4 +1,4 @@ -/* $NetBSD: elf2ecoff.c,v 1.12 1999/01/11 22:40:00 kleink Exp $ */ +/* $NetBSD: elf2ecoff.c,v 1.13 1999/11/02 21:13:18 drochner Exp $ */ /* * Copyright (c) 1997 Jonathan Stone @@ -52,14 +52,6 @@ #include -/* Elf Program segment permissions, in program header flags field */ - -#define PF_X (1 << 0)/* Segment is executable */ -#define PF_W (1 << 1)/* Segment is writable */ -#define PF_R (1 << 2)/* Segment is readable */ -#define PF_MASKPROC 0xF0000000 /* Processor-specific reserved bits */ - - #define ISLAST(p) (p->n_un.n_name == 0 || p->n_un.n_name[0] == 0) struct sect { @@ -211,9 +203,9 @@ usage: for (i = 0; i < ex.e_phnum; i++) { /* Section types we can ignore... */ - if (ph[i].p_type == Elf_pt_null || ph[i].p_type == Elf_pt_note || - ph[i].p_type == Elf_pt_phdr || - ph[i].p_type == Elf_pt_mips_reginfo) { + if (ph[i].p_type == PT_NULL || ph[i].p_type == PT_NOTE || + ph[i].p_type == PT_PHDR || + ph[i].p_type == PT_MIPS_REGINFO) { if (debug) { fprintf(stderr, " skipping PH %d type %d flags 0x%x\n", @@ -223,7 +215,7 @@ usage: } /* Section types we can't handle... */ else - if (ph[i].p_type != Elf_pt_load) { + if (ph[i].p_type != PT_LOAD) { fprintf(stderr, "Program header %d type %d can't be converted.\n", i, ph[i].p_type); exit(1); @@ -350,7 +342,7 @@ usage: for (i = 0; i < ex.e_phnum; i++) { /* Unprocessable sections were handled above, so just verify * that the section can be loaded before copying. */ - if (ph[i].p_type == Elf_pt_load && ph[i].p_filesz) { + if (ph[i].p_type == PT_LOAD && ph[i].p_filesz) { if (cur_vma != ph[i].p_vaddr) { unsigned long gap = ph[i].p_vaddr - cur_vma; char obuf[1024]; @@ -719,8 +711,8 @@ translate_syms(elfp, ecoffp) for (i = 0; i < nsyms; i++) { int binding, type; - binding = ELF_SYM_BIND((elfp->elf_syms[i].st_info)); - type = ELF_SYM_TYPE((elfp->elf_syms[i].st_info)); + binding = ELF32_ST_BIND((elfp->elf_syms[i].st_info)); + type = ELF32_ST_TYPE((elfp->elf_syms[i].st_info)); /* skip strange symbols */ if (binding == 0) {