Allows processor ABI specific ELF segment loads.

If the macro MD_LOADSEG defined in
machine/loadfile_machdep.h evaluates to 1, the machine
specific segment is loaded.

See: http://mail-index.netbsd.org/tech-kern/2005/12/30/0003.html
This commit is contained in:
cherry 2006-04-03 14:08:41 +00:00
parent d6d78510c3
commit 50756fb219
1 changed files with 11 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: loadfile_elf32.c,v 1.13 2006/01/25 18:27:23 christos Exp $ */
/* $NetBSD: loadfile_elf32.c,v 1.14 2006/04/03 14:08:41 cherry Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -296,6 +296,15 @@ ELFNAMEEND(loadfile)(fd, elf, marks, flags)
for (first = 1, i = 0; i < elf->e_phnum; i++) {
internalize_phdr(elf->e_ident[EI_DATA], &phdr[i]);
#ifndef MD_LOADSEG /* Allow processor ABI specific segment loads */
#define MD_LOADSEG(a) /*CONSTCOND*/0
#endif
if ( (phdr[i].p_type & PT_LOPROC) &&
MD_LOADSEG(phdr[i]))
goto loadseg;
if (phdr[i].p_type != PT_LOAD ||
(phdr[i].p_flags & (PF_W|PF_X)) == 0)
continue;
@ -309,6 +318,7 @@ ELFNAMEEND(loadfile)(fd, elf, marks, flags)
if ((IS_TEXT(phdr[i]) && (flags & LOAD_TEXT)) ||
(IS_DATA(phdr[i]) && (flags & LOAD_DATA))) {
loadseg:
/* Read in segment. */
PROGRESS(("%s%lu", first ? "" : "+",
(u_long)phdr[i].p_filesz));