[PATCH] ARM: xip: Move XIP linking to a separate file

Michal Marek mmarek at suse.com
Thu Nov 19 08:21:06 PST 2015

On 2015-11-19 17:04, Chris Brandt wrote:
> On Thu, 19 Nov 2015, Michal Marek wrote:
>> Why not have a vmlinux.lds.S and #include a vmlinux-xip.lds.S / 
>> vmlinux-nonxip.lds.S from there? That way, you do not clutter the
>> main Makefile and you can reuse the boilerplate of the linker script.
>> Michal
> On Thu, 19 Nov 2015, Nicolas Pitre wrote:
>> I agree with Michal's suggestion to do the selection locally with an
>> include.
> That's actually how I started out locally, but I thought if I tried submitting that, I'd get a bunch of "Eww, that's ugly".

:-). It arguably is not the most beautiful pattern, but it is still easy
to understand and there is some prior art in the kernel already, where
we include variants of C / asm files from other source files:

arch/arm/mm/fault.c:#include "fsr-3level.c"
arch/arm/mm/fault.c:#include "fsr-2level.c"
arch/m68k/kernel/setup.c:#include "setup_mm.c"
arch/m68k/kernel/setup.c:#include "setup_no.c"
arch/powerpc/kvm/book3s_segment.S:#include "book3s_64_slb.S"
arch/powerpc/kvm/book3s_segment.S:#include "book3s_32_sr.S"
mm/percpu.c:#include "percpu-km.c"
mm/percpu.c:#include "percpu-vm.c"

UM even uses it in its linker script:

arch/um/kernel/vmlinux.lds.S:#include "uml.lds.S"
arch/um/kernel/vmlinux.lds.S:#include "dyn.lds.S"


More information about the linux-arm-kernel mailing list