Re: svn commit: r292120 - in head/contrib/elftoolchain: addr2line common elfcopy libelf readelf

2015-12-13 Thread Warner Losh
On Sun, Dec 13, 2015 at 2:27 PM, Dimitry Andric  wrote:

> On 13 Dec 2015, at 18:04, Ruslan Makhmatkhanov  wrote:
> >
> > Sorry for break in, but I tried to update to r292130 and have this
> messages on `make kernel`. Does it by chance has something to do with
> toolchain update and was it fixed in subsequent commits? Thanks.
> >
> > ===> zlib (install)
> > install -o root -g wheel -m 555   zlib.ko /boot/kernel/
> > kldxref /boot/kernel
> > kldxref: unknown metadata record 4 in file atacard.ko
> > kldxref: unknown metadata record 4 in file atp.ko
> > kldxref: unknown metadata record 4 in file atp.ko
> > kldxref: unknown metadata record 4 in file cmx.ko
> > kldxref: unknown metadata record 4 in file fdc.ko
> > kldxref: unknown metadata record 4 in file if_an.ko
> > kldxref: unknown metadata record 4 in file if_aue.ko
> >
> > [...]
> >
> > It printed one this message for every kernel module.
>
> I think this is fixed by Warner's r292078:
>
> https://svnweb.freebsd.org/base?view=revision&revision=292078
>
>   Augment kldxref to find the new MODULE_PNP_INFO records now in
>   modules, simplify them into a more normal form and write them to
>   linker.hints.
>
>   Differential Review:
>   https://reviews.freebsd.org/D3461


Yes. Perhaps I should have dropped an UPDATING entry to explain
this. I thought I'd actually committed something so that it was silent
when kldxref didn't understand a metadata record a long time ago
so this sort of thing wouldn't happen. I thought I'd merged it last
summer in anticipation of this work landing. What is your build
environment?

The message has 0 to do with the toolchain update. It's all about
the new PNP info in the kernel modules.

Warner
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r292120 - in head/contrib/elftoolchain: addr2line common elfcopy libelf readelf

2015-12-13 Thread Dimitry Andric
On 13 Dec 2015, at 18:04, Ruslan Makhmatkhanov  wrote:
> 
> Sorry for break in, but I tried to update to r292130 and have this messages 
> on `make kernel`. Does it by chance has something to do with toolchain update 
> and was it fixed in subsequent commits? Thanks.
> 
> ===> zlib (install)
> install -o root -g wheel -m 555   zlib.ko /boot/kernel/
> kldxref /boot/kernel
> kldxref: unknown metadata record 4 in file atacard.ko
> kldxref: unknown metadata record 4 in file atp.ko
> kldxref: unknown metadata record 4 in file atp.ko
> kldxref: unknown metadata record 4 in file cmx.ko
> kldxref: unknown metadata record 4 in file fdc.ko
> kldxref: unknown metadata record 4 in file if_an.ko
> kldxref: unknown metadata record 4 in file if_aue.ko
> 
> [...]
> 
> It printed one this message for every kernel module.

I think this is fixed by Warner's r292078:

https://svnweb.freebsd.org/base?view=revision&revision=292078

  Augment kldxref to find the new MODULE_PNP_INFO records now in
  modules, simplify them into a more normal form and write them to
  linker.hints.

  Differential Review:
  https://reviews.freebsd.org/D3461

-Dimitry



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r292120 - in head/contrib/elftoolchain: addr2line common elfcopy libelf readelf

2015-12-13 Thread Benjamin Kaduk
On Sun, Dec 13, 2015 at 3:13 AM, Dimitry Andric  wrote:

