Skip to content

Commit 488e04c

Browse files
build: Now building with -nostdlibinc (only clang builtin headers)
1 parent b11b042 commit 488e04c

File tree

7 files changed

+83
-8
lines changed

7 files changed

+83
-8
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ endif(silent)
8282
set(CAPABS "${CAPABS} ${OPTIMIZE}")
8383

8484
# these kinda work with llvm
85-
set(CMAKE_CXX_FLAGS "-target i686 -MMD ${CAPABS} ${WARNS} -nostdlib -c -m32 -std=c++14 -D_LIBCPP_HAS_NO_THREADS=1 -DOS_VERSION=\\\"${OS_VERSION}\\\"")
86-
set(CMAKE_C_FLAGS "-target i686 -MMD ${CAPABS} ${WARNS} -nostdlib -c -m32 -DOS_VERSION=\"\"${OS_VERSION}\"\"")
85+
set(CMAKE_CXX_FLAGS "-target i686 -MMD ${CAPABS} ${WARNS} -nostdlib -nostdlibinc -c -m32 -std=c++14 -D_LIBCPP_HAS_NO_THREADS=1 -DOS_VERSION=\\\"${OS_VERSION}\\\"")
86+
set(CMAKE_C_FLAGS "-target i686 -MMD ${CAPABS} ${WARNS} -nostdlib -nostdlibinc -c -m32 -DOS_VERSION=\"\"${OS_VERSION}\"\"")
8787

8888
# either download or cross-compile needed libraries
8989
option(from_bundle "Download and use pre-compiled libraries for cross-comilation" ON)

api/posix/dlfcn.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// This file is a part of the IncludeOS unikernel - www.includeos.org
2+
//
3+
// Copyright 2017 Oslo and Akershus University College of Applied Sciences
4+
// and Alfred Bratterud
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
18+
#ifndef POSIX_DLFCN_H
19+
#define POSIX_DLFCN_H
20+
21+
#ifdef __cplusplus
22+
extern "C" {
23+
#endif
24+
25+
#define RTLD_LAZY 1 // Relocations are performed at an implementation-dependent time.
26+
#define RTLD_NOW 2 // Relocations are performed when the object is loaded.
27+
#define RTLD_GLOBAL 3 // All symbols are available for relocation processing of other modules.
28+
#define RTLD_LOCAL 4 // All symbols are not made available for relocation processing by other modules.
29+
30+
void *dlopen(const char *, int);
31+
void *dlsym(void *, const char *);
32+
int dlclose(void *);
33+
char *dlerror(void);
34+
35+
#ifdef __cplusplus
36+
}
37+
#endif
38+
39+
#endif // < POSIX_DLFCN_H

api/posix/nl_types.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// This file is a part of the IncludeOS unikernel - www.includeos.org
2+
//
3+
// Copyright 2017 Oslo and Akershus University College of Applied Sciences
4+
// and Alfred Bratterud
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
18+
#ifndef POSIX_NL_TYPES_H
19+
#define POSIX_NL_TYPES_H
20+
21+
#ifdef __cplusplus
22+
extern "C" {
23+
#endif
24+
25+
#define NL_SETD 1
26+
#define NL_CAT_LOCALE 1
27+
28+
typedef void *nl_catd;
29+
typedef int nl_item;
30+
31+
int catclose(nl_catd);
32+
char *catgets(nl_catd, int, int, const char *);
33+
nl_catd catopen(const char *, int);
34+
35+
#ifdef __cplusplus
36+
}
37+
#endif
38+
39+
#endif // < POSIX_NL_TYPES_H
File renamed without changes.

etc/service.cmake

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ if (debug)
4848
endif()
4949

5050
# these kinda work with llvm
51-
set(CMAKE_CXX_FLAGS "-MMD -target i686-elf ${CAPABS} ${OPTIMIZE} ${WARNS} -c -m32 -std=c++14 -D_LIBCPP_HAS_NO_THREADS=1")
52-
set(CMAKE_C_FLAGS "-MMD -target i686-elf ${CAPABS} ${OPTIMIZE} ${WARNS} -c -m32")
51+
set(CMAKE_CXX_FLAGS "-MMD -target i686-elf ${CAPABS} ${OPTIMIZE} ${WARNS} -nostdlib -nostdlibinc -c -m32 -std=c++14 -D_LIBCPP_HAS_NO_THREADS=1")
52+
set(CMAKE_C_FLAGS "-MMD -target i686-elf ${CAPABS} ${OPTIMIZE} ${WARNS} -nostdlib -nostdlibinc -c -m32")
5353

5454
# executable
5555
set(SERVICE_STUB "$ENV{INCLUDEOS_PREFIX}/includeos/src/service_name.cpp")
@@ -145,10 +145,9 @@ endforeach()
145145

146146
# includes
147147
include_directories(${LOCAL_INCLUDES})
148+
include_directories($ENV{INCLUDEOS_PREFIX}/includeos/api/posix)
148149
include_directories($ENV{INCLUDEOS_PREFIX}/includeos/include/libcxx)
149-
include_directories($ENV{INCLUDEOS_PREFIX}/includeos/api/sys)
150150
include_directories($ENV{INCLUDEOS_PREFIX}/includeos/include/newlib)
151-
include_directories($ENV{INCLUDEOS_PREFIX}/includeos/api/posix)
152151
include_directories($ENV{INCLUDEOS_PREFIX}/includeos/api)
153152
include_directories($ENV{INCLUDEOS_PREFIX}/includeos/include)
154153
include_directories($ENV{INCLUDEOS_PREFIX}/include)

lib/mana/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ set(LIB_MANA ${CMAKE_CURRENT_SOURCE_DIR})
44
include_directories(${LIB_MANA}/include)
55
include_directories(${INCLUDEOS_ROOT}/mod/rapidjson/include)
66

7-
include_directories(${INCLUDEOS_ROOT}/api/sys)
87
include_directories(${INCLUDEOS_ROOT}/api/posix)
98
include_directories(${LIBCXX_INCLUDE_DIR})
109
include_directories(${NEWLIB_INCLUDE_DIR})

mod/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
set(CMAKE_ASM_NASM_OBJECT_FORMAT "elf")
22
enable_language(ASM_NASM)
33

4-
include_directories(${INCLUDEOS_ROOT}/api/sys)
54
include_directories(${INCLUDEOS_ROOT}/api/posix)
65
include_directories(${LIBCXX_INCLUDE_DIR})
76
include_directories(${NEWLIB_INCLUDE_DIR})

0 commit comments

Comments
 (0)