casaroli commented on code in PR #19940: URL: https://github.com/apache/nuttx/pull/19940#discussion_r3916119849
########## arch/arm/src/common/Toolchain.defs: ########## @@ -646,11 +646,29 @@ ifeq ($(CONFIG_PIC),y) # after including this file, which would discard the flag. ARCHCFLAGS += --fixed-r9 + +ifeq ($(CONFIG_FDPIC),y) + # An FDPIC module is a shared object whose two segments the loader places + # independently. The stock compiler emits correct FDPIC objects for both C + # and C++, so only the link needs the arm-uclinuxfdpiceabi linker: the + # stock one carries the armelf emulation alone and would turn every import + # into a jump slot where the ABI wants a function descriptor. + + FDPIC_CROSSDEV ?= arm-uclinuxfdpiceabi- + MODULELD = $(FDPIC_CROSSDEV)ld + + CELFFLAGS += -mfdpic -fPIC -Wa,--noexecstack Review Comment: `PICFLAGS` is `-fpic -fPIE -mno-pic-data-is-text-relative -msingle-pic-base`. `-fPIE` contradicts `-shared`, and `-mno-pic-data-is-text-relative` changes the code: with it every function pointer reference becomes `R_ARM_GOTFUNCDESC` instead of `R_ARM_GOTOFFFUNCDESC`, which costs a GOT slot and a load each. `-mfdpic` already selects the model, so the link only needs `-fPIC`. -- 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]