> On 13 Dec 2015, at 09:43, Kai Wang  wrote:
> >
> > 2015-12-13 7:04 GMT+01:00 Adrian Chadd :
> > cc1: warnings being treated as errors
> >
> /usr/home/adrian/work/freebsd/head-embedded/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:
> > In function 'dump_dwarf':
> >
> /usr/home/adrian/work/freebsd/head-embedded/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:7479:
> > warning: 'b' may be used uninitialized in this function
> >
> /usr/home/adrian/work/freebsd/head-embedded/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:7479:
> > note: 'b' was declared here
> >
> /usr/home/adrian/work/freebsd/head-embedded/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:4758:
> > warning: 'pe' may be used uninitialized in this function
> >
> /usr/home/adrian/work/freebsd/head-embedded/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:4758:
> > note: 'pe' was declared here
> >
> > .. these both seem like legit.
> >
> >
> > Hi,
> >
> > Sorry about the breakage. Should be fixed by r292158.
> > Somehow clang didn't catch this. Had to use gcc to see this warning.
>
> Indeed, this is interesting.  For clang to warn similarly, the
> -Wconditional-uninitialized option has to be enabled explicitly, and
> then you get a lot of them (this is from just before your commit):
>
> /usr/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:4861:33:
> error: variable 'pe' may be uninitialized when used here
> [-Werror,-Wconditional-uninitialized]
> dirndx = _decode_uleb128(&p, pe);
> [...]
> I'll check if there is a specific reason upstream does not enable this
> warning by default for -Wall.  Maybe there is a risk of false positives.
>
> -Dimitry
>
>
I'm pretty sure I've seen lots of false positives from
-Wconditional-uninitialized in the krb5 and openafs codebases.  I either
set -Wno-error=conditional-uninitialized or -Wno-conditional-uninitialized
depending on how distracting they are in my build logs.

-Ben
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r292120 - in head/contrib/elftoolchain: addr2line common elfcopy libelf readelf

2015-12-13 Thread Ruslan Makhmatkhanov
Sorry for break in, but I tried to update to r292130 and have this 
messages on `make kernel`. Does it by chance has something to do with 
toolchain update and was it fixed in subsequent commits? Thanks.


===> zlib (install)
install -o root -g wheel -m 555   zlib.ko /boot/kernel/
kldxref /boot/kernel
kldxref: unknown metadata record 4 in file atacard.ko
kldxref: unknown metadata record 4 in file atp.ko
kldxref: unknown metadata record 4 in file atp.ko
kldxref: unknown metadata record 4 in file cmx.ko
kldxref: unknown metadata record 4 in file fdc.ko
kldxref: unknown metadata record 4 in file if_an.ko
kldxref: unknown metadata record 4 in file if_aue.ko

[...]

It printed one this message for every kernel module.

--
Regards,
Ruslan

T.O.S. Of Reality
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r292120 - in head/contrib/elftoolchain: addr2line common elfcopy libelf readelf

2015-12-13 Thread Dimitry Andric
On 13 Dec 2015, at 09:43, Kai Wang  wrote:
> 
> 2015-12-13 7:04 GMT+01:00 Adrian Chadd :
> cc1: warnings being treated as errors
> /usr/home/adrian/work/freebsd/head-embedded/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:
> In function 'dump_dwarf':
> /usr/home/adrian/work/freebsd/head-embedded/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:7479:
> warning: 'b' may be used uninitialized in this function
> /usr/home/adrian/work/freebsd/head-embedded/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:7479:
> note: 'b' was declared here
> /usr/home/adrian/work/freebsd/head-embedded/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:4758:
> warning: 'pe' may be used uninitialized in this function
> /usr/home/adrian/work/freebsd/head-embedded/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:4758:
> note: 'pe' was declared here
> 
> .. these both seem like legit.
> 
> 
> Hi,
> 
> Sorry about the breakage. Should be fixed by r292158.
> Somehow clang didn't catch this. Had to use gcc to see this warning.

Indeed, this is interesting.  For clang to warn similarly, the
-Wconditional-uninitialized option has to be enabled explicitly, and
then you get a lot of them (this is from just before your commit):

/usr/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:4861:33: 
error: variable 'pe' may be uninitialized when used here 
[-Werror,-Wconditional-uninitialized]
dirndx = _decode_uleb128(&p, pe);
 ^~
/usr/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:4758:17: 
note: initialize the variable 'pe' to silence this warning
uint8_t *p, *pe;
   ^
= NULL
/usr/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:6167:8: 
error: variable 'cie_ra' may be uninitialized when used here 
[-Werror,-Wconditional-uninitialized]
cie_ra);
^~
/usr/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:6060:19: 
note: initialize the variable 'cie_ra' to silence this warning
Dwarf_Half cie_ra;
 ^
  = 0
/usr/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:6164:8: 
error: variable 'cie_caf' may be uninitialized when used here 
[-Werror,-Wconditional-uninitialized]
cie_caf, cie_daf, low_pc, re->dbg);
^~~
/usr/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:6057:24: 
note: initialize the variable 'cie_caf' to silence this warning
Dwarf_Unsigned cie_caf, cie_daf, cie_instlen, func_len, fde_length;
  ^
   = 0
