Re: modules still have .debug_* (was Re: [PATCH 0/3] ARC unwinder switch to .eh_frame)

From: Alexey Brodkin
Date: Fri Sep 23 2016 - 06:38:47 EST


Hi Daniel,

On Thu, 2016-09-22 at 15:37 -0700, Daniel Mentz wrote:
> On Thu, Sep 22, 2016 at 1:59 PM, Vineet Gupta
> <Vineet.Gupta1@xxxxxxxxxxxx> wrote:
> >
> > Hi Daniel,
> >
> > On 09/19/2016 06:21 PM, Daniel Mentz wrote:
> > >
> > > I confirmed that the .eh_frame section is present and that the
> > > .debug_frame section is absent. I also verified that the file size of
> > > the .ko files are small enough for our embedded platform and that
> > > unnecessary sections like .debug_info, .debug_line, .debug_str etc.
> > > are also absent.
> >
> > BTW it seems with my latest set of patches, modules still have .debug_*.
> > Can you double check if your tree still has the interim patch which added a linker
> > script for modules to strip out .debug_*
> >
> > http://lists.infradead.org/pipermail/linux-snps-arc/2016-September/001483.html
>
> Hi Vineet,
>
> Sorry, that was a misunderstanding. Buildroot routinely runs the strip
> command on .ko files before installing them on the target. I was only
> looking at the .ko files *after* running the strip command. No, the
> interim patch was not in my tree.

Well are you sure buildroot really touches modules in Linux kernel build folder?
Buildroot just runs a simple "make" command in "output/build/linux-x.y".

And only on installation step Buildroot strips binaries in "output/target" folder.
Moreover starting from that commit
https://git.buildroot.net/buildroot/commit/?id=10c4d27aef4dca01572cfc8146cbfd194a1a85e4
even on Linux installation step Buildroot reuses kernel's module stripping infrastructure
but again that happens only on target.

Just in case that's what I see when building MSDOSFS as module.

In build folder:
----------------------------->8-------------------------------
arc-linux-readelf -S build/linux-4.7.3/fs/fat/msdos.ko
There are 38 section headers, starting at offset 0x2a630:

