xiaoxiang781216 commented on code in PR #3762: URL: https://github.com/apache/nuttx-apps/pull/3762#discussion_r3949335680
########## examples/fdpicxip/modules/Makefile: ########## @@ -44,19 +44,70 @@ CPU ?= cortex-m3 -FDPICDIR = $(NUTTX_DIR)/tools/fdpic -MODULE_MK = $(FDPICDIR)/nuttx-fdpic.mk -EMBED = $(FDPICDIR)/fdpic-embed.py +# make has built-in defaults for CC and CXX, so ?= never fires for them and +# the host compiler silently gets the job. Test the origin instead. -# Where each generated header goes, and its path from the repository root -- -# fdpic-embed.py puts that on line 2, which is what nxstyle wants. +ifeq ($(origin CC),default) + CC := arm-none-eabi-gcc +endif + +ifeq ($(origin CXX),default) + CXX := arm-none-eabi-g++ +endif + +ifeq ($(origin LD),default) + LD := arm-uclinuxfdpiceabi-ld +endif + +# -mfdpic -fPIC is the whole of what makes an FDPIC object; the rest is what +# a module needs anywhere. -fno-use-cxa-atexit puts a static object's +# destructor in .fini_array, which is where the loader looks for it. + +MODCFLAGS = -mcpu=$(CPU) -mthumb -mfdpic -fPIC -Os -fno-builtin -Wall \ Review Comment: don't need any more with the new kernel side change ########## examples/fdpicxip/modules/Makefile: ########## @@ -93,50 +144,45 @@ endif # which is what a consumer records in DT_NEEDED and what the loader searches # for at run time. -qsorter.fdpic: qsorter.c - $(BUILD) MODULE=qsorter SRCS=qsorter.c +qsorter.fdpic: qsorter.o crt0.o + $(LINKMOD) qsorter.o -callback.fdpic: callback.c - $(BUILD) MODULE=callback SRCS=callback.c +callback.fdpic: callback.o crt0.o + $(LINKMOD) callback.o -funcdesc.fdpic: funcdesc.c - $(BUILD) MODULE=funcdesc SRCS=funcdesc.c +funcdesc.fdpic: funcdesc.o crt0.o + $(LINKMOD) funcdesc.o -libcounter.so: libcounter.c - $(BUILD) MODULE=libcounter SRCS=libcounter.c ENTRY=0 \ - EXTRA_LDFLAGS="-soname libcounter.so" - mv libcounter.fdpic libcounter.so +libcounter.so: libcounter.o + $(LINKLIB) libcounter.o -user.fdpic: user.c libcounter.so - $(BUILD) MODULE=user SRCS=user.c LIBS=libcounter.so +user.fdpic: user.o crt0.o libcounter.so + $(LINKMOD) user.o libcounter.so # C++ compiles with the stock arm-none-eabi-g++; only the link is FDPIC. -libshape.so: libshape.cpp - $(BUILD) MODULE=libshape CXXSRCS=libshape.cpp ENTRY=0 \ - EXTRA_LDFLAGS="-soname libshape.so" - mv libshape.fdpic libshape.so +libshape.so: libshape.o + $(LINKLIB) libshape.o -cxxuser.fdpic: cxxuser.cpp libshape.so - $(BUILD) MODULE=cxxuser CXXSRCS=cxxuser.cpp LIBS=libshape.so +cxxuser.fdpic: cxxuser.o crt0.o libshape.so + $(LINKMOD) cxxuser.o libshape.so # BINDNOW is emptied so the imported descriptors stay in the lazy binding # table, which is the case this module exists to cover. -lazymod.fdpic: lazymod.c - $(BUILD) MODULE=lazymod SRCS=lazymod.c BINDNOW= +lazymod.fdpic: lazymod.o crt0.o Review Comment: remove fdpic suffix, could we generate FDPIC elf just like the ordinary elf by setting MODULE=m -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
