[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2021051021314677744820@gmail.com>
Date: Mon, 10 May 2021 21:31:50 +0800
From: "lambertdev@...il.com" <lambertdev@...il.com>
To: "Johannes Berg" <johannes@...solutions.net>,
"Peter Oberparleiter" <oberpar@...ux.ibm.com>
Cc: "Andrew Morton" <akpm@...ux-foundation.org>,
linux-arch <linux-arch@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
"Arnd Bergmann" <arnd@...db.de>, "Jessica Yu" <jeyu@...nel.org>,
linux-um <linux-um@...ts.infradead.org>
Subject: Re: Re: [PATCH v2] init/gcov: allow CONFIG_CONSTRUCTORS on UML to fix module gcov
Hi Johannes,
My original Email address is blocked by the server of kernel.org,
so I have to change an Email address. Please see my reply inline.
>Hi,
>
>> Hi Johannes and Peter, sorry to bother but I have one question
>> on this change. The do_ctors() won’t be executed for UML
>> because *the constructors have already been called for ELF*.
>>
>> *__ctors_start* and *__ctors_end* symbols. See link:
>> https://elixir.bootlin.com/linux/v5.12.2/source/include/asm-generic/vmlinux.lds.h#L676
>>
>> In my environment, UML+GCC 10, I can't find __gcov_init executed
>> before kernel starts. So I did some trace and found glibc
>> __libc_csu_init
>> will only execute constructors between *__init_array_start*and
>> *__init_array_end*.
>> Which means if do_ctors() is not executed for UML, no elsewhere will
>> the constructors be executed.
>>
>> Shall we remove the *!defined(CONFIG_UML)* for GCC, or I just missed
>> some steps to make the GCOV work for UML?
>
>No, that doesn't seem like the right solution.
>
>Perhaps then with that toolchain (or configuration thereof) we need to
>provide __init_array_start/end labels?
Yes, that's how I worked around in my local environment
(change linker script to add _init_array_start/end labels).
So the __gcov_init is called before start_kernel.
>
>Or ... maybe that actually just needs to be removed, so that the
>toolchain gets to choose?
>
>Hmm. Pretty sure it worked for me, I think also with gcc 10, but not
>sure exactly where I tested.
I will make sure my environment is clean and try again.
Could you please use gdb to check when __gcov_init is called in your setup?
e.g.
(1) gdb *your uml elf*
(2) b __gcov_init
(3) r
(4) when the execution is breaked, use 'bt' to check the call stack
Thanks
Lambert
>
>johannes
>
>
>
Powered by blists - more mailing lists