Section Headers:
 [Nr] NameÂÂÂÂÂÂÂÂÂÂÂÂÂÂTypeÂÂÂÂÂÂÂÂÂÂÂÂAddrÂÂÂÂÂOffÂÂÂÂSizeÂÂÂES Flg Lk Inf Al
 [ 0]ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂNULLÂÂÂÂÂÂÂÂÂÂÂÂ00000000 000000 000000 00ÂÂÂÂÂÂ0ÂÂÂ0ÂÂ0
 [ 1] .note.gnu.build-i NOTEÂÂÂÂÂÂÂÂÂÂÂÂ00000000 000034 000024 00ÂÂÂAÂÂ0ÂÂÂ0ÂÂ4
 [ 2] .textÂÂÂÂÂÂÂÂÂÂÂÂÂPROGBITSÂÂÂÂÂÂÂÂ00000000 000058 0013a8 00ÂÂAXÂÂ0ÂÂÂ0ÂÂ4
 [ 3] .rela.textÂÂÂÂÂÂÂÂRELAÂÂÂÂÂÂÂÂÂÂÂÂ00000000 01c774 000600 0cÂÂÂI 35ÂÂÂ2ÂÂ4
 [ 4] .init.textÂÂÂÂÂÂÂÂPROGBITSÂÂÂÂÂÂÂÂ00000000 001400 000010 00ÂÂAXÂÂ0ÂÂÂ0ÂÂ4
 [ 5] .rela.init.textÂÂÂRELAÂÂÂÂÂÂÂÂÂÂÂÂ00000000 01cd74 000018 0cÂÂÂI 35ÂÂÂ4ÂÂ4
 [ 6] .exit.textÂÂÂÂÂÂÂÂPROGBITSÂÂÂÂÂÂÂÂ00000000 001410 000010 00ÂÂAXÂÂ0ÂÂÂ0ÂÂ4
 [ 7] .rela.exit.textÂÂÂRELAÂÂÂÂÂÂÂÂÂÂÂÂ00000000 01cd8c 000018 0cÂÂÂI 35ÂÂÂ6ÂÂ4
 [ 8] .rodataÂÂÂÂÂÂÂÂÂÂÂPROGBITSÂÂÂÂÂÂÂÂ00000000 001440 000100 00ÂÂÂAÂÂ0ÂÂÂ0 64
 [ 9] .rela.rodataÂÂÂÂÂÂRELAÂÂÂÂÂÂÂÂÂÂÂÂ00000000 01cda4 000078 0cÂÂÂI 35ÂÂÂ8ÂÂ4
 [10] .modinfoÂÂÂÂÂÂÂÂÂÂPROGBITSÂÂÂÂÂÂÂÂ00000000 001540 000090 00ÂÂÂAÂÂ0ÂÂÂ0ÂÂ4
 [11] .rodata.str1.4ÂÂÂÂPROGBITSÂÂÂÂÂÂÂÂ00000000 0015d0 000030 01 AMSÂÂ0ÂÂÂ0ÂÂ4
 [12] .dataÂÂÂÂÂÂÂÂÂÂÂÂÂPROGBITSÂÂÂÂÂÂÂÂ00000000 001600 00002c 00ÂÂWAÂÂ0ÂÂÂ0ÂÂ4
 [13] .rela.dataÂÂÂÂÂÂÂÂRELAÂÂÂÂÂÂÂÂÂÂÂÂ00000000 01ce1c 000030 0cÂÂÂI 35ÂÂ12ÂÂ4
 [14] .gnu.linkonce.thi PROGBITSÂÂÂÂÂÂÂÂ00000000 001640 000140 00ÂÂWAÂÂ0ÂÂÂ0 64
 [15] .rela.gnu.linkonc RELAÂÂÂÂÂÂÂÂÂÂÂÂ00000000 01ce4c 00000c 0cÂÂÂI 35ÂÂ14ÂÂ4
 [16] .tdataÂÂÂÂÂÂÂÂÂÂÂÂPROGBITSÂÂÂÂÂÂÂÂ00000000 001780 000000 00 WATÂÂ0ÂÂÂ0ÂÂ1
 [17] .tbssÂÂÂÂÂÂÂÂÂÂÂÂÂNOBITSÂÂÂÂÂÂÂÂÂÂ00000000 001780 000000 00 WATÂÂ0ÂÂÂ0ÂÂ1
 [18] .bssÂÂÂÂÂÂÂÂÂÂÂÂÂÂNOBITSÂÂÂÂÂÂÂÂÂÂ00000000 001780 000000 00ÂÂWAÂÂ0ÂÂÂ0ÂÂ1
 [19] .commentÂÂÂÂÂÂÂÂÂÂPROGBITSÂÂÂÂÂÂÂÂ00000000 001780 000078 01ÂÂMSÂÂ0ÂÂÂ0ÂÂ1
 [20] .note.GNU-stackÂÂÂPROGBITSÂÂÂÂÂÂÂÂ00000000 0017f8 000000 00ÂÂÂÂÂÂ0ÂÂÂ0ÂÂ1
 [21] .debug_arangesÂÂÂÂPROGBITSÂÂÂÂÂÂÂÂ00000000 0017f8 000048 00ÂÂÂÂÂÂ0ÂÂÂ0ÂÂ1
 [22] .rela.debug_arang RELAÂÂÂÂÂÂÂÂÂÂÂÂ00000000 01ce58 00003c 0cÂÂÂI 35ÂÂ21ÂÂ4
 [23] .debug_infoÂÂÂÂÂÂÂPROGBITSÂÂÂÂÂÂÂÂ00000000 001840 00eaa9 00ÂÂÂÂÂÂ0ÂÂÂ0ÂÂ1
 [24] .rela.debug_infoÂÂRELAÂÂÂÂÂÂÂÂÂÂÂÂ00000000 01ce94 00a53c 0cÂÂÂI 35ÂÂ23ÂÂ4
 [25] .debug_abbrevÂÂÂÂÂPROGBITSÂÂÂÂÂÂÂÂ00000000 0102e9 0008b3 00ÂÂÂÂÂÂ0ÂÂÂ0ÂÂ1
 [26] .debug_lineÂÂÂÂÂÂÂPROGBITSÂÂÂÂÂÂÂÂ00000000 010b9c 001d4d 00ÂÂÂÂÂÂ0ÂÂÂ0ÂÂ1
 [27] .rela.debug_lineÂÂRELAÂÂÂÂÂÂÂÂÂÂÂÂ00000000 0273d0 001818 0cÂÂÂI 35ÂÂ26ÂÂ4
 [28] .debug_frameÂÂÂÂÂÂPROGBITSÂÂÂÂÂÂÂÂ00000000 0128ec 0002d8 00ÂÂÂÂÂÂ0ÂÂÂ0ÂÂ4
 [29] .rela.debug_frame RELAÂÂÂÂÂÂÂÂÂÂÂÂ00000000 028be8 000168 0cÂÂÂI 35ÂÂ28ÂÂ4
 [30] .debug_strÂÂÂÂÂÂÂÂPROGBITSÂÂÂÂÂÂÂÂ00000000 012bc4 008485 01ÂÂMSÂÂ0ÂÂÂ0ÂÂ1
 [31] .debug_locÂÂÂÂÂÂÂÂPROGBITSÂÂÂÂÂÂÂÂ00000000 01b049 000b49 00ÂÂÂÂÂÂ0ÂÂÂ0ÂÂ1
 [32] .rela.debug_locÂÂÂRELAÂÂÂÂÂÂÂÂÂÂÂÂ00000000 028d50 001308 0cÂÂÂI 35ÂÂ31ÂÂ4
 [33] .debug_rangesÂÂÂÂÂPROGBITSÂÂÂÂÂÂÂÂ00000000 01bb92 0001f8 00ÂÂÂÂÂÂ0ÂÂÂ0ÂÂ1
 [34] .rela.debug_range RELAÂÂÂÂÂÂÂÂÂÂÂÂ00000000 02a058 000480 0cÂÂÂI 35ÂÂ33ÂÂ4
 [35] .symtabÂÂÂÂÂÂÂÂÂÂÂSYMTABÂÂÂÂÂÂÂÂÂÂ00000000 01bd8c 0005e0 10ÂÂÂÂÂ36ÂÂ53ÂÂ4
 [36] .strtabÂÂÂÂÂÂÂÂÂÂÂSTRTABÂÂÂÂÂÂÂÂÂÂ00000000 01c36c 000407 00ÂÂÂÂÂÂ0ÂÂÂ0ÂÂ1
 [37] .shstrtabÂÂÂÂÂÂÂÂÂSTRTABÂÂÂÂÂÂÂÂÂÂ00000000 02a4d8 000157 00ÂÂÂÂÂÂ0ÂÂÂ0ÂÂ1
