Re: [PATCH 4/7] module: avoid code duplication in include/linux/export.h

From: Rasmus Villemoes
Date: Thu Oct 31 2019 - 07:03:56 EST


On 31/10/2019 11.13, Jessica Yu wrote:
> +++ Rasmus Villemoes [29/10/19 22:11 +0100]:
>> On 29/10/2019 20.19, Jessica Yu wrote:

>>> Apparently ld does not do the deduplication for SHF_MERGE|SHF_STRINGS
>>> sections for relocatable files (ld -r), which kernel modules are. See:
>>>
>>>    https://sourceware.org/ml/binutils/2009-07/msg00291.html
>>
>> I know <https://patches-gcc.linaro.org/patch/5858/> :)
>
> That is exactly what we need! :)
>
>>> But, the strings do get deduplicated for vmlinux. Not sure if we can
>>> find a workaround for modules or if the benefit is significant enough
>>> if it only for vmlinux.
>>
>> I think it's definitely worth if, even if it "only" benefits vmlinux for
>> now. And I still hope to revisit the --force-section-merge some day, but
>> it's very far down my priority list.
>
> Yeah, I think it's worth having too.
>
> If you don't have any extra cycles at the moment, and it's far down
> your priority list, do you mind if I take a look and maybe try to push
> that patch of yours upstream again?

Knock yourself out :) IIRC, it did actually work for the powerpc I was
targeting, but I don't remember if that was just "readelf/objdump
inspection of the ELF files looks reasonable" or if I actually tried
loading the modules. I've pushed the patch to
https://github.com/Villemoes/binutils-gdb/commit/107b9302858fc5fc1a1690f4a36e1f80808ab421
so you don't have to copy-paste from a browser.

I don't know how successful I'd
> be, but now since it's especially relevant for namespaces, it's
> definitely worth looking at again.

Yeah, but even ignoring namespaces, it would be nice to have format
strings etc. deduplicated. Please keep me cc'ed on any progress you make.

Thanks,
Rasmus