修改libc的编译相关内容(#171)

1.将libc的include文件夹分为export和internal
2.将所有app都直接链接libc.a,而不是都执行一遍"搜索.o"的过程
This commit is contained in:
login
2023-02-11 13:04:24 +08:00
committed by GitHub
parent 90b077f9d3
commit 2bf5ee0e3c
36 changed files with 101 additions and 12 deletions

View File

@ -3,7 +3,7 @@ GIT_COMMIT_SHA1=$(shell git log -n 1 | head -n 1 | cut -d ' ' -f 2 | cut -c1-8)
all: about.o
$(LD) -b elf64-x86-64 -z muldefs -o $(tmp_output_dir)/about $(shell find . -name "*.o") $(shell find $(sys_libs_dir) -name "*.o") -T about.lds
$(LD) -b elf64-x86-64 -z muldefs -o $(tmp_output_dir)/about $(shell find . -name "*.o") $(ROOT_PATH)/bin/sysroot/usr/lib/libc.a -T about.lds
$(OBJCOPY) -I elf64-x86-64 -R ".eh_frame" -R ".comment" -O elf64-x86-64 $(tmp_output_dir)/about $(output_dir)/about.elf

View File

@ -14,6 +14,7 @@ SECTIONS
_text = .;
*(.text)
*(.text.*)
_etext = .;
}
@ -23,6 +24,7 @@ SECTIONS
{
_data = .;
*(.data)
*(.data.*)
_edata = .;
}
@ -33,6 +35,7 @@ SECTIONS
{
_rodata = .;
*(.rodata)
*(.rodata.*)
_erodata = .;
}
@ -41,6 +44,7 @@ SECTIONS
{
_bss = .;
*(.bss)
*(.bss.*)
_ebss = .;
}

View File

@ -1,6 +1,6 @@
all: shell.o cmd.o cmd_help.o cmd_test.o
$(LD) -b elf64-x86-64 -z muldefs -o $(tmp_output_dir)/shell $(shell find . -name "*.o") $(shell find $(sys_libs_dir) -name "*.o") -T shell.lds
$(LD) -b elf64-x86-64 -z muldefs -o $(tmp_output_dir)/shell $(shell find . -name "*.o") $(ROOT_PATH)/bin/sysroot/usr/lib/libc.a -T shell.lds
$(OBJCOPY) -I elf64-x86-64 -R ".eh_frame" -R ".comment" -O elf64-x86-64 $(tmp_output_dir)/shell $(output_dir)/shell.elf
shell.o: shell.c

View File

@ -14,6 +14,7 @@ SECTIONS
_text = .;
*(.text)
*(.text.*)
_etext = .;
}
@ -23,6 +24,7 @@ SECTIONS
{
_data = .;
*(.data)
*(.data.*)
_edata = .;
}
@ -33,6 +35,7 @@ SECTIONS
{
_rodata = .;
*(.rodata)
*(.rodata.*)
_erodata = .;
}
@ -41,6 +44,7 @@ SECTIONS
{
_bss = .;
*(.bss)
*(.bss.*)
_ebss = .;
}

View File

@ -1,6 +1,6 @@
all: main.o
$(LD) -b elf64-x86-64 -z muldefs -o $(tmp_output_dir)/test_signal $(shell find . -name "*.o") $(shell find $(sys_libs_dir) -name "*.o") -T link.lds
$(LD) -b elf64-x86-64 -z muldefs -o $(tmp_output_dir)/test_signal $(shell find . -name "*.o") $(ROOT_PATH)/bin/sysroot/usr/lib/libc.a -T link.lds
$(OBJCOPY) -I elf64-x86-64 -R ".eh_frame" -R ".comment" -O elf64-x86-64 $(tmp_output_dir)/test_signal $(output_dir)/test_signal.elf
main.o: main.c

View File

@ -14,6 +14,7 @@ SECTIONS
_text = .;
*(.text)
*(.text.*)
_etext = .;
}
@ -23,6 +24,7 @@ SECTIONS
{
_data = .;
*(.data)
*(.data.*)
_edata = .;
}
@ -33,6 +35,7 @@ SECTIONS
{
_rodata = .;
*(.rodata)
*(.rodata.*)
_erodata = .;
}
@ -41,6 +44,7 @@ SECTIONS
{
_bss = .;
*(.bss)
*(.bss.*)
_ebss = .;
}