Key to Flags:
 W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
 L (link order), O (extra OS processing required), G (group), T (TLS),
 C (compressed), x (unknown), o (OS specific), E (exclude),
 p (processor specific)
----------------------------->8-------------------------------

On target:
----------------------------->8-------------------------------
arc-linux-readelf -S target/lib/modules/4.7.3/kernel/fs/fat/msdos.koÂ
There are 24 section headers, starting at offset 0x28e0:

Section Headers:
 [Nr] NameÂÂÂÂÂÂÂÂÂÂÂÂÂÂTypeÂÂÂÂÂÂÂÂÂÂÂÂAddrÂÂÂÂÂOffÂÂÂÂSizeÂÂÂES Flg Lk Inf Al
 [ 0]ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂNULLÂÂÂÂÂÂÂÂÂÂÂÂ00000000 000000 000000 00ÂÂÂÂÂÂ0ÂÂÂ0ÂÂ0
 [ 1] .note.gnu.build-i NOTEÂÂÂÂÂÂÂÂÂÂÂÂ00000000 000034 000024 00ÂÂÂAÂÂ0ÂÂÂ0ÂÂ4
 [ 2] .textÂÂÂÂÂÂÂÂÂÂÂÂÂPROGBITSÂÂÂÂÂÂÂÂ00000000 000058 0013a8 00ÂÂAXÂÂ0ÂÂÂ0ÂÂ4
 [ 3] .rela.textÂÂÂÂÂÂÂÂRELAÂÂÂÂÂÂÂÂÂÂÂÂ00000000 002128 000600 0cÂÂÂI 21ÂÂÂ2ÂÂ4
 [ 4] .init.textÂÂÂÂÂÂÂÂPROGBITSÂÂÂÂÂÂÂÂ00000000 001400 000010 00ÂÂAXÂÂ0ÂÂÂ0ÂÂ4
 [ 5] .rela.init.textÂÂÂRELAÂÂÂÂÂÂÂÂÂÂÂÂ00000000 002728 000018 0cÂÂÂI 21ÂÂÂ4ÂÂ4
 [ 6] .exit.textÂÂÂÂÂÂÂÂPROGBITSÂÂÂÂÂÂÂÂ00000000 001410 000010 00ÂÂAXÂÂ0ÂÂÂ0ÂÂ4
 [ 7] .rela.exit.textÂÂÂRELAÂÂÂÂÂÂÂÂÂÂÂÂ00000000 002740 000018 0cÂÂÂI 21ÂÂÂ6ÂÂ4
 [ 8] .rodataÂÂÂÂÂÂÂÂÂÂÂPROGBITSÂÂÂÂÂÂÂÂ00000000 001440 000100 00ÂÂÂAÂÂ0ÂÂÂ0 64
 [ 9] .rela.rodataÂÂÂÂÂÂRELAÂÂÂÂÂÂÂÂÂÂÂÂ00000000 002758 000078 0cÂÂÂI 21ÂÂÂ8ÂÂ4
 [10] .modinfoÂÂÂÂÂÂÂÂÂÂPROGBITSÂÂÂÂÂÂÂÂ00000000 001540 000090 00ÂÂÂAÂÂ0ÂÂÂ0ÂÂ4
 [11] .rodata.str1.4ÂÂÂÂPROGBITSÂÂÂÂÂÂÂÂ00000000 0015d0 000030 01 AMSÂÂ0ÂÂÂ0ÂÂ4
 [12] .dataÂÂÂÂÂÂÂÂÂÂÂÂÂPROGBITSÂÂÂÂÂÂÂÂ00000000 001600 00002c 00ÂÂWAÂÂ0ÂÂÂ0ÂÂ4
 [13] .rela.dataÂÂÂÂÂÂÂÂRELAÂÂÂÂÂÂÂÂÂÂÂÂ00000000 0027d0 000030 0cÂÂÂI 21ÂÂ12ÂÂ4
 [14] .gnu.linkonce.thi PROGBITSÂÂÂÂÂÂÂÂ00000000 001640 000140 00ÂÂWAÂÂ0ÂÂÂ0 64
 [15] .rela.gnu.linkonc RELAÂÂÂÂÂÂÂÂÂÂÂÂ00000000 002800 00000c 0cÂÂÂI 21ÂÂ14ÂÂ4
 [16] .tdataÂÂÂÂÂÂÂÂÂÂÂÂPROGBITSÂÂÂÂÂÂÂÂ00000000 001780 000000 00 WATÂÂ0ÂÂÂ0ÂÂ1
 [17] .tbssÂÂÂÂÂÂÂÂÂÂÂÂÂNOBITSÂÂÂÂÂÂÂÂÂÂ00000000 001780 000000 00 WATÂÂ0ÂÂÂ0ÂÂ1
 [18] .bssÂÂÂÂÂÂÂÂÂÂÂÂÂÂNOBITSÂÂÂÂÂÂÂÂÂÂ00000000 001780 000000 00ÂÂWAÂÂ0ÂÂÂ0ÂÂ1
 [19] .commentÂÂÂÂÂÂÂÂÂÂPROGBITSÂÂÂÂÂÂÂÂ00000000 001780 000078 01ÂÂMSÂÂ0ÂÂÂ0ÂÂ1
 [20] .note.GNU-stackÂÂÂPROGBITSÂÂÂÂÂÂÂÂ00000000 0017f8 000000 00ÂÂÂÂÂÂ0ÂÂÂ0ÂÂ1
 [21] .symtabÂÂÂÂÂÂÂÂÂÂÂSYMTABÂÂÂÂÂÂÂÂÂÂ00000000 0017f8 000540 10ÂÂÂÂÂ22ÂÂ43ÂÂ4
 [22] .strtabÂÂÂÂÂÂÂÂÂÂÂSTRTABÂÂÂÂÂÂÂÂÂÂ00000000 001d38 0003ed 00ÂÂÂÂÂÂ0ÂÂÂ0ÂÂ1
 [23] .shstrtabÂÂÂÂÂÂÂÂÂSTRTABÂÂÂÂÂÂÂÂÂÂ00000000 00280c 0000d3 00ÂÂÂÂÂÂ0ÂÂÂ0ÂÂ1
Key to Flags:
 W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
 L (link order), O (extra OS processing required), G (group), T (TLS),
 C (compressed), x (unknown), o (OS specific), E (exclude),
 p (processor specific)
----------------------------->8-------------------------------

-Alexey