Re: [perfmon2] [PATCH] Limit functions visibility in the libpfm library to ones listed in header fi
Status: Beta
Brought to you by:
seranian
|
From: William C. <wc...@re...> - 2016-03-14 14:06:22
|
On 03/12/2016 05:50 PM, Andreas Beckmann wrote: > On 2016-03-12 17:10, Stephane Eranian wrote: >> Hi Will, >> >> I tried your patch on my Ubuntu system. >> It is using gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.1). >> >> It compiles fine but I see no difference in size using size -t lib/libpfm.a. > >> So do you need a specific compiler version or the patch is missing >> something? > > That patch primarily affects the (exported) content of the shared > library, not the static library. > > I gave it a short test on Debian and papi (the only user of the libpfm4 > package) continued to work after I installed the new libpfm4 package > which exports fewer symbols. (In Debian, papi is built against the > separately packaged libpfm4, not the bundled copy. It uses the shared > library.) > > Andreas Hi Stephane and Andreas, Yes, the change is only going to affect the libpfm.so file. The libpfm.a is going to be the same. the abidiff from libabigail (https://www.sourceware.org/libabigail/) shows that a lot of the internal symbols are no longer exported. Attached is the output of: abidiff libpfm-4.7.0.orig/lib/libpfm.so.4.7.0 libpfm-4.7.0.hidden/lib/libpfm.so.4.7.0 > abidiff.log eu-size shows the reduction in size: $ eu-size libpfm-4.7.0.orig/lib/libpfm.so.4.7.0 libpfm-4.7.0.hidden/lib/libpfm.so.4.7.0 text data bss dec hex filename 1120871 673600 6208 1800679 1b79e7 libpfm-4.7.0.orig/lib/libpfm.so.4.7.0 1106646 673368 6208 1786222 1b416e libpfm-4.7.0.hidden/lib/libpfm.so.4.7.0 "eu-readelf -l" also shows the reductions: $ eu-readelf -l libpfm-4.7.0.orig/lib/libpfm.so.4.7.0 libpfm-4.7.0.hidden/lib/libpfm.so.4.7.0 libpfm-4.7.0.orig/lib/libpfm.so.4.7.0: Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x111c4c 0x111c4c R E 0x200000 LOAD 0x112570 0x0000000000312570 0x0000000000312570 0x0a4768 0x0a5fb0 RW 0x200000 DYNAMIC 0x1a5da0 0x00000000003a5da0 0x00000000003a5da0 0x0001d0 0x0001d0 RW 0x8 NOTE 0x0001c8 0x00000000000001c8 0x00000000000001c8 0x000024 0x000024 R 0x4 GNU_EH_FRAME 0x10f614 0x000000000010f614 0x000000000010f614 0x00078c 0x00078c R 0x4 GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0x10 GNU_RELRO 0x112570 0x0000000000312570 0x0000000000312570 0x093a90 0x093a90 R 0x1 Section to Segment mapping: Segment Sections... 00 [RO: .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame] 01 [RELRO: .init_array .fini_array .jcr .data.rel.ro .dynamic .got] .got.plt .data .bss 02 [RELRO: .dynamic] 03 [RO: .note.gnu.build-id] 04 [RO: .eh_frame_hdr] 05 06 [RELRO: .init_array .fini_array .jcr .data.rel.ro .dynamic .got] libpfm-4.7.0.hidden/lib/libpfm.so.4.7.0: Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x10e4cc 0x10e4cc R E 0x200000 LOAD 0x10e5c8 0x000000000030e5c8 0x000000000030e5c8 0x0a4670 0x0a5eb8 RW 0x200000 DYNAMIC 0x1a1de0 0x00000000003a1de0 0x00000000003a1de0 0x0001d0 0x0001d0 RW 0x8 NOTE 0x0001c8 0x00000000000001c8 0x00000000000001c8 0x000024 0x000024 R 0x4 GNU_EH_FRAME 0x10be94 0x000000000010be94 0x000000000010be94 0x00078c 0x00078c R 0x4 GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0x10 GNU_RELRO 0x10e5c8 0x000000000030e5c8 0x000000000030e5c8 0x093a38 0x093a38 R 0x1 Section to Segment mapping: Segment Sections... 00 [RO: .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame] 01 [RELRO: .init_array .fini_array .jcr .data.rel.ro .dynamic .got] .got.plt .data .bss 02 [RELRO: .dynamic] 03 [RO: .note.gnu.build-id] 04 [RO: .eh_frame_hdr] 05 06 [RELRO: .init_array .fini_array .jcr .data.rel.ro .dynamic .got] -Will |