Re: [PATCH 1/2] initramfs: fix clang build failure

From: Andrew Morton
Date: Fri Dec 04 2020 - 19:35:41 EST


On Fri, 4 Dec 2020 17:57:33 +0100 Arnd Bergmann <arnd@xxxxxxxxxx> wrote:

> There is only one function in init/initramfs.c that is in the .text
> section, and it is marked __weak. When building with clang-12 and
> the integrated assembler, this leads to a bug with recordmcount:
>
> ./scripts/recordmcount "init/initramfs.o"
> Cannot find symbol for section 2: .text.
> init/initramfs.o: failed

That looks like recordmcount is being silly?

> I'm not quite sure what exactly goes wrong, but I notice that this
> function is only ever called from an __init function, and normally
> inlined. Marking it __init as well is clearly correct and it
> leads to recordmcount no longer complaining.

That works, too.