Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1672427

Re: linux-next: build failure after merge of most trees

From Nicholas Piggin <npiggin@gmail.com>
Newsgroups linux.kernel
Subject Re: linux-next: build failure after merge of most trees
Date 2017-06-22 10:50 +0200
Message-ID <tV5Ym-2e1-29@gated-at.bofh.it> (permalink)
References <tV2QN-cZ-7@gated-at.bofh.it>
Organization IBM

Show all headers | View raw


CC'ing Alan

On Thu, 22 Jun 2017 15:24:41 +1000
Stephen Rothwell <sfr@canb.auug.org.au> wrote:

> Hi Dave,
> 
> After merging almost all the trees, today's linux-next build (sparc64
> defconfig) failed like this:
> 
> arch/sparc/lib/hweight.o: In function `__arch_hweight8':
> (.text+0x0): relocation truncated to fit: R_SPARC_WDISP19 against symbol `__sw_hweight8' defined in .text section in lib/hweight.o
> arch/sparc/lib/hweight.o: In function `__arch_hweight16':
> (.text+0xc): relocation truncated to fit: R_SPARC_WDISP19 against symbol `__sw_hweight16' defined in .text section in lib/hweight.o
> arch/sparc/lib/hweight.o: In function `__arch_hweight32':
> (.text+0x18): relocation truncated to fit: R_SPARC_WDISP19 against symbol `__sw_hweight32' defined in .text section in lib/hweight.o
> arch/sparc/lib/hweight.o: In function `__arch_hweight64':
> (.text+0x24): relocation truncated to fit: R_SPARC_WDISP19 against symbol `__sw_hweight64' defined in .text section in lib/hweight.o

After a bit of digging, this is due to that thin archives patch, but only
because it changes the order of linker inputs around slightly. You can
reproduce it with upstream kernel:

This is the final link which succeeds:

sparc64-linux-gnu-ld -m elf64_sparc --build-id -o vmlinux -T ./arch/sparc/kernel/vmlinux.lds arch/sparc/kernel/head_64.o init/built-in.o --start-group usr/built-in.o arch/sparc/built-in.o kernel/built-in.o certs/built-in.o mm/built-in.o fs/built-in.o ipc/built-in.o security/built-in.o crypto/built-in.o block/built-in.o lib/lib.a arch/sparc/prom/lib.a arch/sparc/lib/lib.a lib/built-in.o arch/sparc/prom/built-in.o arch/sparc/lib/built-in.o drivers/built-in.o sound/built-in.o firmware/built-in.o net/built-in.o virt/built-in.o --end-group .tmp_kallsyms2.o

Moving the lib.a files to the end:

sparc64-linux-gnu-ld -m elf64_sparc --build-id -o vmlinux -T ./arch/sparc/kernel/vmlinux.lds arch/sparc/kernel/head_64.o init/built-in.o --start-group usr/built-in.o arch/sparc/built-in.o kernel/built-in.o certs/built-in.o mm/built-in.o fs/built-in.o ipc/built-in.o security/built-in.o crypto/built-in.o block/built-in.o lib/built-in.o arch/sparc/prom/built-in.o arch/sparc/lib/built-in.o drivers/built-in.o sound/built-in.o firmware/built-in.o net/built-in.o virt/built-in.o lib/lib.a arch/sparc/prom/lib.a arch/sparc/lib/lib.a --end-group .tmp_kallsyms2.o

arch/sparc/lib/lib.a(hweight.o): In function `__arch_hweight8':
(.text+0x0): relocation truncated to fit: R_SPARC_WDISP19 against symbol `__sw_hweight8' defined in .text section in lib/built-in.o

If we also move lib/built-in.o to the end, then the error goes away.

Is there any way for the linker to place the inputs to avoid unresolvable
relocations where possible?

A way to work around this is to make arch/sparc/lib/hweight.o an obj-y
rather than lib-y. That's a hack because it just serves to move the
input location, but not really any more of a hack than the current code
that also only works because of input locations...

Any thoughts?

Thanks,
Nick

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

linux-next: build failure after merge of most trees Stephen Rothwell <sfr@canb.auug.org.au> - 2017-06-22 07:30 +0200
  Re: linux-next: build failure after merge of most trees Nicholas Piggin <npiggin@gmail.com> - 2017-06-22 08:00 +0200
    Re: linux-next: build failure after merge of most trees Stephen Rothwell <sfr@canb.auug.org.au> - 2017-06-22 08:30 +0200
    Re: linux-next: build failure after merge of most trees Stephen Rothwell <sfr@canb.auug.org.au> - 2017-06-22 08:30 +0200
  Re: linux-next: build failure after merge of most trees Nicholas Piggin <npiggin@gmail.com> - 2017-06-22 10:50 +0200
    Re: linux-next: build failure after merge of most trees David Miller <davem@davemloft.net> - 2017-06-22 16:20 +0200
      Re: linux-next: build failure after merge of most trees David Miller <davem@davemloft.net> - 2017-06-22 16:30 +0200
        Re: linux-next: build failure after merge of most trees Nicholas Piggin <npiggin@gmail.com> - 2017-06-23 05:50 +0200
      Re: linux-next: build failure after merge of most trees Nicholas Piggin <npiggin@gmail.com> - 2017-06-22 16:40 +0200
        Re: linux-next: build failure after merge of most trees David Miller <davem@davemloft.net> - 2017-06-22 17:00 +0200
          Re: linux-next: build failure after merge of most trees Nicholas Piggin <npiggin@gmail.com> - 2017-06-23 05:40 +0200
          RE: linux-next: build failure after merge of most trees <yamada.masahiro@socionext.com> - 2017-06-23 08:50 +0200
            Re: linux-next: build failure after merge of most trees Stephen Rothwell <sfr@canb.auug.org.au> - 2017-06-23 09:10 +0200
            Re: linux-next: build failure after merge of most trees David Miller <davem@davemloft.net> - 2017-06-23 17:20 +0200
          Re: linux-next: build failure after merge of most trees Stephen Rothwell <sfr@canb.auug.org.au> - 2017-06-23 08:50 +0200
    Re: linux-next: build failure after merge of most trees Alan Modra <amodra@gmail.com> - 2017-06-22 16:20 +0200
      Re: linux-next: build failure after merge of most trees Nicholas Piggin <npiggin@gmail.com> - 2017-06-22 16:50 +0200

csiph-web