Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Update to match new SVR4-style definition names in <sys/exec...



details:   https://anonhg.NetBSD.org/src/rev/fd67f1f846b7
branches:  trunk
changeset: 477620:fd67f1f846b7
user:      kleink <kleink%NetBSD.org@localhost>
date:      Mon Oct 25 13:55:06 1999 +0000

description:
Update to match new SVR4-style definition names in <sys/exec_elf.h>.

diffstat:

 lib/libc/gen/nlist_elf32.c                             |  21 ++--
 libexec/ld.elf_so/arch/mips/mips_reloc.c               |  23 ++--
 libexec/ld.elf_so/arch/powerpc/ppc_reloc.c             |   4 +-
 libexec/ld.elf_so/headers.c                            |  68 ++++++------
 libexec/ld.elf_so/map_object.c                         |  27 ++--
 libexec/ld.elf_so/rtld.c                               |  36 +++---
 libexec/ld.elf_so/search.c                             |  13 +-
 libexec/ld.elf_so/symbol.c                             |   6 +-
 sbin/modload/elf.c                                     |  11 +-
 sys/arch/alpha/include/elf_machdep.h                   |   8 +-
 sys/arch/bebox/stand/elf2pef/elf2pef.c                 |   7 +-
 sys/arch/hpcmips/include/elf_machdep.h                 |   4 +-
 sys/arch/hpcmips/stand/pbsdboot/elf.c                  |   8 +-
 sys/arch/i386/include/elf_machdep.h                    |   8 +-
 sys/arch/m68k/include/elf_machdep.h                    |   6 +-
 sys/arch/mips/include/elf_machdep.h                    |   4 +-
 sys/arch/mips/mips/elf.c                               |  79 ++++++++-------
 sys/arch/newsmips/include/elf_machdep.h                |   4 +-
 sys/arch/newsmips/stand/installboot/installboot.c      |   4 +-
 sys/arch/ofppc/stand/ofwboot/boot.c                    |  21 ++--
 sys/arch/pmax/include/elf_machdep.h                    |   4 +-
 sys/arch/pmax/stand/scsiboot/bootxx.c                  |   7 +-
 sys/arch/pmax/stand/smallnet/setnetimage/setnetimage.c |   7 +-
 sys/arch/powerpc/include/elf_machdep.h                 |   6 +-
 sys/arch/sh3/include/elf_machdep.h                     |   6 +-
 sys/arch/sparc/include/elf_machdep.h                   |  14 +-
 sys/arch/sparc64/include/elf_machdep.h                 |  14 +-
 sys/arch/sparc64/stand/ofwboot/boot.c                  |  24 ++--
 sys/arch/sparc64/stand/ofwboot/elfXX_exec.c            |  18 +-
 sys/arch/vax/include/elf_machdep.h                     |   6 +-
 sys/compat/freebsd/freebsd_exec.c                      |   8 +-
 sys/compat/ibcs2/ibcs2_exec.c                          |   4 +-
 sys/compat/linux/common/linux_exec_elf32.c             |  24 ++--
 sys/compat/svr4/svr4_exec.c                            |  10 +-
 sys/ddb/db_elf.c                                       |  33 +++---
 sys/kern/exec_conf.c                                   |   6 +-
 sys/kern/exec_elf32.c                                  |  88 +++++++++---------
 sys/lib/libsa/loadfile.c                               |  19 ++-
 usr.bin/crunch/crunchide/exec_elf32.c                  |  11 +-
 usr.sbin/kvm_mkdb/nlist_elf32.c                        |  21 ++--
 usr.sbin/mdsetimage/exec_elf32.c                       |   7 +-
 41 files changed, 358 insertions(+), 341 deletions(-)

diffs (truncated from 1996 to 300 lines):

diff -r 9f0909d7b896 -r fd67f1f846b7 lib/libc/gen/nlist_elf32.c
--- a/lib/libc/gen/nlist_elf32.c        Mon Oct 25 13:47:10 1999 +0000
+++ b/lib/libc/gen/nlist_elf32.c        Mon Oct 25 13:55:06 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nlist_elf32.c,v 1.17 1999/10/22 10:10:36 hannken Exp $ */
+/*     $NetBSD: nlist_elf32.c,v 1.18 1999/10/25 13:57:11 kleink Exp $  */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -124,7 +124,8 @@
                BADUNMAP;
        ehdrp = (Elf_Ehdr *)(void *)&mappedfile[0];
 
