sim: Add loadable module definitions

Also, add -fno-pic to avoid generating GOT relocations.
This commit is contained in:
YAMAMOTO Takashi 2020-02-14 02:11:57 +09:00 committed by Xiang Xiao
parent 7f1f930a7b
commit 3ead7795b2
3 changed files with 51 additions and 0 deletions

View File

@ -88,11 +88,26 @@ CXXFLAGS = $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
# Loadable module definitions
CMODULEFLAGS = $(CFLAGS)
# -fno-pic to avoid GOT relocations
CMODULEFLAGS += -fno-pic
LDMODULEFLAGS = -r -e module_initialize
ifeq ($(WINTOOL),y)
LDMODULEFLAGS += -T "${shell cygpath -w $(TOPDIR)/libs/libc/modlib/gnu-elf.ld}"
else
LDMODULEFLAGS += -T $(TOPDIR)/libs/libc/modlib/gnu-elf.ld
endif
# ELF module definitions
CELFFLAGS = $(CFLAGS)
CXXELFFLAGS = $(CXXFLAGS)
# -fno-pic to avoid GOT relocations
CELFFLAGS += -fno-pic
CXXELFFLAGS += -fno-pic
LDELFFLAGS = -r -e main
ifeq ($(WINTOOL),y)
@ -128,6 +143,8 @@ ifeq ($(CONFIG_SIM_M32),y)
LDLINKFLAGS += -melf_i386
CCLINKFLAGS += -m32
LDFLAGS += -m32
LDMODULEFLAGS += -melf_i386
LDELFFLAGS += -melf_i386
HOSTLDFLAGS += -m32
endif

View File

@ -84,11 +84,26 @@ CXXFLAGS = $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
# Loadable module definitions
CMODULEFLAGS = $(CFLAGS)
# -fno-pic to avoid GOT relocations
CMODULEFLAGS += -fno-pic
LDMODULEFLAGS = -r -e module_initialize
ifeq ($(WINTOOL),y)
LDMODULEFLAGS += -T "${shell cygpath -w $(TOPDIR)/libs/libc/modlib/gnu-elf.ld}"
else
LDMODULEFLAGS += -T $(TOPDIR)/libs/libc/modlib/gnu-elf.ld
endif
# ELF module definitions
CELFFLAGS = $(CFLAGS)
CXXELFFLAGS = $(CXXFLAGS)
# -fno-pic to avoid GOT relocations
CELFFLAGS += -fno-pic
CXXELFFLAGS += -fno-pic
LDELFFLAGS = -r -e main
ifeq ($(WINTOOL),y)
@ -120,6 +135,8 @@ ifeq ($(CONFIG_SIM_M32),y)
LDLINKFLAGS += -melf_i386
CCLINKFLAGS += -m32
LDFLAGS += -m32
LDMODULEFLAGS += -melf_i386
LDELFFLAGS += -melf_i386
HOSTLDFLAGS += -m32
endif

View File

@ -91,11 +91,26 @@ CXXFLAGS = $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
# Loadable module definitions
CMODULEFLAGS = $(CFLAGS)
# -fno-pic to avoid GOT relocations
CMODULEFLAGS += -fno-pic
LDMODULEFLAGS = -r -e module_initialize
ifeq ($(WINTOOL),y)
LDMODULEFLAGS += -T "${shell cygpath -w $(TOPDIR)/libs/libc/modlib/gnu-elf.ld}"
else
LDMODULEFLAGS += -T $(TOPDIR)/libs/libc/modlib/gnu-elf.ld
endif
# ELF module definitions
CELFFLAGS = $(CFLAGS)
CXXELFFLAGS = $(CXXFLAGS)
# -fno-pic to avoid GOT relocations
CELFFLAGS += -fno-pic
CXXELFFLAGS += -fno-pic
LDELFFLAGS = -r -e main
ifeq ($(WINTOOL),y)
@ -127,6 +142,8 @@ ifeq ($(CONFIG_SIM_M32),y)
LDLINKFLAGS += -melf_i386
CCLINKFLAGS += -m32
LDFLAGS += -m32
LDMODULEFLAGS += -melf_i386
LDELFFLAGS += -melf_i386
HOSTLDFLAGS += -m32
endif