text relocation for netbsd

netbsd does not allow text relocations in text segment.

tcc.h:
- Add data_ro_section
- Fix typo rela.plt

tccelf.c:
- Add data_ro_section
- Make bounds_section/lbounds_section rw
- Add GNU_RELRO section for data_ro_section/bounds_section/lbounds_section
- Fix relocation for __dso_handle in atexit()

tccgen.c:
- Use data_ro_section

x86_64-gen.c:
- Use R_X86_64_PC32 instead of R_X86_64_64 for bounds checking

tests/Makefile, tests/tests2/Makefile
- Enable dll tests for netbsd
This commit is contained in:
herman ten brugge
2020-12-30 14:08:06 +01:00
parent c13c434383
commit 0821940e26
6 changed files with 101 additions and 44 deletions

View File

@@ -64,17 +64,11 @@ endif
ifeq ($(TARGETOS),OpenBSD)
dlltest: CFLAGS+=-fno-stack-protector
endif
ifeq ($(TARGETOS),FreeBSD)
ifneq (,$(filter FreeBSD NetBSD,$(TARGETOS)))
# test3 has dlsym problems
TESTS := $(filter-out test3,$(TESTS))
TESTS += test1
endif
ifeq ($(TARGETOS),NetBSD)
# test3 has dlsym problems
# dlltest does not allow text relocations
TESTS := $(filter-out test3 dlltest,$(TESTS))
TESTS += test1
endif
RUN_TCC = $(NATIVE_DEFINES) -run $(TOPSRC)/tcc.c $(TCCFLAGS)
DISAS = objdump -d

View File

@@ -53,9 +53,6 @@ ifneq (,$(filter OpenBSD FreeBSD NetBSD,$(TARGETOS)))
SKIP += 114_bound_signal.test # libc problem signal/fork
SKIP += 116_bound_setjmp2.test # No TLS_FUNC/TLS_VAR in bcheck.c
endif
ifeq ($(TARGETOS),NetBSD)
SKIP += 113_btdll.test # text relocations
endif
# Some tests might need arguments
ARGS =