Skip to content

Commit 6ddc68a

Browse files
committed
Merge branch 'dev' of https://github.com/hioa-cs/IncludeOS into dev
2 parents c1494b5 + d49910b commit 6ddc68a

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

src/kernel/elf.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
// limitations under the License.
1717

1818
#include <kernel/elf.hpp>
19+
#include <common>
1920
#include <cassert>
2021
#include <cstdio>
2122
#include <string>
@@ -72,14 +73,16 @@ class ElfTables
7273
func_offset getsym(Elf32_Addr addr)
7374
{
7475
// probably just a null pointer with ofs=addr
75-
if (addr < 0x7c00) return {null_stringz, 0, addr};
76+
if (UNLIKELY(addr < 0x7c00))
77+
return {null_stringz, 0, addr};
7678
// definitely in the bootloader
77-
if (addr < 0x7e00) return {boot_stringz, 0x7c00, addr - 0x7c00};
79+
if (UNLIKELY(addr < 0x7e00))
80+
return {boot_stringz, 0x7c00, addr - 0x7c00};
7881
// resolve manually from symtab
7982
auto* sym = getaddr(addr);
8083
// validate symbol address
8184
//assert(sym >= symtab.base && sym < symtab.base + symtab.entries);
82-
if (sym) {
85+
if (LIKELY(sym)) {
8386
auto base = sym->st_value;
8487
auto offset = addr - base;
8588
// return string name for symbol

src/seed/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ INCLUDES = -I$(INC_LIBCXX) -I$(INSTALL)/api/sys -I$(INC_NEWLIB) -I$(INSTALL)/api
5050
all: CAPABS = $(CAPABS_COMMON) -O2 -DOS_TERMINATE_ON_CONTRACT_VIOLATION
5151
debug: CAPABS = $(CAPABS_COMMON) -O0
5252
stripped: CAPABS = $(CAPABS_COMMON) -Os
53-
# by default, remove debugging
54-
STRIPPED=-S
53+
# by default, don't use strip because it has caused us some problems
54+
STRIPPED=
5555

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

91+
all: LDOPTS += --strip-debug
9192
all: service
9293

9394
stripped: LDOPTS += -s

src/util/statman.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// See the License for the specific language governing permissions and
1616
// limitations under the License.
1717

18+
#include <iterator>
1819
#include <statman>
1920

2021
// Stat
@@ -76,15 +77,10 @@ Statman::Statman(uintptr_t start, Size_type num_bytes)
7677
}
7778

7879
Statman::Span_iterator Statman::last_used() {
79-
int i = 0;
80-
81-
for(auto it = stats_.begin(); it not_eq stats_.end(); ++it) {
82-
if(i == next_available_)
83-
return it;
84-
i++;
85-
}
86-
87-
return stats_.end();
80+
Expects(next_available_ <= stats_.size());
81+
auto it = stats_.begin();
82+
std::advance(it, next_available_);
83+
return it;
8884
}
8985

9086
Stat& Statman::create(const Stat::stat_type type, const std::string& name) {

0 commit comments

Comments
 (0)