2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A#
pragma ident "%Z%%M% %I% %E% SMI" 2N/A * x86 relocation code. 2N/A * The kernel run-time linker calls this to try to resolve a reference 2N/A * it can't otherwise resolve. We see if it's marking a probe control 2N/A * block; if so, we do the resolution and return 0. If not, we return 2N/A * 1 to show that we can't resolve it, either. 2N/A * The "statically defined tracing" (SDT) provider for DTrace uses 2N/A * a mechanism similar to TNF, but somewhat simpler. (Surprise, 2N/A * surprise.) The SDT mechanism works by replacing calls to the 2N/A * undefined routine __dtrace_probe_[name] with nop instructions. 2N/A * The relocations are logged, and SDT itself will later patch the 2N/A * running binary appropriately. 2N/A unsigned long off;
/* can't be register for tnf_reloc_resolve() */ 2N/A /* loop through relocations */ 2N/A * if R_386_RELATIVE, simply add base addr 2N/A * get symbol table entry - if symbol is local 2N/A * value is base address of this object 2N/A /* *** this is different for .o and .so */ 2N/A * It's global. Allow weak references. If 2N/A * the symbol is undefined, give TNF (the 2N/A * kernel probes facility) a chance to see 2N/A * if it's a probe site, and fix it up if so. }
else {
/* symbol found - relocate */ * calculate location of definition * - symbol value plus base address of * containing shared object }
/* end else symbol found */ }
/* end global or weak */ }
/* end not R_386_RELATIVE */ * calculate final value - * if PC-relative, subtract ref addr }
/* end of while loop */ /* get the section header that this reloc table refers to */ * Do not relocate any section that isn't loaded into memory. * Most commonly this will skip over the .rela.stab* sections "do_relocations: %s do_relocate failed\n",