/usr/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:6164:17: 
error: variable 'cie_daf' may be uninitialized when used here 
[-Werror,-Wconditional-uninitialized]
cie_caf, cie_daf, low_pc, re->dbg);
 ^~~
/usr/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:6057:33: 
note: initialize the variable 'cie_daf' to silence this warning
Dwarf_Unsigned cie_caf, cie_daf, cie_instlen, func_len, fde_length;
   ^
= 0
/usr/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:7492:21: 
error: variable 'b' may be uninitialized when used here 
[-Werror,-Wconditional-uninitialized]
if (shift < 32 && (b & 0x40) != 0)
   ^
/usr/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:7479:11: 
note: initialize the variable 'b' to silence this warning
uint8_t b;
 ^
  = '\0'
5 errors generated.

I'll check if there is a specific reason upstream does not enable this
warning by default for -Wall.  Maybe there is a risk of false positives.

-Dimitry



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r292120 - in head/contrib/elftoolchain: addr2line common elfcopy libelf readelf

2015-12-13 Thread Kai Wang
2015-12-13 7:04 GMT+01:00 Adrian Chadd :

> Hm!
>
> cc1: warnings being treated as errors
>
> /usr/home/adrian/work/freebsd/head-embedded/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:
> In function 'dump_dwarf':
>
> /usr/home/adrian/work/freebsd/head-embedded/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:7479:
> warning: 'b' may be used uninitialized in this function
>
> /usr/home/adrian/work/freebsd/head-embedded/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:7479:
> note: 'b' was declared here
>
> /usr/home/adrian/work/freebsd/head-embedded/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:4758:
> warning: 'pe' may be used uninitialized in this function
>
> /usr/home/adrian/work/freebsd/head-embedded/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:4758:
> note: 'pe' was declared here
>
> .. these both seem like legit.
>
>
Hi,

Sorry about the breakage. Should be fixed by r292158.
Somehow clang didn't catch this. Had to use gcc to see this warning.

Thanks,
Kai
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r292120 - in head/contrib/elftoolchain: addr2line common elfcopy libelf readelf

2015-12-12 Thread Adrian Chadd
Hm!

cc1: warnings being treated as errors
/usr/home/adrian/work/freebsd/head-embedded/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:
In function 'dump_dwarf':
/usr/home/adrian/work/freebsd/head-embedded/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:7479:
warning: 'b' may be used uninitialized in this function
/usr/home/adrian/work/freebsd/head-embedded/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:7479:
note: 'b' was declared here
/usr/home/adrian/work/freebsd/head-embedded/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:4758:
warning: 'pe' may be used uninitialized in this function
/usr/home/adrian/work/freebsd/head-embedded/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:4758:
note: 'pe' was declared here

.. these both seem like legit.


-a
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r292120 - in head/contrib/elftoolchain: addr2line common elfcopy libelf readelf

2015-12-11 Thread Ed Maste
Author: emaste
Date: Fri Dec 11 20:28:27 2015
New Revision: 292120
URL: https://svnweb.freebsd.org/changeset/base/292120

Log:
  Update to ELF Tool Chain r3272
  
  Highlights (not already in the FreeBSD tree):
   - addr2line: Speed up and support searching inlined functions
   - addr2line: Support -i, -a, -p options
   - readelf: Add some ARM relocation types
   - readelf, libelf: Avoid reading beyond end of buffer/file
  
  Relnotes: Yes
  Sponsored by: The FreeBSD Foundation

Modified:
  head/contrib/elftoolchain/addr2line/addr2line.1
  head/contrib/elftoolchain/addr2line/addr2line.c
  head/contrib/elftoolchain/common/elfdefinitions.h
  head/contrib/elftoolchain/elfcopy/binary.c
  head/contrib/elftoolchain/elfcopy/elfcopy.1
  head/contrib/elftoolchain/elfcopy/main.c
  head/contrib/elftoolchain/elfcopy/sections.c
  head/contrib/elftoolchain/elfcopy/segments.c
  head/contrib/elftoolchain/libelf/elf_data.c
  head/contrib/elftoolchain/readelf/readelf.c
Directory Properties:
  head/contrib/elftoolchain/   (props changed)

