kobj_boot.c revision 02e56f3f1bfc8d9977bafb8cb5202f576dcded27
/*
* 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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
*/
#include <sys/bootconf.h>
#include <sys/bootsvcs.h>
#include <sys/kobj_impl.h>
#if !defined(__GNUC__)
/*
* We don't use the global offset table, but
* ld may throw in an UNDEFINED reference in
* our symbol table.
*/
#if !defined(_KERNEL)
#pragma weak _GLOBAL_OFFSET_TABLE_
#endif
#else
/*
* We -do- use the global offset table, but only by
* accident -- when you tell gcc to emit PIC code,
* it -always- generates a reference to the GOT in
* a register, even if the compilation unit never
* uses it.
*
* Rumoured to be fixed in a later version of gcc..
*/
long _GLOBAL_OFFSET_TABLE_[1];
#endif
/*
* Boot transfers control here. At this point,
* we haven't relocated our own symbols, so the
* world (as we know it) is pretty small right now.
*/
void
struct boot_syscalls *syscallp,
void *dvec,
{
int i;
for (i = 0; i < BA_NUM; i++)
/*
* Check the bootstrap vector.
*/
case EB_AUXV:
break;
case EB_DYNAMIC:
break;
default:
break;
}
}
return;
/*
* Now the aux vector.
*/
case AT_PHDR:
break;
case AT_PHENT:
break;
case AT_PHNUM:
break;
case AT_PAGESZ:
break;
case AT_SUN_LDELF:
break;
case AT_SUN_LDSHDR:
break;
case AT_SUN_LDNAME:
break;
case AT_SUN_LPAGESZ:
break;
case AT_SUN_CPU:
break;
case AT_SUN_MMU:
break;
case AT_ENTRY:
break;
default:
break;
}
}
/*
* Make sure we won't overflow stack allocated cache
*/
return;
/*
* Build cache table for section addresses.
*/
for (i = 0; i < sh_num; i++) {
}
/*
* Find the end of data
* (to allocate bss)
*/
break;
}
}
return;
/*
* Find the symbol table, and then loop
* through the symbols adjusting their
* values to reflect where the sections
* were loaded.
*/
for (i = 1; i < sh_num; i++) {
continue;
continue;
/*
* Assign the addresses for COMMON
* symbols even though we haven't
* actually allocated bss yet.
*/
/*
* Squirrel it away for later.
*/
continue;
return;
}
/*
* Symbol's new address.
*/
}
}
/*
* Allocate bss for COMMON, if any.
*/
unsigned long asize;
unsigned long align;
} else {
align = BO_NO_ALIGN;
}
return;
}
/*
* Zero it.
*/
*(char *)va = 0;
/*
* Update the size of data.
*/
}
/*
* Relocate our own symbols. We'll handle the
* undefined symbols later.
*/
for (i = 1; i < sh_num; i++) {
long relocsize;
continue;
/*
* Get the section being relocated
* and the symbol table.
*/
/*
* Only perform relocations against allocatable
* sections.
*/
continue;
/*
* Loop through relocations.
*/
unsigned long stndx;
int rtype;
if (rtype == R_AMD64_NONE)
continue;
/*
* Check for bad symbol index.
*/
return;
/*
* Just bind our own symbols at this point.
*/
continue;
if ((rtype == R_AMD64_PC32) ||
(rtype == R_AMD64_PLT32))
/*
* If PC-relative, subtract ref addr.
*/
else if (rtype == R_AMD64_32) {
/*
* It's illegal to have any HIBITS
* set for R_AMD64_32 reloc.
*/
return;
}
} else if (rtype == R_AMD64_32S) {
/*
* All HIBITS for R_AMD64_32S
* *must* be set.
*/
return;
}
}
/*
* insert value calculated at reference point
* 2 cases - normal byte order aligned, normal byte
* order unaligned.
*/
switch (rtype) {
case R_AMD64_64:
break;
case R_AMD64_PC32:
case R_AMD64_32S:
case R_AMD64_PLT32:
break;
case R_AMD64_GOT32:
return;
case R_AMD64_32:
return;
default:
return;
}
/*
* We only need to do it once.
*/
} /* while */
}
/*
* Done relocating all of our *defined*
* symbols, so we hand off.
*/
}