Use better flags for system includes and libraries
System include and library paths were specified with the traditional -I and -L
flags, but some toolchains will not compile runtime tests properly with systems
files located this way. This change switches to -isystem for system includes and -B
for system libraries.
@@ -317,8 +317,8 @@ dummy:
include ../../rules.mk
ifneq ($(CROSS_COMPILE),)
-CFLAGS+= --sysroot $(TARGET_ROOT) -I$(TARGET_ROOT)/usr/include
-LDFLAGS+= --sysroot=$(TARGET_ROOT) -L$(TARGET_ROOT)/usr/lib/$(ARCH)-linux-gnu
+CFLAGS+= --sysroot $(TARGET_ROOT) -isystem $(TARGET_ROOT)/usr/include -isystem $(TARGET_ROOT)/usr/include/$(ARCH)-linux-gnu
+LDFLAGS+= --sysroot=$(TARGET_ROOT) -B$(TARGET_ROOT)/usr/lib/$(ARCH)-linux-gnu
ifeq ($(ARCH),riscv64)
LDFLAGS+= -Wl,--eh-frame-hdr
endif
