entry.c revision 13b387e730e136e709076a39884a1c8dacc3cb08
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1988 AT&T
* All Rights Reserved
*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <memory.h>
#include <debug.h>
#include "msg.h"
#include "_libld.h"
/*
* The loader uses a `segment descriptor' list to describe the output
* segments it can potentially create. Additional segments may be added
* using a map file.
*/
#if defined(_ELF64)
/* Phdr packing changes under Elf64 */
{{PT_SUNWCAP, PF_R, 0, 0, 0, 0, 0, 0},
{{PT_LOAD, M_DATASEG_PERM, 0, 0, 0, 0, 0, 0},
{{PT_LOAD, M_DATASEG_PERM, 0, 0, 0, 0, 0, 0},
{{PT_LOAD, M_DATASEG_PERM, 0, 0, 0, 0, 0, 0},
#endif
{{PT_DYNAMIC, M_DATASEG_PERM, 0, 0, 0, 0, 0, 0},
{{PT_NOTE, 0, 0, 0, 0, 0, 0, 0},
FLG_SG_TYPE, NULL, 0, 0},
{{PT_SUNWBSS, 0, 0, 0, 0, 0, 0, 0},
FLG_SG_TYPE, NULL, 0, 0},
#if defined(__x86)
{{PT_SUNW_UNWIND, PF_R, 0, 0, 0, 0, 0, 0},
#endif
{{PT_NULL, 0, 0, 0, 0, 0, 0, 0},
FLG_SG_TYPE, NULL, 0, 0}
};
#else /* Elf32 */
{{PT_SUNWCAP, 0, 0, 0, 0, 0, PF_R, 0},
{{PT_LOAD, 0, 0, 0, 0, 0, M_DATASEG_PERM, 0},
{{PT_LOAD, 0, 0, 0, 0, 0, M_DATASEG_PERM, 0},
{{PT_DYNAMIC, 0, 0, 0, 0, 0, M_DATASEG_PERM, 0},
{{PT_SUNWDTRACE, 0, 0, 0, 0, 0, M_DATASEG_PERM, 0},
{{PT_NOTE, 0, 0, 0, 0, 0, 0, 0},
FLG_SG_TYPE, NULL, 0, 0},
{{PT_SUNWBSS, 0, 0, 0, 0, 0, 0, 0},
FLG_SG_TYPE, NULL, 0, 0},
{{PT_NULL, 0, 0, 0, 0, 0, 0, 0},
FLG_SG_TYPE, NULL, 0, 0}
};
#endif /* Elfxx */
/*
* The input processing of the loader involves matching the sections of its
* input files to an `entrance descriptor definition'. The entrance criteria
* is different for either a static or dynamic linkage, and may even be
* modified further using a map file. Each entrance criteria is associated
* with a segment descriptor, thus a mapping of input sections to output
* segments is maintained.
*/
#endif
#endif
};
/*
* Initialize new entrance and segment descriptors and add them as lists to
* the output file descriptor.
*/
{
/*
* Initialize the elf library.
*/
return (S_ERROR);
}
/*
* Initialize internal Global Symbol Table AVL tree
*/
/*
* The datasegment permissions can differ depending on whether
* this object is built statically or dynamically.
*/
} else {
}
/*
* Allocate and initialize writable copies of both the entrance and
* segment descriptors.
*/
return (S_ERROR);
return (S_ERROR);
/*
* Traverse the new entrance descriptor list converting the segment
* pointer entries to the absolute address within the new segment
* descriptor list. Add each entrance descriptor to the output file
* list.
*/
return (S_ERROR);
enp++;
}
/*
* Traverse the new segment descriptor list adding each entry to the
* segment descriptor list. For each loadable segment initialize
* a default alignment (ld(1) and ld.so.1 initialize this differently).
*/
return (S_ERROR);
sgp++;
}
return (1);
}