All of lore.kernel.org
 help / color / mirror / Atom feed
* [kbuild:thin-ar 5/8] ia64-linux-ld: warning: .note.gnu.build-id section discarded, --build-id ignored.
@ 2017-06-22  3:48 kbuild test robot
  2017-06-22  4:33 ` Nicholas Piggin
  0 siblings, 1 reply; 5+ messages in thread
From: kbuild test robot @ 2017-06-22  3:48 UTC (permalink / raw)
  To: Nicholas Piggin; +Cc: kbuild-all, linux-kbuild, Masahiro Yamada

[-- Attachment #1: Type: text/plain, Size: 898 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git thin-ar
head:   f9aac183deb53716ea92f528595758e3c9ef3539
commit: c5784ad98b773d08562a34b700e9c5e84763c0d8 [5/8] ia64: thin archives fix linking
config: ia64-allnoconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 6.2.0
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout c5784ad98b773d08562a34b700e9c5e84763c0d8
        # save the attached .config to linux build tree
        make.cross ARCH=ia64 

All warnings (new ones prefixed by >>):

>> ia64-linux-ld: warning: .note.gnu.build-id section discarded, --build-id ignored.

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 5989 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [kbuild:thin-ar 5/8] ia64-linux-ld: warning: .note.gnu.build-id section discarded, --build-id ignored.
  2017-06-22  3:48 [kbuild:thin-ar 5/8] ia64-linux-ld: warning: .note.gnu.build-id section discarded, --build-id ignored kbuild test robot
@ 2017-06-22  4:33 ` Nicholas Piggin
  2017-06-22  5:42   ` Nicholas Piggin
  2017-06-22 14:04   ` Alan Modra
  0 siblings, 2 replies; 5+ messages in thread
From: Nicholas Piggin @ 2017-06-22  4:33 UTC (permalink / raw)
  To: kbuild test robot; +Cc: kbuild-all, linux-kbuild, Masahiro Yamada, Alan Modra

On Thu, 22 Jun 2017 11:48:38 +0800
kbuild test robot <fengguang.wu@intel.com> wrote:

> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git thin-ar
> head:   f9aac183deb53716ea92f528595758e3c9ef3539
> commit: c5784ad98b773d08562a34b700e9c5e84763c0d8 [5/8] ia64: thin archives fix linking
> config: ia64-allnoconfig (attached as .config)
> compiler: ia64-linux-gcc (GCC) 6.2.0
> reproduce:
>         wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         git checkout c5784ad98b773d08562a34b700e9c5e84763c0d8
>         # save the attached .config to linux build tree
>         make.cross ARCH=ia64 
> 
> All warnings (new ones prefixed by >>):
> 
> >> ia64-linux-ld: warning: .note.gnu.build-id section discarded, --build-id ignored.  


Sigh.

What's happening here is that when performing the final link with the
-R option, the linker forgets to emit the --build-id section it was
asked to.

This is the final link command line that causes the error:

$ ia64-linux-ld -static -R arch/ia64/kernel/gate-syms.o --build-id -o vmlinux -T ./arch/ia64/kernel/vmlinux.lds --whole-archive built-in.o --no-whole-archive --start-group lib/lib.a arch/ia64/lib/lib.a --end-group

However it links successfully if I do this:

$ ia64-linux/bin/ia64-linux-ld -r -R arch/ia64/kernel/gate-syms.o -o syms.o
$ ia64-linux/bin/ia64-linux-ld -static syms.o --build-id -o vmlinux -T ./arch/ia64/kernel/vmlinux.lds --whole-archive built-in.o --no-whole-archive --start-group lib/lib.a arch/ia64/lib/lib.a --end-group

I.e., create an intermediate object file with the symbols first using
symbols from gate-syms.o, and use that in the final link rather than -R

Alan do you have any idea what the problem might be here?

If it turns out to be a toolchain bug or limitation, I can do the same
workaround in the kernel.

