[PATCH] D24801: [ELF] - Fix combination of -script and relocatable output.
Peter Smith via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 10 01:39:19 PDT 2016
peter.smith added a comment.
I don't have a personal use case for ld -r and scripts, it is just one of the possible combinations that someone can use, and make exceptions more difficult.
The only use case that I know of from ld.bfd is the creation of linux kernel modules.
The script in question seems to be: https://github.com/torvalds/linux/blob/master/scripts/module-common.lds
As to whether we need them, I think anyone using linux will happily use ld.bfd or gold. For BSD there may not be an option other that lld. From what I can dig up via searching the web I found the makefile for BSD kernel modules: http://fxr.watson.org/fxr/source/conf/kmod.mk
This seems to use ld -r but does not use an ldscript:
.if ${__KLD_SHARED} == yes
232 ${KMOD}.kld: ${OBJS}
233 .else
234 ${FULLPROG}: ${OBJS}
235 .endif
236 ${LD} ${_LDFLAGS} -r -d -o ${.TARGET} ${OBJS}
237 .if ${MK_CTF} != "no"
238 ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS}
239 .endif
I'm not a Linux or BSD expert, my background is tools for bare-metal embedded systems. This may be out of date.
In summary I think a case could be made for not supporting the combination until someone actually needs it.
https://reviews.llvm.org/D24801
More information about the llvm-commits
mailing list