[PATCH] elf: Get the real kept section

Hans-Peter Nilsson hp@axis.com
Fri Nov 27 14:19:32 GMT 2020


> From: "H.J. Lu" <hjl.tools@gmail.com>
> Date: Fri, 27 Nov 2020 14:54:59 +0100

> On Fri, Nov 27, 2020 at 5:49 AM Hans-Peter Nilsson <hp@axis.com> wrote:
> >
> > > From: "H.J. Lu" <hjl.tools@gmail.com>
> > > Date: Fri, 27 Nov 2020 14:31:32 +0100
> >
> > > On Thu, Nov 26, 2020 at 10:14 PM Hans-Peter Nilsson <hp@axis.com> wrote:
> > > > Ever since that was committed, I see, for a
> > > > --target=cris-axis-linux-gnu cross on a Debian 9 x86_64
> > > > with 'CC=gcc -O2 -m32':
> > > >
> > > > Running /x/hpautotest-binutils/bsrc/src/ld/testsuite/ld-elf/elf.exp ...
> > > > FAIL: ld-elf/pr26936
> > > >
> > > > And at 647cebce12 (i.e. containing Alan's fix), the ld.log has:
> > > > ------
> > > > extra regexps in /x/hpautotest-binutils/bsrc/src/ld/testsuite/ld-elf/pr26936.d starting with "^CU: .*/pr26936c.s:$"
> > > > EOF from tmpdir/dump.out
> > > > FAIL: ld-elf/pr26936
> > > > ------
> > > >
> > > > dump.out:
> > > > ------
> > > > Contents of the .debug_line section:
> > > > pr26936c.s:
> > > ^^^^^^^^^^^^^^^^^
> > >
> > > Why is there no directory name?
> >
> > I have no clue.
> 
> "readelf -wL" should display
> 
> CU: ..../pr26936c.s:

That's what pr26936.d says, and what ld.log tells us is missing,
yes...

> Please show your full "readelf -wL" command line and its full output.

I copy-pasted the actual line from ld.log when producing the
output above so it *was* the full output.  IOW, was produced by
"/x/hpautotest-binutils/cris-axis-linux-gnu/ld/../binutils/readelf
-wL tmpdir/dump > tmpdir/dump.out" (though x withheld).

Again, but this time at 2c6f3e56cb, the contents is:

------
Contents of the .debug_line section:

pr26936a.s:
File name                            Line number    Starting address    View    Stmt
pr26936a.s                                     6             0x10054               x
pr26936a.s                                     -             0x10056


pr26936b.s:
File name                            Line number    Starting address    View    Stmt
pr26936b.s                                    17             0x10056               x
pr26936b.s                                     -             0x10058

pr26936b.s                                    23             0x10054               x
pr26936b.s                                     -             0x10056


pr26936c.s:
File name                            Line number    Starting address    View    Stmt
pr26936c.s                                     6             0x10054               x
pr26936c.s                                     -             0x10056


------

A hunch: maybe a couple of "#ifdef OBJ_ELF" in gas somewhere
should have been "#if defined (OBJ_ELF) || defined
(OBJ_MAYBE_ELF)".

Incidentally, I'm thinking the whole fmt=multi / obj-multi gas
thing should be retired.  Which I'm fine with of course, as long
as "--em=..." (with "..." a fixed per-configuration string), is
handled for compatibility.  (Separately to fixing the bug.)

> I am running Fedora 33.  I used
> 
> CC="gcc -m32 -O2" CXX="g++ -m32" /export/gnu/import/git/gitlab/x86-binutils/conf
> igure \
> \
> --target=cris-axis-linux-gnu \
> --enable-plugins --disable-gdb --disable-gdbserver --disable-libdecnumbe
> r --disable-readline --disable-sim --with-sysroot=/ --with-system-zlib \
> --prefix=/usr/local \
> --with-local-prefix=/usr/local
> 
> to configure binutils.

Thanks.  Maybe it's the "--with-sysroot=/" that matters,
otherwise most curious.  I'm just passing the --target option,
but to contents from a binutils release tarball corresponding to
your --disable options.

brgds, H-P


More information about the Binutils mailing list