1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 28*0Sstevel@tonic-gate 29*0Sstevel@tonic-gate /* 30*0Sstevel@tonic-gate * Bootstrap the linker/loader. 31*0Sstevel@tonic-gate */ 32*0Sstevel@tonic-gate 33*0Sstevel@tonic-gate #include <sys/types.h> 34*0Sstevel@tonic-gate #include <sys/bootconf.h> 35*0Sstevel@tonic-gate #include <sys/link.h> 36*0Sstevel@tonic-gate #include <sys/auxv.h> 37*0Sstevel@tonic-gate #include <sys/kobj.h> 38*0Sstevel@tonic-gate #include <sys/elf.h> 39*0Sstevel@tonic-gate #include <sys/bootsvcs.h> 40*0Sstevel@tonic-gate #include <sys/kobj_impl.h> 41*0Sstevel@tonic-gate 42*0Sstevel@tonic-gate #if !defined(__GNUC__) 43*0Sstevel@tonic-gate 44*0Sstevel@tonic-gate /* 45*0Sstevel@tonic-gate * We don't use the global offset table, but 46*0Sstevel@tonic-gate * ld may throw in an UNDEFINED reference in 47*0Sstevel@tonic-gate * our symbol table. 48*0Sstevel@tonic-gate */ 49*0Sstevel@tonic-gate 50*0Sstevel@tonic-gate #pragma weak _GLOBAL_OFFSET_TABLE_ 51*0Sstevel@tonic-gate 52*0Sstevel@tonic-gate #else 53*0Sstevel@tonic-gate 54*0Sstevel@tonic-gate /* 55*0Sstevel@tonic-gate * We -do- use the global offset table, but only by 56*0Sstevel@tonic-gate * accident -- when you tell gcc to emit PIC code, 57*0Sstevel@tonic-gate * it -always- generates a reference to the GOT in 58*0Sstevel@tonic-gate * a register, even if the compilation unit never 59*0Sstevel@tonic-gate * uses it. 60*0Sstevel@tonic-gate * 61*0Sstevel@tonic-gate * Rumoured to be fixed in a later version of gcc.. 62*0Sstevel@tonic-gate */ 63*0Sstevel@tonic-gate 64*0Sstevel@tonic-gate long _GLOBAL_OFFSET_TABLE_[1]; 65*0Sstevel@tonic-gate 66*0Sstevel@tonic-gate #endif 67*0Sstevel@tonic-gate 68*0Sstevel@tonic-gate #define MASK(n) ((1<<(n))-1) 69*0Sstevel@tonic-gate #define IN_RANGE(v, n) ((-(1<<((n)-1))) <= (v) && (v) < (1<<((n)-1))) 70*0Sstevel@tonic-gate 71*0Sstevel@tonic-gate #define roundup ALIGN 72*0Sstevel@tonic-gate 73*0Sstevel@tonic-gate /* 74*0Sstevel@tonic-gate * Boot transfers control here. At this point, 75*0Sstevel@tonic-gate * we haven't relocated our own symbols, so the 76*0Sstevel@tonic-gate * world (as we know it) is pretty small right now. 77*0Sstevel@tonic-gate */ 78*0Sstevel@tonic-gate void 79*0Sstevel@tonic-gate _kobj_boot( 80*0Sstevel@tonic-gate struct boot_syscalls *syscallp, 81*0Sstevel@tonic-gate void *dvec, 82*0Sstevel@tonic-gate struct bootops *bootops, 83*0Sstevel@tonic-gate Boot *ebp) 84*0Sstevel@tonic-gate { 85*0Sstevel@tonic-gate Shdr *section[24]; /* cache */ 86*0Sstevel@tonic-gate val_t bootaux[BA_NUM]; 87*0Sstevel@tonic-gate struct bootops *bop; 88*0Sstevel@tonic-gate Phdr *phdr; 89*0Sstevel@tonic-gate auxv_t *auxv = NULL; 90*0Sstevel@tonic-gate Shdr *sh; 91*0Sstevel@tonic-gate Half sh_num; 92*0Sstevel@tonic-gate uint_t end, edata = 0; 93*0Sstevel@tonic-gate int i; 94*0Sstevel@tonic-gate 95*0Sstevel@tonic-gate bop = (dvec) ? *(struct bootops **)bootops : bootops; 96*0Sstevel@tonic-gate 97*0Sstevel@tonic-gate for (i = 0; i < BA_NUM; i++) 98*0Sstevel@tonic-gate bootaux[i].ba_val = NULL; 99*0Sstevel@tonic-gate 100*0Sstevel@tonic-gate /* 101*0Sstevel@tonic-gate * Check the bootstrap vector. 102*0Sstevel@tonic-gate */ 103*0Sstevel@tonic-gate for (; ebp->eb_tag != EB_NULL; ebp++) { 104*0Sstevel@tonic-gate switch (ebp->eb_tag) { 105*0Sstevel@tonic-gate #if defined(__GNUC__) 106*0Sstevel@tonic-gate /* 107*0Sstevel@tonic-gate * gcc 2.95, 3.1 cannot be told to not generate GOT references, 108*0Sstevel@tonic-gate * which krtld cannot handle. yet switch statements which 109*0Sstevel@tonic-gate * can be mapped to jump tables are a frequent generator 110*0Sstevel@tonic-gate * of such references. 111*0Sstevel@tonic-gate */ 112*0Sstevel@tonic-gate case 0x12345678: 113*0Sstevel@tonic-gate /* 114*0Sstevel@tonic-gate * deliberately mess up the compilers 115*0Sstevel@tonic-gate * temptation to create a jump table 116*0Sstevel@tonic-gate */ 117*0Sstevel@tonic-gate break; 118*0Sstevel@tonic-gate #endif 119*0Sstevel@tonic-gate case EB_AUXV: 120*0Sstevel@tonic-gate auxv = (auxv_t *)ebp->eb_un.eb_ptr; 121*0Sstevel@tonic-gate break; 122*0Sstevel@tonic-gate case EB_DYNAMIC: 123*0Sstevel@tonic-gate bootaux[BA_DYNAMIC].ba_ptr = (void *)ebp->eb_un.eb_ptr; 124*0Sstevel@tonic-gate break; 125*0Sstevel@tonic-gate default: 126*0Sstevel@tonic-gate break; 127*0Sstevel@tonic-gate } 128*0Sstevel@tonic-gate } 129*0Sstevel@tonic-gate 130*0Sstevel@tonic-gate if (auxv == NULL) 131*0Sstevel@tonic-gate return; 132*0Sstevel@tonic-gate 133*0Sstevel@tonic-gate /* 134*0Sstevel@tonic-gate * Now the aux vector. 135*0Sstevel@tonic-gate */ 136*0Sstevel@tonic-gate for (; auxv->a_type != AT_NULL; auxv++) { 137*0Sstevel@tonic-gate switch (auxv->a_type) { 138*0Sstevel@tonic-gate #if defined(__GNUC__) 139*0Sstevel@tonic-gate case 0x12345678: 140*0Sstevel@tonic-gate /* 141*0Sstevel@tonic-gate * deliberately mess up the compilers 142*0Sstevel@tonic-gate * temptation to create a jump table 143*0Sstevel@tonic-gate */ 144*0Sstevel@tonic-gate break; 145*0Sstevel@tonic-gate #endif 146*0Sstevel@tonic-gate case AT_PHDR: 147*0Sstevel@tonic-gate bootaux[BA_PHDR].ba_ptr = auxv->a_un.a_ptr; 148*0Sstevel@tonic-gate break; 149*0Sstevel@tonic-gate case AT_PHENT: 150*0Sstevel@tonic-gate bootaux[BA_PHENT].ba_val = auxv->a_un.a_val; 151*0Sstevel@tonic-gate break; 152*0Sstevel@tonic-gate case AT_PHNUM: 153*0Sstevel@tonic-gate bootaux[BA_PHNUM].ba_val = auxv->a_un.a_val; 154*0Sstevel@tonic-gate break; 155*0Sstevel@tonic-gate case AT_PAGESZ: 156*0Sstevel@tonic-gate bootaux[BA_PAGESZ].ba_val = auxv->a_un.a_val; 157*0Sstevel@tonic-gate break; 158*0Sstevel@tonic-gate case AT_SUN_LDELF: 159*0Sstevel@tonic-gate bootaux[BA_LDELF].ba_ptr = auxv->a_un.a_ptr; 160*0Sstevel@tonic-gate break; 161*0Sstevel@tonic-gate case AT_SUN_LDSHDR: 162*0Sstevel@tonic-gate bootaux[BA_LDSHDR].ba_ptr = auxv->a_un.a_ptr; 163*0Sstevel@tonic-gate break; 164*0Sstevel@tonic-gate case AT_SUN_LDNAME: 165*0Sstevel@tonic-gate bootaux[BA_LDNAME].ba_ptr = auxv->a_un.a_ptr; 166*0Sstevel@tonic-gate break; 167*0Sstevel@tonic-gate case AT_SUN_LPAGESZ: 168*0Sstevel@tonic-gate bootaux[BA_LPAGESZ].ba_val = auxv->a_un.a_val; 169*0Sstevel@tonic-gate break; 170*0Sstevel@tonic-gate case AT_SUN_CPU: 171*0Sstevel@tonic-gate bootaux[BA_CPU].ba_ptr = auxv->a_un.a_ptr; 172*0Sstevel@tonic-gate break; 173*0Sstevel@tonic-gate case AT_SUN_MMU: 174*0Sstevel@tonic-gate bootaux[BA_MMU].ba_ptr = auxv->a_un.a_ptr; 175*0Sstevel@tonic-gate break; 176*0Sstevel@tonic-gate case AT_ENTRY: 177*0Sstevel@tonic-gate bootaux[BA_ENTRY].ba_ptr = auxv->a_un.a_ptr; 178*0Sstevel@tonic-gate break; 179*0Sstevel@tonic-gate default: 180*0Sstevel@tonic-gate break; 181*0Sstevel@tonic-gate } 182*0Sstevel@tonic-gate } 183*0Sstevel@tonic-gate 184*0Sstevel@tonic-gate sh = (Shdr *)bootaux[BA_LDSHDR].ba_ptr; 185*0Sstevel@tonic-gate sh_num = ((Ehdr *)bootaux[BA_LDELF].ba_ptr)->e_shnum; 186*0Sstevel@tonic-gate /* 187*0Sstevel@tonic-gate * Build cache table for section addresses. 188*0Sstevel@tonic-gate */ 189*0Sstevel@tonic-gate for (i = 0; i < sh_num; i++) { 190*0Sstevel@tonic-gate section[i] = sh++; 191*0Sstevel@tonic-gate } 192*0Sstevel@tonic-gate 193*0Sstevel@tonic-gate /* 194*0Sstevel@tonic-gate * Find the end of data 195*0Sstevel@tonic-gate * (to allocate bss) 196*0Sstevel@tonic-gate */ 197*0Sstevel@tonic-gate phdr = (Phdr *)bootaux[BA_PHDR].ba_ptr; 198*0Sstevel@tonic-gate for (i = 0; i < bootaux[BA_PHNUM].ba_val; i++) { 199*0Sstevel@tonic-gate if (phdr->p_type == PT_LOAD && 200*0Sstevel@tonic-gate (phdr->p_flags & PF_W) && (phdr->p_flags & PF_X)) { 201*0Sstevel@tonic-gate edata = end = phdr->p_vaddr + phdr->p_memsz; 202*0Sstevel@tonic-gate break; 203*0Sstevel@tonic-gate } 204*0Sstevel@tonic-gate phdr = (Phdr *)((ulong_t)phdr + bootaux[BA_PHENT].ba_val); 205*0Sstevel@tonic-gate } 206*0Sstevel@tonic-gate if (edata == NULL) 207*0Sstevel@tonic-gate return; 208*0Sstevel@tonic-gate 209*0Sstevel@tonic-gate /* 210*0Sstevel@tonic-gate * Find the symbol table, and then loop 211*0Sstevel@tonic-gate * through the symbols adjusting their 212*0Sstevel@tonic-gate * values to reflect where the sections 213*0Sstevel@tonic-gate * were loaded. 214*0Sstevel@tonic-gate */ 215*0Sstevel@tonic-gate for (i = 1; i < sh_num; i++) { 216*0Sstevel@tonic-gate Shdr *shp; 217*0Sstevel@tonic-gate Sym *sp; 218*0Sstevel@tonic-gate uint_t off; 219*0Sstevel@tonic-gate 220*0Sstevel@tonic-gate shp = section[i]; 221*0Sstevel@tonic-gate if (shp->sh_type != SHT_SYMTAB) 222*0Sstevel@tonic-gate continue; 223*0Sstevel@tonic-gate 224*0Sstevel@tonic-gate for (off = 0; off < shp->sh_size; off += shp->sh_entsize) { 225*0Sstevel@tonic-gate sp = (Sym *)(shp->sh_addr + off); 226*0Sstevel@tonic-gate 227*0Sstevel@tonic-gate if (sp->st_shndx == SHN_ABS || 228*0Sstevel@tonic-gate sp->st_shndx == SHN_UNDEF) 229*0Sstevel@tonic-gate continue; 230*0Sstevel@tonic-gate /* 231*0Sstevel@tonic-gate * Assign the addresses for COMMON 232*0Sstevel@tonic-gate * symbols even though we haven't 233*0Sstevel@tonic-gate * actually allocated bss yet. 234*0Sstevel@tonic-gate */ 235*0Sstevel@tonic-gate if (sp->st_shndx == SHN_COMMON) { 236*0Sstevel@tonic-gate end = ALIGN(end, sp->st_value); 237*0Sstevel@tonic-gate sp->st_value = end; 238*0Sstevel@tonic-gate /* 239*0Sstevel@tonic-gate * Squirrel it away for later. 240*0Sstevel@tonic-gate */ 241*0Sstevel@tonic-gate if (bootaux[BA_BSS].ba_val == 0) 242*0Sstevel@tonic-gate bootaux[BA_BSS].ba_val = end; 243*0Sstevel@tonic-gate end += sp->st_size; 244*0Sstevel@tonic-gate continue; 245*0Sstevel@tonic-gate } else if (sp->st_shndx > (Half)sh_num) { 246*0Sstevel@tonic-gate BSVC_PUTCHAR(syscallp, '>'); 247*0Sstevel@tonic-gate return; 248*0Sstevel@tonic-gate } 249*0Sstevel@tonic-gate 250*0Sstevel@tonic-gate /* 251*0Sstevel@tonic-gate * Symbol's new address. 252*0Sstevel@tonic-gate */ 253*0Sstevel@tonic-gate sp->st_value += section[sp->st_shndx]->sh_addr; 254*0Sstevel@tonic-gate } 255*0Sstevel@tonic-gate } 256*0Sstevel@tonic-gate 257*0Sstevel@tonic-gate /* 258*0Sstevel@tonic-gate * Allocate bss for COMMON, if any. 259*0Sstevel@tonic-gate */ 260*0Sstevel@tonic-gate if (end > edata) { 261*0Sstevel@tonic-gate unsigned long va, bva; 262*0Sstevel@tonic-gate unsigned long asize; 263*0Sstevel@tonic-gate unsigned long align; 264*0Sstevel@tonic-gate 265*0Sstevel@tonic-gate if (bootaux[BA_LPAGESZ].ba_val) { 266*0Sstevel@tonic-gate asize = bootaux[BA_LPAGESZ].ba_val; 267*0Sstevel@tonic-gate align = bootaux[BA_LPAGESZ].ba_val; 268*0Sstevel@tonic-gate } else { 269*0Sstevel@tonic-gate asize = bootaux[BA_PAGESZ].ba_val; 270*0Sstevel@tonic-gate align = BO_NO_ALIGN; 271*0Sstevel@tonic-gate } 272*0Sstevel@tonic-gate va = roundup(edata, asize); 273*0Sstevel@tonic-gate bva = roundup(end, asize); 274*0Sstevel@tonic-gate 275*0Sstevel@tonic-gate if (bva > va) { 276*0Sstevel@tonic-gate bva = (unsigned long)BOP_ALLOC(bop, (caddr_t)va, 277*0Sstevel@tonic-gate bva - va, align); 278*0Sstevel@tonic-gate if (bva == NULL) 279*0Sstevel@tonic-gate return; 280*0Sstevel@tonic-gate } 281*0Sstevel@tonic-gate /* 282*0Sstevel@tonic-gate * Zero it. 283*0Sstevel@tonic-gate */ 284*0Sstevel@tonic-gate for (va = edata; va < end; va++) 285*0Sstevel@tonic-gate *(char *)va = 0; 286*0Sstevel@tonic-gate /* 287*0Sstevel@tonic-gate * Update the size of data. 288*0Sstevel@tonic-gate */ 289*0Sstevel@tonic-gate phdr->p_memsz += (end - edata); 290*0Sstevel@tonic-gate } 291*0Sstevel@tonic-gate 292*0Sstevel@tonic-gate /* 293*0Sstevel@tonic-gate * Relocate our own symbols. We'll handle the 294*0Sstevel@tonic-gate * undefined symbols later. 295*0Sstevel@tonic-gate */ 296*0Sstevel@tonic-gate for (i = 1; i < sh_num; i++) { 297*0Sstevel@tonic-gate Shdr *rshp, *shp, *ssp; 298*0Sstevel@tonic-gate unsigned long baseaddr, reladdr, rend; 299*0Sstevel@tonic-gate int relocsize; 300*0Sstevel@tonic-gate 301*0Sstevel@tonic-gate rshp = section[i]; 302*0Sstevel@tonic-gate 303*0Sstevel@tonic-gate if (rshp->sh_type != SHT_REL) 304*0Sstevel@tonic-gate continue; 305*0Sstevel@tonic-gate /* 306*0Sstevel@tonic-gate * Get the section being relocated 307*0Sstevel@tonic-gate * and the symbol table. 308*0Sstevel@tonic-gate */ 309*0Sstevel@tonic-gate shp = section[rshp->sh_info]; 310*0Sstevel@tonic-gate ssp = section[rshp->sh_link]; 311*0Sstevel@tonic-gate 312*0Sstevel@tonic-gate reladdr = rshp->sh_addr; 313*0Sstevel@tonic-gate baseaddr = shp->sh_addr; 314*0Sstevel@tonic-gate rend = reladdr + rshp->sh_size; 315*0Sstevel@tonic-gate relocsize = rshp->sh_entsize; 316*0Sstevel@tonic-gate /* 317*0Sstevel@tonic-gate * Loop through relocations. 318*0Sstevel@tonic-gate */ 319*0Sstevel@tonic-gate while (reladdr < rend) { 320*0Sstevel@tonic-gate Sym *symref; 321*0Sstevel@tonic-gate Rel *reloc; 322*0Sstevel@tonic-gate unsigned long stndx; 323*0Sstevel@tonic-gate unsigned long off, *offptr; 324*0Sstevel@tonic-gate long value; 325*0Sstevel@tonic-gate int rtype; 326*0Sstevel@tonic-gate 327*0Sstevel@tonic-gate reloc = (Rel *)reladdr; 328*0Sstevel@tonic-gate off = reloc->r_offset; 329*0Sstevel@tonic-gate rtype = ELF32_R_TYPE(reloc->r_info); 330*0Sstevel@tonic-gate stndx = ELF32_R_SYM(reloc->r_info); 331*0Sstevel@tonic-gate 332*0Sstevel@tonic-gate reladdr += relocsize; 333*0Sstevel@tonic-gate 334*0Sstevel@tonic-gate if (rtype == R_386_NONE) { 335*0Sstevel@tonic-gate continue; 336*0Sstevel@tonic-gate } 337*0Sstevel@tonic-gate off += baseaddr; 338*0Sstevel@tonic-gate 339*0Sstevel@tonic-gate if (rtype == R_386_RELATIVE) { 340*0Sstevel@tonic-gate /* 341*0Sstevel@tonic-gate * add base addr to reloc location 342*0Sstevel@tonic-gate */ 343*0Sstevel@tonic-gate value = baseaddr; 344*0Sstevel@tonic-gate } else { 345*0Sstevel@tonic-gate unsigned int symoff, symsize; 346*0Sstevel@tonic-gate 347*0Sstevel@tonic-gate symsize = ssp->sh_entsize; 348*0Sstevel@tonic-gate 349*0Sstevel@tonic-gate for (symoff = 0; stndx; stndx--) 350*0Sstevel@tonic-gate symoff += symsize; 351*0Sstevel@tonic-gate symref = (Sym *)(ssp->sh_addr + symoff); 352*0Sstevel@tonic-gate 353*0Sstevel@tonic-gate /* 354*0Sstevel@tonic-gate * Check for bad symbol index. 355*0Sstevel@tonic-gate */ 356*0Sstevel@tonic-gate if (symoff > ssp->sh_size) 357*0Sstevel@tonic-gate return; 358*0Sstevel@tonic-gate 359*0Sstevel@tonic-gate /* 360*0Sstevel@tonic-gate * Just bind our own symbols at this point. 361*0Sstevel@tonic-gate */ 362*0Sstevel@tonic-gate if (symref->st_shndx == SHN_UNDEF) { 363*0Sstevel@tonic-gate continue; 364*0Sstevel@tonic-gate } 365*0Sstevel@tonic-gate 366*0Sstevel@tonic-gate value = symref->st_value; 367*0Sstevel@tonic-gate if (ELF32_ST_BIND(symref->st_info) != 368*0Sstevel@tonic-gate STB_LOCAL) { 369*0Sstevel@tonic-gate /* 370*0Sstevel@tonic-gate * If PC-relative, subtract ref addr. 371*0Sstevel@tonic-gate */ 372*0Sstevel@tonic-gate if (rtype == R_386_PC32 || 373*0Sstevel@tonic-gate rtype == R_386_PLT32 || 374*0Sstevel@tonic-gate rtype == R_386_GOTPC) 375*0Sstevel@tonic-gate value -= off; 376*0Sstevel@tonic-gate } 377*0Sstevel@tonic-gate } 378*0Sstevel@tonic-gate offptr = (unsigned long *)off; 379*0Sstevel@tonic-gate /* 380*0Sstevel@tonic-gate * insert value calculated at reference point 381*0Sstevel@tonic-gate * 2 cases - normal byte order aligned, normal byte 382*0Sstevel@tonic-gate * order unaligned. 383*0Sstevel@tonic-gate */ 384*0Sstevel@tonic-gate switch (rtype) { 385*0Sstevel@tonic-gate #if defined(__GNUC__) 386*0Sstevel@tonic-gate case 0x12345678: 387*0Sstevel@tonic-gate /* 388*0Sstevel@tonic-gate * deliberately mess up the compilers 389*0Sstevel@tonic-gate * temptation to create a jump table 390*0Sstevel@tonic-gate */ 391*0Sstevel@tonic-gate break; 392*0Sstevel@tonic-gate #endif 393*0Sstevel@tonic-gate case R_386_PC32: 394*0Sstevel@tonic-gate case R_386_32: 395*0Sstevel@tonic-gate case R_386_PLT32: 396*0Sstevel@tonic-gate case R_386_RELATIVE: 397*0Sstevel@tonic-gate *offptr += value; 398*0Sstevel@tonic-gate break; 399*0Sstevel@tonic-gate 400*0Sstevel@tonic-gate /* 401*0Sstevel@tonic-gate * For now, ignore GOT references ... 402*0Sstevel@tonic-gate */ 403*0Sstevel@tonic-gate 404*0Sstevel@tonic-gate case R_386_GOTPC: 405*0Sstevel@tonic-gate #if defined(DEBUG) 406*0Sstevel@tonic-gate BSVC_PUTCHAR(syscallp, 'p'); 407*0Sstevel@tonic-gate #endif 408*0Sstevel@tonic-gate break; 409*0Sstevel@tonic-gate case R_386_GOTOFF: 410*0Sstevel@tonic-gate BSVC_PUTCHAR(syscallp, 'g'); 411*0Sstevel@tonic-gate break; 412*0Sstevel@tonic-gate default: 413*0Sstevel@tonic-gate BSVC_PUTCHAR(syscallp, 'r'); 414*0Sstevel@tonic-gate return; 415*0Sstevel@tonic-gate } 416*0Sstevel@tonic-gate /* 417*0Sstevel@tonic-gate * We only need to do it once. 418*0Sstevel@tonic-gate */ 419*0Sstevel@tonic-gate reloc->r_info = ELF32_R_INFO(stndx, R_386_NONE); 420*0Sstevel@tonic-gate } /* while */ 421*0Sstevel@tonic-gate } 422*0Sstevel@tonic-gate 423*0Sstevel@tonic-gate /* 424*0Sstevel@tonic-gate * Done relocating all of our *defined* 425*0Sstevel@tonic-gate * symbols, so we hand off. 426*0Sstevel@tonic-gate */ 427*0Sstevel@tonic-gate kobj_init(syscallp, dvec, bootops, bootaux); 428*0Sstevel@tonic-gate } 429