_relocate.c revision 5aefb6555731130ca4fd295960123d71f2d21fe8
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * CDDL HEADER START
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * The contents of this file are subject to the terms of the
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * Common Development and Distribution License (the "License").
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * You may not use this file except in compliance with the License.
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * See the License for the specific language governing permissions
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * and limitations under the License.
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * When distributing Covered Code, include this CDDL HEADER in each
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * If applicable, add the following below this CDDL HEADER, with the
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * fields enclosed by brackets "[]" replaced with your own identifying
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * information: Portions Copyright [yyyy] [name of copyright owner]
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * CDDL HEADER END
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * Use is subject to license terms.
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe#pragma ident "%Z%%M% %I% %E% SMI"
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * Undo relocations that have been applied to a memory image. Basically this
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * involves copying the original files relocation offset into the new image
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * being created.
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Loweundo_reloc(void *vrel, uchar_t *oaddr, uchar_t *iaddr, Reloc *reloc)
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe /* LINTED */
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe /* LINTED */
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe (void) memset((void *)oaddr, 0, (size_t)reloc->r_size);
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * Copy a relocation record and increment its value. The record must reflect
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * the new address to which this image is fixed. Note that .got entries
if (_iaddr)
vaddr = 0;