Messages in this thread | | | From | Masahiro Yamada <> | Date | Tue, 12 Feb 2019 00:08:43 +0900 | Subject | Re: [PATCH 1/4] init/Kconfig: add config support for detecting linker |
| |
On Fri, Feb 8, 2019 at 2:42 PM Nathan Chancellor <natechancellor@gmail.com> wrote: > > On Thu, Feb 07, 2019 at 07:57:20PM -0500, Mathieu Desnoyers wrote: > > > > ----- ndesaulniers@google.com wrote: > > > Similar to how we differentiate between CONFIG_CC_IS_GCC and > > > CONFIG_CC_IS_CLANG, add CONFIG_LD_IS_BFD, CONFIG_LD_IS_GOLD, and > > > CONFIG_LD_IS_LLD. > > > > > > This simiplifies patches to Makefiles that need to do different things > > > for different linkers. > > > > Hi Mathieu, > > > What guarantees that the linker used for e.g. make defconfig is the same linker used for make ? > > > > Is it required with this patch ? > > > > The build system ensures that the compiler (and after this patch, the > linker) config values are correct before compiling (and prompting the > user for the new choices that are available to them in that case). > > For example: > > $ make ARCH=arm64 CC=clang CROSS_COMPILE=aarch64-linux-gnu- defconfig > ... > > $ rg "CONFIG_CC_IS|CONFIG_LD_IS" .config > 10:CONFIG_CC_IS_CLANG=y > 12:CONFIG_LD_IS_BFD=y > > $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- LD=ld.lld > scripts/kconfig/conf --syncconfig Kconfig > * > * Restart config... > * > * > * General architecture-dependent options > * > Kprobes (KPROBES) [N/y/?] n > Optimize very unlikely/likely branches (JUMP_LABEL) [N/y/?] (NEW) > Stack Protector buffer overflow detection (STACKPROTECTOR) [Y/n/?] y > Strong Stack Protector (STACKPROTECTOR_STRONG) [Y/n/?] y > Use a virtually-mapped stack (VMAP_STACK) [Y/n/?] y > Perform full reference count validation at the expense of speed (REFCOUNT_FULL) [Y/?] y > * > * GCC plugins > * > GCC plugins (GCC_PLUGINS) [N/y/?] (NEW) > ... > > $ rg "CONFIG_CC_IS|CONFIG_LD_IS" .config > 9:CONFIG_CC_IS_GCC=y > 13:CONFIG_LD_IS_LLD=y > > > How does it work in a cross compile environment ? > > > > Since $(LD) is defined based on $(CROSS_COMPILE), it should work fine. > I tested it with both arm64 and x86_64 and CONFIG_LD_IS_BFD gets > set by default and I can see CONFIG_LD_IS_GOLD get set with both > LD=aarch64-linux-gnu-ld.gold and LD=ld.gold. > > If I misunderstood the questions or my explanation wasn't correct, > please let me know!
With this patch,
include/config/auto.conf.cmd will include the following:
ifneq "$(LD)" "ld" include/config/auto.conf: FORCE endif
When $(LD) is changed, Kconfig will be re-run.
-- Best Regards Masahiro Yamada
| |