Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1563192
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] x86/crypto: make constants readonly, allow linker to merge them |
| Date | 2017-01-20 00:20 +0100 |
| Message-ID | <t1u9Q-7WG-17@gated-at.bofh.it> (permalink) |
| References | <t1sB3-6OE-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, 19 Jan 2017, Denys Vlasenko wrote: > A lot of asm-optimized routines in arch/x86/crypto/ keep its > constants in .data. This is wrong, they should be on .rodata. > > Mnay of these constants are the same in different modules. > For example, 128-bit shuffle mask 0x000102030405060708090A0B0C0D0E0F > exists in at least half a dozen places. > > There is a way to let linker merge them and use just one copy. > The rules are as follows: mergeable objects of different sizes > should not share sections. You can't put them all in one .rodata > section, they will lose "mergeability". > > GCC puts its mergeable constants in ".rodata.cstSIZE" sections, > or ".rodata.cstSIZE.<object_name>" if -fdata-sections is used. > This patch does the same: > > .section .rodata.cst16.SHUF_MASK, "aM", @progbits, 16 > > It is important that all data in such section consists of > 16-byte elements, not larger ones, and there are no implicit > use of one element from another. > > When this is not the case, use non-mergeable section: > > .section .rodata[.VAR_NAME], "a", @progbits > > This reduces .data by ~15 kbytes: > > text data bss dec hex filename > 11097415 2705840 2630712 16433967 fac32f vmlinux-prev.o > 11112095 2690672 2630712 16433479 fac147 vmlinux.o And at the same time it increases text size by ~15k. The overall change in total size is 488 byte reduction. Weird. Thanks, tglx
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] x86/crypto: make constants readonly, allow linker to merge them Denys Vlasenko <dvlasenk@redhat.com> - 2017-01-19 22:40 +0100
Re: [PATCH] x86/crypto: make constants readonly, allow linker to merge them Thomas Gleixner <tglx@linutronix.de> - 2017-01-20 00:20 +0100
Re: [PATCH] x86/crypto: make constants readonly, allow linker to merge them Denys Vlasenko <dvlasenk@redhat.com> - 2017-01-23 16:30 +0100
Re: [PATCH] x86/crypto: make constants readonly, allow linker to merge them Herbert Xu <herbert@gondor.apana.org.au> - 2017-01-23 16:10 +0100
csiph-web