Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/kernel/elf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// limitations under the License.

#include <kernel/elf.hpp>
#include <common>
#include <cassert>
#include <cstdio>
#include <string>
Expand Down Expand Up @@ -72,14 +73,16 @@ class ElfTables
func_offset getsym(Elf32_Addr addr)
{
// probably just a null pointer with ofs=addr
if (addr < 0x7c00) return {null_stringz, 0, addr};
if (UNLIKELY(addr < 0x7c00))
return {null_stringz, 0, addr};
// definitely in the bootloader
if (addr < 0x7e00) return {boot_stringz, 0x7c00, addr - 0x7c00};
if (UNLIKELY(addr < 0x7e00))
return {boot_stringz, 0x7c00, addr - 0x7c00};
// resolve manually from symtab
auto* sym = getaddr(addr);
// validate symbol address
//assert(sym >= symtab.base && sym < symtab.base + symtab.entries);
if (sym) {
if (LIKELY(sym)) {
auto base = sym->st_value;
auto offset = addr - base;
// return string name for symbol
Expand Down
5 changes: 3 additions & 2 deletions src/seed/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ INCLUDES = -I$(INC_LIBCXX) -I$(INSTALL)/api/sys -I$(INC_NEWLIB) -I$(INSTALL)/api
all: CAPABS = $(CAPABS_COMMON) -O2 -DOS_TERMINATE_ON_CONTRACT_VIOLATION
debug: CAPABS = $(CAPABS_COMMON) -O0
stripped: CAPABS = $(CAPABS_COMMON) -Os
# by default, remove debugging
STRIPPED=-S
# by default, don't use strip because it has caused us some problems
STRIPPED=

CPPOPTS = $(CAPABS) $(WARNS) -c -m32 -std=c++14 $(INCLUDES) -D_LIBCPP_HAS_NO_THREADS=1 -D_GNU_SOURCE
LDOPTS = -nostdlib -melf_i386 -N --eh-frame-hdr --script=$(INSTALL)/linker.ld --defsym _MAX_MEM_MIB_=$(MAX_MEM) --defsym=__stack_rand_ba=`date +%s`
Expand Down Expand Up @@ -88,6 +88,7 @@ DEPS = $(OBJS:.o=.d)
# - a "service", to be linked with OS-objects (OS included)
.PHONY: all stripped debug debug-info debug-all memdisk service

all: LDOPTS += --strip-debug
all: service

stripped: LDOPTS += -s
Expand Down