-       if (memcmp(ehdrp->e_ident, Elf_e_ident, Elf_e_siz))
+       if (memcmp(ehdrp->e_ident, ELFMAG, SELFMAG) != 0 ||
+           ehdrp->e_ident[EI_CLASS] != ELFCLASS)
                BADUNMAP;
 
        switch (ehdrp->e_machine) {
@@ -147,7 +148,7 @@
        shdrp = (Elf_Shdr *)(void *)&mappedfile[shdr_off];
 
        for (i = 0; i < nshdr; i++) {
-               if (shdrp[i].sh_type == Elf_sht_symtab) {
+               if (shdrp[i].sh_type == SHT_SYMTAB) {
                        symshdrp = &shdrp[i];
                        symstrshdrp = &shdrp[shdrp[i].sh_link];
                }
@@ -201,25 +202,25 @@
                                 * Translate (roughly) from ELF to nlist
                                 */
                                p->n_value = symp[i].st_value;
-                               switch(ELF_SYM_TYPE(symp[i].st_info)) {
-                               case Elf_estt_notype:
+                               switch (ELFDEFNNAME(ST_TYPE)(symp[i].st_info)) {
+                               case STT_NOTYPE:
                                        p->n_type = N_UNDF;
                                        break;
-                               case Elf_estt_object:
+                               case STT_OBJECT:
                                        p->n_type = N_DATA;
                                        break;
-                               case Elf_estt_func:
+                               case STT_FUNC:
                                        p->n_type = N_TEXT;
                                        break;
-                               case Elf_estt_file:
+                               case STT_FILE:
                                        p->n_type = N_FN;
                                        break;
                                default:
                                        /* catch other enumerations for gcc */
                                        break;
                                }
-                               if (ELF_SYM_BIND(symp[i].st_info) !=
-                                   Elf_estb_local)
+                               if (ELFDEFNNAME(ST_BIND)(symp[i].st_info) !=
+                                   STB_LOCAL)
                                        p->n_type |= N_EXT;
                                p->n_desc = 0;                  /* XXX */
                                p->n_other = 0;                 /* XXX */
diff -r 9f0909d7b896 -r fd67f1f846b7 libexec/ld.elf_so/arch/mips/mips_reloc.c
--- a/libexec/ld.elf_so/arch/mips/mips_reloc.c  Mon Oct 25 13:47:10 1999 +0000
+++ b/libexec/ld.elf_so/arch/mips/mips_reloc.c  Mon Oct 25 13:55:06 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mips_reloc.c,v 1.1 1998/03/25 04:12:32 mhitch Exp $    */
+/*     $NetBSD: mips_reloc.c,v 1.2 1999/10/25 13:57:12 kleink Exp $    */
 
 /*
  * Copyright 1997 Michael L. Hitch <mhitch%montana.edu@localhost>
@@ -60,11 +60,11 @@
                def = _rtld_find_symdef(_rtld_objlist, 0,
                    sym->st_name + obj->strtab, obj, &defobj, true);
                if (def != NULL) {
-                       if (sym->st_shndx == Elf_eshn_undefined) {
+                       if (sym->st_shndx == SHN_UNDEF) {
 #if 0  /* These don't seem to work? */
 
-                               if (ELF_SYM_TYPE(sym->st_info) ==
-                                   Elf_estt_func) {
+                               if (ELFDEFNNAME(ST_TYPE)(sym->st_info) ==
+                                   STT_FUNC) {
                                        if (sym->st_value)
                                                *got = sym->st_value +
                                                    (Elf_Word)obj->relocbase;
@@ -75,16 +75,17 @@
 #endif
                                        *got = def->st_value +
                                            (Elf_Word)defobj->relocbase;
-                       } else if (sym->st_shndx == Elf_eshn_common) {
+                       } else if (sym->st_shndx == SHN_COMMON) {
                                *got = def->st_value +
                                    (Elf_Word)defobj->relocbase;
-                       } else if (ELF_SYM_TYPE(sym->st_info) == Elf_estt_func
-                           && *got != sym->st_value) {
+                       } else if (ELFDEFNNAME(ST_TYPE)(sym->st_info) ==
+                           STT_FUNC &&
+                           *got != sym->st_value) {
                                *got += (Elf_Word)obj->relocbase;
-                       } else if (ELF_SYM_TYPE(sym->st_info) ==
-                           Elf_estt_section && ELF_SYM_BIND(sym->st_info) ==
-                           Elf_estb_global) {
-                               if (sym->st_shndx == Elf_eshn_absolute)
+                       } else if (ELFDEFNNAME(ST_TYPE)(sym->st_info) ==
+                           STT_SECTION && ELFDEFNNAME(ST_BIND)(sym->st_info) ==
+                           STB_GLOBAL) {
+                               if (sym->st_shndx == SHN_ABS)
                                        *got = sym->st_value +
                                            (Elf_Word)obj->relocbase;
                                /* else SGI stuff ignored */
diff -r 9f0909d7b896 -r fd67f1f846b7 libexec/ld.elf_so/arch/powerpc/ppc_reloc.c
--- a/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c        Mon Oct 25 13:47:10 1999 +0000
+++ b/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c        Mon Oct 25 13:55:06 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ppc_reloc.c,v 1.4 1999/04/17 21:16:46 ws Exp $ */
+/*     $NetBSD: ppc_reloc.c,v 1.5 1999/10/25 13:57:12 kleink Exp $     */
 
 /*-
  * Copyright (C) 1998  Tsubai Masanari
@@ -117,7 +117,7 @@
        Elf_Addr targ_addr;
        int distance;
 
-       assert(ELF_R_TYPE(rela->r_info) == R_TYPE(JMP_SLOT));
+       assert(ELFDEFNNAME(ST_TYPE)(rela->r_info) == R_TYPE(JMP_SLOT));
 
        def = _rtld_find_symdef(_rtld_objlist, rela->r_info, NULL, obj,
                                &defobj, true);
diff -r 9f0909d7b896 -r fd67f1f846b7 libexec/ld.elf_so/headers.c
--- a/libexec/ld.elf_so/headers.c       Mon Oct 25 13:47:10 1999 +0000
+++ b/libexec/ld.elf_so/headers.c       Mon Oct 25 13:55:06 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: headers.c,v 1.4 1999/03/01 16:40:07 christos Exp $      */
+/*     $NetBSD: headers.c,v 1.5 1999/10/25 13:57:12 kleink Exp $        */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -63,28 +63,28 @@
        Elf_Dyn        *dynp;
        Needed_Entry  **needed_tail = &obj->needed;
        const Elf_Dyn  *dyn_rpath = NULL;
-       enum Elf_e_dynamic_type plttype = Elf_edt_rel;
+       Elf_Sword       plttype = DT_REL;
        Elf_Word        relsz = 0, relasz = 0;
        Elf_Word        pltrelsz = 0, pltrelasz = 0;
 
-       for (dynp = obj->dynamic; dynp->d_tag != Elf_edt_null; ++dynp) {
+       for (dynp = obj->dynamic; dynp->d_tag != DT_NULL; ++dynp) {
                switch (dynp->d_tag) {
 
-               case Elf_edt_rel:
+               case DT_REL:
                        obj->rel = (const Elf_Rel *)
                            (obj->relocbase + dynp->d_un.d_ptr);
                        break;
 
-               case Elf_edt_relsz:
+               case DT_RELSZ:
                        relsz = dynp->d_un.d_val;
                        break;
 
-               case Elf_edt_relent:
+               case DT_RELENT:
                        assert(dynp->d_un.d_val == sizeof(Elf_Rel));
                        break;
 
-               case Elf_edt_jmprel:
-                       if (plttype == Elf_edt_rel) {
+               case DT_JMPREL:
+                       if (plttype == DT_REL) {
                                obj->pltrel = (const Elf_Rel *)
                                    (obj->relocbase + dynp->d_un.d_ptr);
                        } else {
@@ -93,32 +93,32 @@
                        }
                        break;
 
-               case Elf_edt_pltrelsz:
-                       if (plttype == Elf_edt_rel) {
+               case DT_PLTRELSZ:
+                       if (plttype == DT_REL) {
                                pltrelsz = dynp->d_un.d_val;
                        } else {
                                pltrelasz = dynp->d_un.d_val;
                        }
                        break;
 
-               case Elf_edt_rela:
+               case DT_RELA:
                        obj->rela = (const Elf_RelA *)
                            (obj->relocbase + dynp->d_un.d_ptr);
                        break;
 
-               case Elf_edt_relasz:
+               case DT_RELASZ:
                        relasz = dynp->d_un.d_val;
                        break;
 
-               case Elf_edt_relaent:
+               case DT_RELAENT:
                        assert(dynp->d_un.d_val == sizeof(Elf_RelA));
                        break;
 
-               case Elf_edt_pltrel:
+               case DT_PLTREL:
                        plttype = dynp->d_un.d_val;
-                       assert(plttype == Elf_edt_rel ||
-                           plttype == Elf_edt_rela);
-                       if (plttype == Elf_edt_rela) {
+                       assert(plttype == DT_REL ||
+                           plttype == DT_RELA);
+                       if (plttype == DT_RELA) {
                                obj->pltrela = (const Elf_RelA *) obj->pltrel;
                                obj->pltrel = NULL;
                                pltrelasz = pltrelsz;
@@ -126,25 +126,25 @@
                        }
                        break;
 
-               case Elf_edt_symtab:
+               case DT_SYMTAB:
                        obj->symtab = (const Elf_Sym *)
                                (obj->relocbase + dynp->d_un.d_ptr);
                        break;
 
-               case Elf_edt_syment:
+               case DT_SYMENT:
                        assert(dynp->d_un.d_val == sizeof(Elf_Sym));
                        break;
 
-               case Elf_edt_strtab:
+               case DT_STRTAB:
                        obj->strtab = (const char *)
                            (obj->relocbase + dynp->d_un.d_ptr);
                        break;
 
-               case Elf_edt_strsz:
+               case DT_STRSZ:
                        obj->strsize = dynp->d_un.d_val;
                        break;
 
-               case Elf_edt_hash:
+               case DT_HASH:
                        {
                                const Elf_Word *hashtab = (const Elf_Word *)
                                (obj->relocbase + dynp->d_un.d_ptr);
@@ -156,7 +156,7 @@
                        }
                        break;
 
-               case Elf_edt_needed:
+               case DT_NEEDED:
                        assert(!obj->rtld);
                        {
                                Needed_Entry *nep = NEW(Needed_Entry);
@@ -170,20 +170,20 @@
                        }
                        break;
 
-               case Elf_edt_pltgot:
+               case DT_PLTGOT:
                        obj->pltgot = (Elf_Addr *)
                            (obj->relocbase + dynp->d_un.d_ptr);
                        break;
 
-               case Elf_edt_textrel:
+               case DT_TEXTREL:
                        obj->textrel = true;
                        break;
 
-               case Elf_edt_symbolic:
+               case DT_SYMBOLIC:
                        obj->symbolic = true;
                        break;
 
-               case Elf_edt_rpath:
+               case DT_RPATH:
                        /*
                         * We have to wait until later to process this, because
                         * we might not have gotten the address of the string
@@ -192,21 +192,21 @@
                        dyn_rpath = dynp;
                        break;
 
-               case Elf_edt_soname:
+               case DT_SONAME:
                        /* Not used by the dynamic linker. */
                        break;
 
-               case Elf_edt_init:
+               case DT_INIT:
                        obj->init = (void (*) __P((void)))
                            (obj->relocbase + dynp->d_un.d_ptr);
                        break;
 
-               case Elf_edt_fini:
+               case DT_FINI:
                        obj->fini = (void (*) __P((void)))
                            (obj->relocbase + dynp->d_un.d_ptr);
                        break;



Home | Main Index | Thread Index | Old Index