login ac48398d3f
调整brk系统调用,使得参数、返回值与Linux一致 (#238)
* 新增用于测试relibc的app

* 为适配relibc,修改do_execve中关于用户栈的内容的设置

* 调整brk系统调用,使得参数、返回值与Linux一致
2023-04-11 16:54:14 +08:00

22 lines
786 B
Makefile
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

CC=x86_64-elf-gcc
LD=x86_64-elf-ld
OBJCOPY=x86_64-dragonos-objcopy
# 修改这里把它改为你的relibc的sysroot路径
RELIBC_SYSROOT=/home/longjin/relibc/sysroot
CFLAGS=-I $(RELIBC_SYSROOT)/usr/include
# 修改这里把它改为你的DragonOS的根目录
ROOT_PATH=/home/longjin/code/DragonOS
tmp_output_dir=$(ROOT_PATH)/bin/tmp/user
output_dir=$(ROOT_PATH)/bin/user
LIBC_OBJS:=$(shell find $(RELIBC_SYSROOT)/usr/lib -name "*.o")
LIBC_OBJS+=$(RELIBC_SYSROOT)/usr/lib/libc.a
all: main.o
$(LD) -b elf64-x86-64 -z muldefs -o $(tmp_output_dir)/test $(shell find . -name "*.o") $(LIBC_OBJS) -T link.lds
$(OBJCOPY) -I elf64-x86-64 -R ".eh_frame" -R ".comment" -O elf64-x86-64 $(tmp_output_dir)/test $(output_dir)/test.elf
main.o: main.c
$(CC) $(CFLAGS) -c main.c -o main.o