Thanks,
Nick

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [kbuild:thin-ar 5/8] ia64-linux-ld: warning: .note.gnu.build-id section discarded, --build-id ignored.
  2017-06-22  4:33 ` Nicholas Piggin
@ 2017-06-22  5:42   ` Nicholas Piggin
  2017-06-22 14:04   ` Alan Modra
  1 sibling, 0 replies; 5+ messages in thread
From: Nicholas Piggin @ 2017-06-22  5:42 UTC (permalink / raw)
  To: kbuild test robot; +Cc: kbuild-all, linux-kbuild, Masahiro Yamada, Alan Modra

On Thu, 22 Jun 2017 14:33:27 +1000
Nicholas Piggin <npiggin@gmail.com> wrote:

> On Thu, 22 Jun 2017 11:48:38 +0800
> kbuild test robot <fengguang.wu@intel.com> wrote:
> 
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git thin-ar
> > head:   f9aac183deb53716ea92f528595758e3c9ef3539
> > commit: c5784ad98b773d08562a34b700e9c5e84763c0d8 [5/8] ia64: thin archives fix linking
> > config: ia64-allnoconfig (attached as .config)
> > compiler: ia64-linux-gcc (GCC) 6.2.0
> > reproduce:
> >         wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         git checkout c5784ad98b773d08562a34b700e9c5e84763c0d8
> >         # save the attached .config to linux build tree
> >         make.cross ARCH=ia64 
> > 
> > All warnings (new ones prefixed by >>):
> >   
> > >> ia64-linux-ld: warning: .note.gnu.build-id section discarded, --build-id ignored.    
> 
> 
> Sigh.
> 
> What's happening here is that when performing the final link with the
> -R option, the linker forgets to emit the --build-id section it was
> asked to.
> 
> This is the final link command line that causes the error:
> 
> $ ia64-linux-ld -static -R arch/ia64/kernel/gate-syms.o --build-id -o vmlinux -T ./arch/ia64/kernel/vmlinux.lds --whole-archive built-in.o --no-whole-archive --start-group lib/lib.a arch/ia64/lib/lib.a --end-group
> 
> However it links successfully if I do this:
> 
> $ ia64-linux/bin/ia64-linux-ld -r -R arch/ia64/kernel/gate-syms.o -o syms.o
> $ ia64-linux/bin/ia64-linux-ld -static syms.o --build-id -o vmlinux -T ./arch/ia64/kernel/vmlinux.lds --whole-archive built-in.o --no-whole-archive --start-group lib/lib.a arch/ia64/lib/lib.a --end-group
> 
> I.e., create an intermediate object file with the symbols first using
> symbols from gate-syms.o, and use that in the final link rather than -R
> 
> Alan do you have any idea what the problem might be here?
> 
> If it turns out to be a toolchain bug or limitation, I can do the same
> workaround in the kernel.

Here is the fix for the kernel for ia64 (tile and sh would have to
follow).

This creates a .o file with the gate symbols and then that is used for
the final link input (rather than -R symbol file).  I think this is
actually the right way to go about it.

I'll resend new patches for the 3 archs unless there is another suggestion.

Thanks,
Nick

---
 arch/ia64/kernel/Makefile.gate | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/ia64/kernel/Makefile.gate b/arch/ia64/kernel/Makefile.gate
index a32903ada016..f89219e20b25 100644
--- a/arch/ia64/kernel/Makefile.gate
+++ b/arch/ia64/kernel/Makefile.gate
@@ -2,7 +2,9 @@
 
 targets += gate.so gate-syms.o
 
-extra-y += gate.so gate-syms.o gate.lds gate.o
+obj-y += gate-syms.o
+
+extra-y += gate.so gate.lds gate.o
 
 CPPFLAGS_gate.lds := -P -C -U$(ARCH)
 
@@ -14,14 +16,15 @@ GATECFLAGS_gate.so = -shared -s -Wl,-soname=linux-gate.so.1 \
 $(obj)/gate.so: $(obj)/gate.lds $(obj)/gate.o FORCE
 	$(call if_changed,gate)
 
-$(obj)/built-in.o: $(obj)/gate-syms.o
-$(obj)/built-in.o: ld_flags += -R $(obj)/gate-syms.o
+# create an object file to resolve gate symbols
+quiet_cmd_gate_syms = GATE    $@
+      cmd_gate_syms = $(LD) -r -T $(obj)/gate.lds -R $(obj)/gate.o -o$(obj)/gate-syms.o
 
-GATECFLAGS_gate-syms.o = -r
 $(obj)/gate-syms.o: $(obj)/gate.lds $(obj)/gate.o FORCE
-	$(call if_changed,gate)
+	$(call if_changed,gate_syms)
 
 # gate-data.o contains the gate DSO image as data in section .data..gate.
 # We must build gate.so before we can assemble it.
 # Note: kbuild does not track this dependency due to usage of .incbin
 $(obj)/gate-data.o: $(obj)/gate.so
+
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [kbuild:thin-ar 5/8] ia64-linux-ld: warning: .note.gnu.build-id section discarded, --build-id ignored.
  2017-06-22  4:33 ` Nicholas Piggin
  2017-06-22  5:42   ` Nicholas Piggin
@ 2017-06-22 14:04   ` Alan Modra
  2017-06-22 14:23     ` Nicholas Piggin
  1 sibling, 1 reply; 5+ messages in thread
From: Alan Modra @ 2017-06-22 14:04 UTC (permalink / raw)
  To: Nicholas Piggin
  Cc: kbuild test robot, kbuild-all, linux-kbuild, Masahiro Yamada

On Thu, Jun 22, 2017 at 02:33:27PM +1000, Nicholas Piggin wrote:
> On Thu, 22 Jun 2017 11:48:38 +0800
> kbuild test robot <fengguang.wu@intel.com> wrote:
> > >> ia64-linux-ld: warning: .note.gnu.build-id section discarded, --build-id ignored.  
> 
> 
> Sigh.
> 
> What's happening here is that when performing the final link with the
> -R option, the linker forgets to emit the --build-id section it was
> asked to.
> 
> This is the final link command line that causes the error:
> 
> $ ia64-linux-ld -static -R arch/ia64/kernel/gate-syms.o --build-id -o vmlinux -T ./arch/ia64/kernel/vmlinux.lds --whole-archive built-in.o --no-whole-archive --start-group lib/lib.a arch/ia64/lib/lib.a --end-group

Try putting the --just-symbols (-R) file after --no-whole-archive.
The idea being to make it not the first object file.  --just-symbols
files have their contents discarded, and the linker is stupidly
attaching the section it creates to hold the build-id, to that file.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [kbuild:thin-ar 5/8] ia64-linux-ld: warning: .note.gnu.build-id section discarded, --build-id ignored.
  2017-06-22 14:04   ` Alan Modra
