Seems gcc help is missing, add back gcc help On Wed, Oct 14, 2020 at 5:22 PM Jiany Wu <wujianyue000@xxxxxxxxx> wrote: > When try to check Line Table, seems there are many errors saying There is > a hole. I checked the OK version, seems also has holes, but not so many > holes;-) > > # readelf --debug-dump=loc libfoo.so | head > readelf: libfoo.so: Warning: Location lists in .debug_loc > section start at 0x6 > readelf: libfoo.so: Warning: There is a hole [0x52 - 0x54] in .debug_loc > section. > readelf: libfoo.so: Warning: There is a hole [0x77 - 0x7d] in .debug_loc > section. > readelf: libfoo.so: Warning: There is a hole [0xc6 - 0xd2] in .debug_loc > section. > Contents of the .debug_loc section: > readelf: libfoo.so: Warning: > There is a hole [0x157 - 0x163] in .debug_loc section. > Offset Begin End Expression > 00000006 0000000000257a70 0000000000257a81 (DW_OP_reg5 (rdi)) > 00000019 0000000000257a81 0000000000257aae (DW_OP_reg6 (rbp)) > 0000002c 0000000000257aae 0000000000257aaf (DW_OP_GNU_entry_value: ( > DW_OP_reg5 (rdi)); DW_OP_stack_value) > 00000042 <End of list> > readelf: libfoo.so: Warning: There is a hole [0x1fa - 0x202] in .debug_loc > section. > 00000054 0000000000257a8e 0000000000257a98 (DW_OP_reg3 (rbx)) > 00000067 <End of list> > 0000007d 0000000000257a7c 0000000000257a8e (DW_OP_reg3 (rbx)) > readelf: libfoo.so: Warning: There is a hole [0x25e - 0x260] in .debug_loc > section. > > On Wed, Oct 14, 2020 at 4:30 PM Jiany Wu <wujianyue000@xxxxxxxxx> wrote: > >> Also tried -flto=thin -ffat-lto-objects, result seems same, still can't >> find file and line. >> >> On Wed, Oct 14, 2020 at 2:58 PM Jiany Wu <wujianyue000@xxxxxxxxx> wrote: >> >>> x86_64-pc-linux-gnu-gcc *.a(many internal .a, checked, they all built >>> with gcc 9.1.0) -ldpdk -Wl,--no-whole-archive -lz -llzma -lcurl -lssl >>> -lcrypto -lcrypt -lcap -lpthread -lrt -lstdc++ -ldl -lm -lsctp -lpcap >>> -lminizip -o libfoo.so >>> >>> >>> On Wed, Oct 14, 2020 at 2:56 PM Jiany Wu <wujianyue000@xxxxxxxxx> wrote: >>> >>>> It has different static libraries, shared libraries, so different GCC >>>> used, like 6.4.1(assume from other shared libraries), project itself is >>>> using 9.1.0. >>>> >>>> On Wed, Oct 14, 2020 at 2:54 PM Jiany Wu <wujianyue000@xxxxxxxxx> >>>> wrote: >>>> >>>>> I also tried to use -flto -fno-fat-lto-objects, but seems still >>>>> not working. >>>>> >>>>> strings -a libfoo.so | grep GNU.*march >>>>> GNU C17 9.1.0 -m64 -march=corei7 -g -O2 -O3 >>>>> -feliminate-unused-debug-types -fPIC >>>>> GNU C17 9.1.0 -m64 -march=corei7 -mavx2 -g -O2 -O3 >>>>> -feliminate-unused-debug-types -fPIC >>>>> GNU C17 9.1.0 -m64 -march=corei7 -g -O2 -feliminate-unused-debug-types >>>>> -fPIC >>>>> GNU C17 9.1.0 -m64 -march=corei7 -g -O2 -O3 >>>>> -feliminate-unused-debug-types -fno-strict-aliasing -fPIC >>>>> GNU C99 9.1.0 -m64 -march=corei7 -g -O2 -O3 -std=gnu99 >>>>> -feliminate-unused-debug-types -fPIC >>>>> GNU C17 9.1.0 -m64 -march=corei7 -g -O2 -O3 >>>>> -feliminate-unused-debug-types -flax-vector-conversions -fPIC >>>>> GNU C17 9.1.0 -m64 -march=corei7 -g -O2 -Ofast >>>>> -feliminate-unused-debug-types -fno-prefetch-loop-arrays -fPIC >>>>> GNU C17 9.1.0 -m64 -march=corei7 -g -g -O2 -O3 >>>>> -feliminate-unused-debug-types -fPIC >>>>> GNU C17 9.1.0 -P -m64 -march=tremont -mtune=tremont -mfpmath=sse >>>>> -msse4.2 -ggdb3 -g3 -O3 -ftree-vectorize -fno-dwarf2-cfi-asm >>>>> -funwind-tables -fPIC -ftls-model=initial-exec -flto -fno-fat-lto-objects >>>>> -fno-strict-aliasing -fasynchronous-unwind-tables -fmessage-length=0 >>>>> GNU C++11 9.1.0 -P -m64 -march=tremont -mtune=tremont -mfpmath=sse >>>>> -msse4.2 -ggdb3 -g3 -O3 -std=c++11 -fno-exceptions -fPIC >>>>> -ftls-model=initial-exec -flto -fno-fat-lto-objects -fno-strict-aliasing >>>>> -fasynchronous-unwind-tables -fmessage-length=0 >>>>> GNU C++98 9.1.0 -P -m64 -march=tremont -mtune=tremont -mfpmath=sse >>>>> -msse4.2 -ggdb3 -g3 -O3 -std=c++98 -fPIC -ftls-model=initial-exec -flto >>>>> -fno-fat-lto-objects -fno-strict-aliasing -fasynchronous-unwind-tables >>>>> -fmessage-length=0 >>>>> GNU C17 9.1.0 -P -m64 -march=tremont -mtune=tremont -mfpmath=sse >>>>> -msse4.2 -ggdb3 -g3 -O3 -fvisibility=hidden -ftree-vectorize >>>>> -fno-dwarf2-cfi-asm -funwind-tables -fPIC -ftls-model=initial-exec -flto >>>>> -fno-fat-lto-objects -fno-strict-aliasing -fasynchronous-unwind-tables >>>>> -fmessage-length=0 >>>>> GNU C++14 9.1.0 -P -m64 -march=tremont -mtune=tremont -mfpmath=sse >>>>> -msse4.2 -ggdb3 -g3 -O3 -fvisibility=hidden -fPIC -ftls-model=initial-exec >>>>> -flto -fno-fat-lto-objects -fno-strict-aliasing >>>>> -fasynchronous-unwind-tables -fmessage-length=0 >>>>> GNU C++14 9.1.0 -P -m64 -march=tremont -mtune=tremont -mfpmath=sse >>>>> -msse4.2 -ggdb3 -g3 -O3 -fPIC -ftls-model=initial-exec -flto >>>>> -fno-fat-lto-objects -fno-strict-aliasing -fasynchronous-unwind-tables >>>>> -fmessage-length=0 >>>>> GNU C17 9.1.0 -P -m64 -march=tremont -mtune=tremont -mfpmath=sse >>>>> -msse4.2 -ggdb3 -g3 -O3 -O0 -ftree-vectorize -fno-dwarf2-cfi-asm >>>>> -funwind-tables -fPIC -ftls-model=initial-exec -flto -fno-fat-lto-objects >>>>> -fno-strict-aliasing -fasynchronous-unwind-tables -fmessage-length=0 >>>>> GNU C17 9.1.0 -P -m64 -march=tremont -mtune=tremont -mfpmath=sse >>>>> -msse4.2 -ggdb3 -g3 -O3 -fdefer-pop -fmerge-constants -fthread-jumps >>>>> -fif-conversion -fif-conversion2 -fguess-branch-probability >>>>> -fcprop-registers -foptimize-sibling-calls -fcse-follow-jumps >>>>> -frerun-cse-after-loop -fgcse -fgcse-lm -fgcse-sm -fgcse-las >>>>> -fdelete-null-pointer-checks -fexpensive-optimizations -fsched-interblock >>>>> -fsched-spec -fcaller-saves -fpeephole2 -freorder-blocks >>>>> -freorder-functions -funit-at-a-time -falign-functions -falign-jumps >>>>> -falign-loops -falign-labels -fcrossjumping -finline-functions >>>>> -ftree-vectorize -fno-dwarf2-cfi-asm -funwind-tables -fPIC >>>>> -ftls-model=initial-exec -flto -fno-fat-lto-objects -fno-strict-aliasing >>>>> -fasynchronous-unwind-tables -fmessage-length=0 >>>>> GNU C11 9.1.0 -P -m64 -march=tremont -mtune=tremont -mfpmath=sse >>>>> -msse4.2 -ggdb3 -g3 -O3 -std=gnu11 -ftree-vectorize -fno-dwarf2-cfi-asm >>>>> -funwind-tables -fPIC -ftls-model=initial-exec -flto -fno-fat-lto-objects >>>>> -fno-strict-aliasing -fasynchronous-unwind-tables -fmessage-length=0 >>>>> GNU C++11 9.1.0 -P -m64 -march=tremont -mtune=tremont -mfpmath=sse >>>>> -msse4.2 -ggdb3 -g3 -O3 -std=c++11 -fPIC -ftls-model=initial-exec -flto >>>>> -fno-fat-lto-objects -fno-strict-aliasing -fasynchronous-unwind-tables >>>>> -fmessage-length=0 >>>>> GNU C++14 9.1.0 -P -m64 -march=tremont -mtune=tremont -mfpmath=sse >>>>> -msse4.2 -ggdb3 -g3 -O3 -std=c++14 -fpermissive -fPIC >>>>> -ftls-model=initial-exec -flto -fno-fat-lto-objects -fno-strict-aliasing >>>>> -fasynchronous-unwind-tables -fmessage-length=0 >>>>> GNU C++14 9.1.0 -m64 -march=tremont -mtune=tremont -mfpmath=sse >>>>> -msse4.2 -ggdb3 -O3 -std=c++14 -fPIC -flto -fno-fat-lto-objects >>>>> -ftls-model=initial-exec -fvisibility=hidden >>>>> GNU C17 9.1.0 -m64 -march=tremont -mtune=tremont -mfpmath=sse -msse4.2 >>>>> -ggdb3 -O3 -fPIC -flto -fno-fat-lto-objects -ftls-model=initial-exec >>>>> -fvisibility=hidden >>>>> GNU C11 6.4.1 20180518 -mtune=generic -march=x86-64 -g -O2 -std=gnu11 >>>>> -fgnu89-inline -feliminate-unused-debug-types -fmerge-all-constants >>>>> -fno-stack-protector -frounding-math -fno-math-errno -fPIC >>>>> -ftls-model=initial-exec >>>>> >>>>> On Wed, Oct 14, 2020 at 2:53 PM Jiany Wu <wujianyue000@xxxxxxxxx> >>>>> wrote: >>>>> >>>>>> Hi Dan >>>>>> >>>>>> Sorry, I put the command wrongly. >>>>>> I abbreviated ths steps, actually I'm using libfoo.optdebug, which is >>>>>> copied from original file, without flto option, same file, same build, >>>>>> addr2line has file and line. >>>>>> >>>>>> objcopy --only-keep-debug libfoo.so libfoo.optdebug >>>>>> >>>>>> x86_64-pc-linux-gnu-addr2line -e libfoo.optdebug 0x6a1e20 -f >>>>>> foo >>>>>> ??:? >>>>>> >>>>>> ./Jianyue >>>>>> >>>>>> >>>>>> On Wed, Oct 14, 2020 at 2:16 PM Dan Kegel <dank@xxxxxxxxx> wrote: >>>>>> >>>>>>> Did you want to run addr2line on libfoo.so instead of the default >>>>>>> a.out? If so, you may need to add -e libfoo.so or the like. >>>>>>> >>>>>>> Jiany Wu via Gcc-help <gcc-help@xxxxxxxxxxx> schrieb am Di., 13. >>>>>>> Okt. 2020, 22:53: >>>>>>> >>>>>>>> BTW, I used gcc-ar, and only -flto is used for lto optimization, >>>>>>>> without >>>>>>>> -fuse-linker-plugin, I had tried to add it, but seems the same. >>>>>>>> >>>>>>>> On Wed, Oct 14, 2020 at 1:47 PM Jiany Wu <wujianyue000@xxxxxxxxx> >>>>>>>> wrote: >>>>>>>> >>>>>>>> > Hi, >>>>>>>> > >>>>>>>> > Could you help give a hand about this issue? Or any suggestions? >>>>>>>> > >>>>>>>> > Can find function but can't find file and line. >>>>>>>> > Thanks indeed in advance. >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> > $ readelf -a libfoo.so | grep foo >>>>>>>> > >>>>>>>> > 9374: 0000000000783080 179 FUNC GLOBAL DEFAULT 12 foo >>>>>>>> > >>>>>>>> > 30182: 0000000000783080 179 FUNC GLOBAL DEFAULT 12 foo >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> > $ addr2line 0x783080 -f >>>>>>>> > >>>>>>>> > foo >>>>>>>> > >>>>>>>> > ??:? >>>>>>>> > >>>>>>>> > >>>>>>>> > Gcc version: >>>>>>>> > >>>>>>>> > Target: x86_64-poky-linux >>>>>>>> > >>>>>>>> > Configured with: >>>>>>>> > ../../../../../../work-shared/gcc-9.1.0-r0/gcc-9.1.0/configure >>>>>>>> > --build=x86_64-linux --host=x86_64-pokysdk-linux >>>>>>>> --target=x86_64-poky-linux >>>>>>>> > --prefix=/opt/poky/2.1.1/sysroots/x86_64-pokysdk-linux/usr >>>>>>>> > --exec_prefix=/opt/poky/2.1.1/sysroots/x86_64-pokysdk-linux/usr >>>>>>>> > >>>>>>>> --bindir=/opt/poky/2.1.1/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux >>>>>>>> > >>>>>>>> --sbindir=/opt/poky/2.1.1/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux >>>>>>>> > >>>>>>>> --libexecdir=/opt/poky/2.1.1/sysroots/x86_64-pokysdk-linux/usr/libexec/x86_64-poky-linux >>>>>>>> > --datadir=/opt/poky/2.1.1/sysroots/x86_64-pokysdk-linux/usr/share >>>>>>>> > --sysconfdir=/opt/poky/2.1.1/sysroots/x86_64-pokysdk-linux/etc >>>>>>>> > --sharedstatedir=/opt/poky/2.1.1/sysroots/x86_64-pokysdk-linux/com >>>>>>>> > --localstatedir=/opt/poky/2.1.1/sysroots/x86_64-pokysdk-linux/var >>>>>>>> > >>>>>>>> --libdir=/opt/poky/2.1.1/sysroots/x86_64-pokysdk-linux/usr/lib/x86_64-poky-linux >>>>>>>> > >>>>>>>> --includedir=/opt/poky/2.1.1/sysroots/x86_64-pokysdk-linux/usr/include >>>>>>>> > >>>>>>>> --oldincludedir=/opt/poky/2.1.1/sysroots/x86_64-pokysdk-linux/usr/include >>>>>>>> > >>>>>>>> --infodir=/opt/poky/2.1.1/sysroots/x86_64-pokysdk-linux/usr/share/info >>>>>>>> > >>>>>>>> --mandir=/opt/poky/2.1.1/sysroots/x86_64-pokysdk-linux/usr/share/man >>>>>>>> > --disable-silent-rules >>>>>>>> > --disable-dependency-tracking--enable-clocale=generic >>>>>>>> --with-gnu-ld >>>>>>>> > --enable-shared --enable-languages=c,c++ --enable-threads=posix >>>>>>>> > --enable-multilib --enable-c99 --enable-long-long >>>>>>>> --enable-symvers=gnu >>>>>>>> > --program-prefix=x86_64-poky-linux- --without-local-prefix >>>>>>>> --enable-lto >>>>>>>> > --disable-libssp --enable-libitm --disable-bootstrap >>>>>>>> --disable-libmudflap >>>>>>>> > --with-system-zlib --with-linker-hash-style=gnu >>>>>>>> --enable-linker-build-id >>>>>>>> > --with-ppl=no --with-cloog=no --enable-checking=release >>>>>>>> > --enable-cheaders=c_global --without-isl >>>>>>>> > --with-gxx-include-dir=/not/exist/usr/include/c++/9.1.0 >>>>>>>> > --with-sysroot=/not/exist --enable-poison-system-directories >>>>>>>> > --disable-static --with-glibc-version=2.28 --enable-__cxa_atexit >>>>>>>> > --disable-plugin --enable-fix-cortex-a53-835769 >>>>>>>> --enable-__cxa_atexit >>>>>>>> > --enable-libmudflap --enable-libgomp --disable-libstdcxx-pch >>>>>>>> > >>>>>>>> > Thread model: posix >>>>>>>> > >>>>>>>> > gcc version 9.1.0 (GCC) >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> > Addr2line version: >>>>>>>> > >>>>>>>> > GNU addr2line (GNU Binutils) 2.31.0.20180718 >>>>>>>> > >>>>>>>> > Copyright (C) 2018 Free Software Foundation, Inc. >>>>>>>> > >>>>>>>> > This program is free software; you may redistribute it under the >>>>>>>> terms of >>>>>>>> > >>>>>>>> > the GNU General Public License version 3 or (at your option) any >>>>>>>> later >>>>>>>> > version. >>>>>>>> > >>>>>>>> > This program has absolutely no warranty. >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> > ./Jianyue >>>>>>>> > >>>>>>>> >>>>>>>>