Modified: head/contrib/elftoolchain/addr2line/addr2line.1
==
--- head/contrib/elftoolchain/addr2line/addr2line.1 Fri Dec 11 20:14:19 
2015(r292119)
+++ head/contrib/elftoolchain/addr2line/addr2line.1 Fri Dec 11 20:28:27 
2015(r292120)
@@ -22,9 +22,9 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $Id: addr2line.1 3195 2015-05-12 17:22:19Z emaste $
+.\" $Id: addr2line.1 3263 2015-11-30 04:25:54Z kaiwang27 $
 .\"
-.Dd July 25, 2010
+.Dd November 30, 2015
 .Os
 .Dt ADDR2LINE 1
 .Sh NAME
@@ -32,10 +32,13 @@
 .Nd translate program addresses to source file names and line numbers
 .Sh SYNOPSIS
 .Nm
+.Op Fl a | Fl -addresses
 .Op Fl b Ar target | Fl -target Ns = Ns Ar target
 .Op Fl e Ar pathname | Fl -exe Ns = Ns Ar pathname
 .Op Fl f | Fl -functions
+.Op Fl i | Fl -inlines
 .Op Fl j Ar sectionname | Fl -section Ns = Ns Ar sectionname
+.Op Fl p | Fl -pretty-print
 .Op Fl s | Fl -basename
 .Op Fl C | Fl -demangle
 .Op Fl H | Fl -help
@@ -69,6 +72,8 @@ The
 .Nm
 utility recognizes the following options:
 .Bl -tag -width indent
+.It Fl a | Fl -addresses
+Display the address prior to the line number information.
 .It Fl b Ar target | Fl -target Ns = Ns Ar target
 This option is recognized by
 .Nm
@@ -84,11 +89,17 @@ will use the file
 .Dq Pa a.out .
 .It Fl f | Fl -functions
 Display function names in addition to file and line number information.
+.It Fl i | Fl -inlines
+If the address specified belongs to an inlined function, also display the line
+number information for its caller, recursively until the first non-inlined
+caller.
 .It Fl j Ar sectionname | Fl -section Ns = Ns Ar sectionname
 The values specified by arguments
 .Ar hexaddress
 are to be treated as offsets into the section named
 .Ar sectionname .
+.It Fl p | -pretty-print
+Display the line number information on one line, in human readable manner.
 .It Fl s | -basename
 Display only the base name for each file name.
 .It Fl C | Fl -demangle
@@ -115,6 +126,18 @@ to program address
 .Ar hexaddress ,
 followed by a line with the file name and line number.
 .Pp
+If the
+.Fl p
+option was specified,
+.Nm
+will print line number information and function name on one line in
+human readable manner. If the
+.Fl i
+option was also specified,
+.Nm
+will print the caller function information prefixed with
+.Dq (inlined by) .
+.Pp
 The
 .Nm
 utility prints the file name and line number using the format

Modified: head/contrib/elftoolchain/addr2line/addr2line.c
==
--- head/contrib/elftoolchain/addr2line/addr2line.c Fri Dec 11 20:14:19 
2015(r292119)
+++ head/contrib/elftoolchain/addr2line/addr2line.c Fri Dec 11 20:28:27 
2015(r292120)
@@ -37,33 +37,64 @@
 #include 
 #include 
 
+#include "uthash.h"
 #include "_elftc.h"
 
-ELFTC_VCSID("$Id: addr2line.c 3249 2015-10-04 08:11:30Z kaiwang27 $");
+ELFTC_VCSID("$Id: addr2line.c 3264 2015-11-30 05:38:14Z kaiwang27 $");
+
+struct Func {
+   char *name;
+   Dwarf_Unsigned lopc;
+   Dwarf_Unsigned hipc;
+   Dwarf_Unsigned call_file;
+   Dwarf_Unsigned call_line;
+   Dwarf_Ranges *ranges;
+   Dwarf_Signed ranges_cnt;
+   struct Func *inlined_caller;
+   STAILQ_ENTRY(Func) next;
+};
+
+struct CU {
+   Dwarf_Off off;
+   Dwarf_Unsigned lopc;
+   Dwarf_Unsigned hipc;
+   char **srcfiles;
+   Dwarf_Signed nsrcfiles;
+   STAILQ_HEAD(, Func) funclist;
+   UT_hash_handle hh;
+};
 
 static struct option longopts[] = {
+   {"addresses", no_argument, NULL, 'a'},
{"target" , required_argument, NULL, 'b'},
{"demangle", no_argument, NULL, 'C'},
{"exe", required_argument, NULL, 'e'},
{"functions", no_argument, NUL