Skip to contentSkip to conversation

x86_64: Do not use -ffunction-sections for modules

PATCH Andi Kleen 2 participants 3 messages Jun 21, 2006 1 message not in the archive

lore
Share & tools
lore

Andi Kleen

author Applied
#1 lore raw
In reply to a message not in the archive

The correct mailing list is still [email protected]

Quoted 3 lines · Sergey Vlasov

Currently CONFIG_REORDER uses -ffunction-sections for all code; however, creating a separate section for each function is not useful for modules and just adds bloat.

You mean the ELF files are larger? .text/.data size shouldn't change in theory.

Quoted 5 lines

Moving this option from CFLAGS to
CFLAGS_KERNEL shrinks module object files (e.g., the module tree for a kernel built with most drivers as modules shrinked from 54M to 46M), and decreases the number of sysfs files in /sys/module/*/sections/ directories.

Thanks applied.

-Andi

#2 lore raw
Quoted 1 line · Andi Kleen

The correct mailing list is still [email protected]

Noted.

Quoted 6 lines · Sergey Vlasov
Quoted 3 lines

Currently CONFIG_REORDER uses -ffunction-sections for all code; however, creating a separate section for each function is not useful for modules and just adds bloat.

You mean the ELF files are larger?

Yes, and all these sections are then reported in sysfs (BTW, what programs really use /sys/module/*/sections/* files?).

Quoted 1 line

.text/.data size shouldn't > change in theory.

Actually, it does change by a small amount for some reason - even increases by about 100 bytes in some cases; however, I suppose that the size reported by /proc/modules and lsmod is more important, and it decreases:

before:

ext3                  138896  4 
jbd                    58152  1 ext3
mbcache                10248  1 ext3
sata_nv                11140  13 
libata                 75928  1 sata_nv
sd_mod                 21912  6 
scsi_mod              155824  3 usb_storage,libata,sd_mod
ide_disk               17536  0 
ide_generic             1664  0 [permanent]
amd74xx                15280  0 [permanent]
generic                 5892  0 [permanent]
ide_core              150624  6 ide_cd,usb_storage,ide_disk,ide_generic,amd74xx,generic

after:

ext3                  129040  4 
jbd                    53672  1 ext3
mbcache                 9608  1 ext3
sata_nv                10756  13 
libata                 69784  1 sata_nv
sd_mod                 20760  6 
scsi_mod              145200  3 usb_storage,libata,sd_mod
ide_disk               16384  0 
ide_generic             1664  0 [permanent]
amd74xx                14896  0 [permanent]
generic                 5764  0 [permanent]
ide_core              140768  6 ide_cd,usb_storage,ide_disk,ide_generic,amd74xx,generic
author
#3 lore raw
Quoted 9 lines · Sergey Vlasov
Quoted 6 lines · Sergey Vlasov
Quoted 3 lines

Currently CONFIG_REORDER uses -ffunction-sections for all code; however, creating a separate section for each function is not useful for modules and just adds bloat.

You mean the ELF files are larger?

Yes, and all these sections are then reported in sysfs (BTW, what programs really use /sys/module/*/sections/* files?).

Good question. I also always considered it bloat.

Quoted 5 lines
Quoted 2 lines

.text/.data size shouldn't > change in theory.

Actually, it does change by a small amount for some reason - even increases by about 100 bytes in some cases;

Ok maybe a few small vs large jumps

Quoted 3 lines

however, I suppose that the
size reported by /proc/modules and lsmod is more important, and it decreases:

Ok thanks.

-Andi