@ 2017-06-22 14:23     ` Nicholas Piggin
  0 siblings, 0 replies; 5+ messages in thread
From: Nicholas Piggin @ 2017-06-22 14:23 UTC (permalink / raw)
  To: Alan Modra; +Cc: kbuild test robot, kbuild-all, linux-kbuild, Masahiro Yamada

On Thu, 22 Jun 2017 23:34:01 +0930
Alan Modra <amodra@gmail.com> wrote:

> On Thu, Jun 22, 2017 at 02:33:27PM +1000, Nicholas Piggin wrote:
> > On Thu, 22 Jun 2017 11:48:38 +0800
> > kbuild test robot <fengguang.wu@intel.com> wrote:  
> > > >> ia64-linux-ld: warning: .note.gnu.build-id section discarded, --build-id ignored.    
> > 
> > 
> > Sigh.
> > 
> > What's happening here is that when performing the final link with the
> > -R option, the linker forgets to emit the --build-id section it was
> > asked to.
> > 
> > This is the final link command line that causes the error:
> > 
> > $ ia64-linux-ld -static -R arch/ia64/kernel/gate-syms.o --build-id -o vmlinux -T ./arch/ia64/kernel/vmlinux.lds --whole-archive built-in.o --no-whole-archive --start-group lib/lib.a arch/ia64/lib/lib.a --end-group  
> 
> Try putting the --just-symbols (-R) file after --no-whole-archive.
> The idea being to make it not the first object file.  --just-symbols
> files have their contents discarded, and the linker is stupidly
> attaching the section it creates to hold the build-id, to that file.
> 

That makes sense. It's a bit tricky to do this with the way options are
provided by the arch code to the final link, but I worked around it by
linking a small dummy .o file with the symbols and pulling that into the
final link.

Thanks,
Nick

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-06-22 14:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-22  3:48 [kbuild:thin-ar 5/8] ia64-linux-ld: warning: .note.gnu.build-id section discarded, --build-id ignored kbuild test robot
2017-06-22  4:33 ` Nicholas Piggin
2017-06-22  5:42   ` Nicholas Piggin
2017-06-22 14:04   ` Alan Modra
2017-06-22 14:23     ` Nicholas Piggin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.