Skip to content

Commit 00b1a33

Browse files
committed
build: Compile with -fdata-sections and -ffunction-sections
1 parent 7e8f319 commit 00b1a33

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ if not headers_only
7777
add_project_arguments('-fno-rtti', '-fno-exceptions', language: 'cpp')
7878
add_project_link_arguments('-nostdlib', language: ['c', 'cpp'])
7979

80+
if library_type == 'static'
81+
add_project_arguments('-fdata-sections', '-ffunction-sections', language: ['c', 'cpp'])
82+
endif
83+
8084
if get_option('buildtype').startswith('debug')
8185
add_project_arguments('-D__MLIBC_DEBUG', language : ['c', 'cpp'])
8286
endif

tests/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ extra_cflags_test_cases = {
154154

155155
test_sources = []
156156
test_objects = []
157-
test_link_args = []
157+
test_link_args = ['-Wl,--gc-sections']
158158
test_c_args = ['-D_GNU_SOURCE', '-U__MLIBC_DEBUG', '-U__MLIBC_BUILDING_MLIBC', '-fhosted', '-fno-builtin']
159159
use_pie = false
160160

0 commit comments

Comments
 (0)