From: Michal Marek <hidden> Date: 2016-08-17 13:00:06
On 2016-08-17 03:44, Stephen Rothwell wrote:
Hi Michal,
After merging the kbuild tree, today's linux-next build (powerpc
ppc64_defconfig) produced these warnings:
WARNING: 25 bad relocations
c000000000cf2570 R_PPC64_ADDR64 __crc___arch_hweight16
[...]
Introduced by commit
9445aa1a3062 ("ppc: move exports to definitions")
I have reverted that commit for today.
[cc-ing the ppc guys for clues - also involved is commit
22823ab419d8 ("EXPORT_SYMBOL() for asm")
]
FWIW, I see these warnings as well. Any help from ppc developers is
appreciated - should the R_PPC64_ADDR64 be whitelisted for exported asm
symbols (their CRCs actually)?
Thanks,
Michal
From: Nicholas Piggin <npiggin@gmail.com> Date: 2016-08-18 01:10:02
On Wed, 17 Aug 2016 14:59:59 +0200
Michal Marek [off-list ref] wrote:
On 2016-08-17 03:44, Stephen Rothwell wrote:
quoted
Hi Michal,
After merging the kbuild tree, today's linux-next build (powerpc
ppc64_defconfig) produced these warnings:
WARNING: 25 bad relocations
c000000000cf2570 R_PPC64_ADDR64 __crc___arch_hweight16
[...]
quoted
Introduced by commit
9445aa1a3062 ("ppc: move exports to definitions")
I have reverted that commit for today.
[cc-ing the ppc guys for clues - also involved is commit
22823ab419d8 ("EXPORT_SYMBOL() for asm")
]
FWIW, I see these warnings as well. Any help from ppc developers is
appreciated - should the R_PPC64_ADDR64 be whitelisted for exported asm
symbols (their CRCs actually)?
The dangling relocation is a side effect of linker unable to resolve the
reference to the undefined weak symbols. So the real question is, why has
genksyms not overridden these symbols with their CRC values?
This may not even be powerpc specific, but I'll poke at it a bit more
when I get a chance.
Thanks,
Nick
From: Stephen Rothwell <hidden> Date: 2016-08-19 03:49:12
Hi Nick,
On Thu, 18 Aug 2016 11:09:48 +1000 Nicholas Piggin [off-list ref] wrote:
On Wed, 17 Aug 2016 14:59:59 +0200
Michal Marek [off-list ref] wrote:
quoted
On 2016-08-17 03:44, Stephen Rothwell wrote:
quoted
After merging the kbuild tree, today's linux-next build (powerpc
ppc64_defconfig) produced these warnings:
WARNING: 25 bad relocations
c000000000cf2570 R_PPC64_ADDR64 __crc___arch_hweight16
[...]
quoted
Introduced by commit
9445aa1a3062 ("ppc: move exports to definitions")
I have reverted that commit for today.
[cc-ing the ppc guys for clues - also involved is commit
22823ab419d8 ("EXPORT_SYMBOL() for asm")
]
FWIW, I see these warnings as well. Any help from ppc developers is
appreciated - should the R_PPC64_ADDR64 be whitelisted for exported asm
symbols (their CRCs actually)?
The dangling relocation is a side effect of linker unable to resolve the
reference to the undefined weak symbols. So the real question is, why has
genksyms not overridden these symbols with their CRC values?
This may not even be powerpc specific, but I'll poke at it a bit more
when I get a chance.
Not sure if this is relevant, but with the commit reverted, the
__crc___... symbols are absolute.
00000000f55b3b3d A __crc___arch_hweight16
--
Cheers,
Stephen Rothwell
From: Stephen Rothwell <hidden> Date: 2016-08-19 05:19:39
Hi Nick,
On Fri, 19 Aug 2016 13:38:54 +1000 Stephen Rothwell [off-list ref] wrote:
On Thu, 18 Aug 2016 11:09:48 +1000 Nicholas Piggin [off-list ref] wrote:
quoted
On Wed, 17 Aug 2016 14:59:59 +0200
Michal Marek [off-list ref] wrote:
quoted
On 2016-08-17 03:44, Stephen Rothwell wrote:
quoted
After merging the kbuild tree, today's linux-next build (powerpc
ppc64_defconfig) produced these warnings:
WARNING: 25 bad relocations
c000000000cf2570 R_PPC64_ADDR64 __crc___arch_hweight16
[...]
quoted
Introduced by commit
9445aa1a3062 ("ppc: move exports to definitions")
I have reverted that commit for today.
[cc-ing the ppc guys for clues - also involved is commit
22823ab419d8 ("EXPORT_SYMBOL() for asm")
]
FWIW, I see these warnings as well. Any help from ppc developers is
appreciated - should the R_PPC64_ADDR64 be whitelisted for exported asm
symbols (their CRCs actually)?
The dangling relocation is a side effect of linker unable to resolve the
reference to the undefined weak symbols. So the real question is, why has
genksyms not overridden these symbols with their CRC values?
This may not even be powerpc specific, but I'll poke at it a bit more
when I get a chance.
Not sure if this is relevant, but with the commit reverted, the
__crc___... symbols are absolute.
00000000f55b3b3d A __crc___arch_hweight16
Ignore that :-)
I just had a look at a x86_64 allmodconfig result and it looks like the
weak symbols are not resolved their either ...
I may be missing something, but genksyms generates the crc's off the
preprocessed C source code and we don't have any for the asm files ...
--
Cheers,
Stephen Rothwell
From: Nicholas Piggin <npiggin@gmail.com> Date: 2016-08-19 05:32:43
On Fri, 19 Aug 2016 15:09:14 +1000
Stephen Rothwell [off-list ref] wrote:
Hi Nick,
On Fri, 19 Aug 2016 13:38:54 +1000 Stephen Rothwell [off-list ref] wrote:
quoted
On Thu, 18 Aug 2016 11:09:48 +1000 Nicholas Piggin [off-list ref] wrote:
quoted
On Wed, 17 Aug 2016 14:59:59 +0200
Michal Marek [off-list ref] wrote:
quoted
On 2016-08-17 03:44, Stephen Rothwell wrote:
quoted
After merging the kbuild tree, today's linux-next build (powerpc
ppc64_defconfig) produced these warnings:
WARNING: 25 bad relocations
c000000000cf2570 R_PPC64_ADDR64 __crc___arch_hweight16
[...]
quoted
Introduced by commit
9445aa1a3062 ("ppc: move exports to definitions")
I have reverted that commit for today.
[cc-ing the ppc guys for clues - also involved is commit
22823ab419d8 ("EXPORT_SYMBOL() for asm")
]
FWIW, I see these warnings as well. Any help from ppc developers is
appreciated - should the R_PPC64_ADDR64 be whitelisted for exported asm
symbols (their CRCs actually)?
The dangling relocation is a side effect of linker unable to resolve the
reference to the undefined weak symbols. So the real question is, why has
genksyms not overridden these symbols with their CRC values?
This may not even be powerpc specific, but I'll poke at it a bit more
when I get a chance.
Not sure if this is relevant, but with the commit reverted, the
__crc___... symbols are absolute.
00000000f55b3b3d A __crc___arch_hweight16
Ignore that :-)
I just had a look at a x86_64 allmodconfig result and it looks like the
weak symbols are not resolved their either ...
I may be missing something, but genksyms generates the crc's off the
preprocessed C source code and we don't have any for the asm files ...
From: Michal Marek <hidden> Date: 2016-08-19 08:37:04
On 2016-08-19 07:09, Stephen Rothwell wrote:
Hi Nick,
On Fri, 19 Aug 2016 13:38:54 +1000 Stephen Rothwell [off-list ref] wrote:
quoted
On Thu, 18 Aug 2016 11:09:48 +1000 Nicholas Piggin [off-list ref] wrote:
quoted
On Wed, 17 Aug 2016 14:59:59 +0200
Michal Marek [off-list ref] wrote:
quoted
On 2016-08-17 03:44, Stephen Rothwell wrote:
quoted
After merging the kbuild tree, today's linux-next build (powerpc
ppc64_defconfig) produced these warnings:
WARNING: 25 bad relocations
c000000000cf2570 R_PPC64_ADDR64 __crc___arch_hweight16
[...]
quoted
Introduced by commit
9445aa1a3062 ("ppc: move exports to definitions")
I have reverted that commit for today.
[cc-ing the ppc guys for clues - also involved is commit
22823ab419d8 ("EXPORT_SYMBOL() for asm")
]
FWIW, I see these warnings as well. Any help from ppc developers is
appreciated - should the R_PPC64_ADDR64 be whitelisted for exported asm
symbols (their CRCs actually)?
The dangling relocation is a side effect of linker unable to resolve the
reference to the undefined weak symbols. So the real question is, why has
genksyms not overridden these symbols with their CRC values?
This may not even be powerpc specific, but I'll poke at it a bit more
when I get a chance.
Not sure if this is relevant, but with the commit reverted, the
__crc___... symbols are absolute.
00000000f55b3b3d A __crc___arch_hweight16
Ignore that :-)
I just had a look at a x86_64 allmodconfig result and it looks like the
weak symbols are not resolved their either ...
I may be missing something, but genksyms generates the crc's off the
preprocessed C source code and we don't have any for the asm files ...
Of course you are right. Which means that we are losing type information
for these exports for CONFIG_MODVERSIONS purposes. I guess it's
acceptable, since the asm functions are pretty basic and their
signatures do not change.
Michal
From: Nicholas Piggin <npiggin@gmail.com> Date: 2016-08-19 10:59:07
On Fri, 19 Aug 2016 10:37:00 +0200
Michal Marek [off-list ref] wrote:
On 2016-08-19 07:09, Stephen Rothwell wrote:
quoted
Hi Nick,
On Fri, 19 Aug 2016 13:38:54 +1000 Stephen Rothwell [off-list ref] wrote:
quoted
On Thu, 18 Aug 2016 11:09:48 +1000 Nicholas Piggin [off-list ref] wrote:
quoted
On Wed, 17 Aug 2016 14:59:59 +0200
Michal Marek [off-list ref] wrote:
quoted
On 2016-08-17 03:44, Stephen Rothwell wrote:
quoted
After merging the kbuild tree, today's linux-next build (powerpc
ppc64_defconfig) produced these warnings:
WARNING: 25 bad relocations
c000000000cf2570 R_PPC64_ADDR64 __crc___arch_hweight16
[...]
quoted
Introduced by commit
9445aa1a3062 ("ppc: move exports to definitions")
I have reverted that commit for today.
[cc-ing the ppc guys for clues - also involved is commit
22823ab419d8 ("EXPORT_SYMBOL() for asm")
]
FWIW, I see these warnings as well. Any help from ppc developers is
appreciated - should the R_PPC64_ADDR64 be whitelisted for exported asm
symbols (their CRCs actually)?
The dangling relocation is a side effect of linker unable to resolve the
reference to the undefined weak symbols. So the real question is, why has
genksyms not overridden these symbols with their CRC values?
This may not even be powerpc specific, but I'll poke at it a bit more
when I get a chance.
Not sure if this is relevant, but with the commit reverted, the
__crc___... symbols are absolute.
00000000f55b3b3d A __crc___arch_hweight16
Ignore that :-)
I just had a look at a x86_64 allmodconfig result and it looks like the
weak symbols are not resolved their either ...
I may be missing something, but genksyms generates the crc's off the
preprocessed C source code and we don't have any for the asm files ...
Of course you are right. Which means that we are losing type information
for these exports for CONFIG_MODVERSIONS purposes. I guess it's
acceptable, since the asm functions are pretty basic and their
signatures do not change.
I don't completely agree. It would be nice to have the functionality
still there.
What happens if you just run cmd_modversions on the as rule? It relies on
!defined(__ASSEMBLY__), but we're feeding the result to genksyms, not as.
It would require the header be included in the .S file and be protected for
asm builds.
Stephen wasn't a fan of suck a hack and I can't say I blame him. Another
possibility I suppose is an EXPORT_SYMBOL_ASM() variant that takes string
containing C function declaration and just inserts it as an assembler
comment somewhere that genksysms can find.
Thanks,
Nick
From: Nicholas Piggin <npiggin@gmail.com> Date: 2016-08-22 10:48:17
On Fri, 19 Aug 2016 20:44:55 +1000
Nicholas Piggin [off-list ref] wrote:
On Fri, 19 Aug 2016 10:37:00 +0200
Michal Marek [off-list ref] wrote:
quoted
On 2016-08-19 07:09, Stephen Rothwell wrote:
[snip]
quoted
quoted
I may be missing something, but genksyms generates the crc's off the
preprocessed C source code and we don't have any for the asm files ...
Of course you are right. Which means that we are losing type information
for these exports for CONFIG_MODVERSIONS purposes. I guess it's
acceptable, since the asm functions are pretty basic and their
signatures do not change.
I don't completely agree. It would be nice to have the functionality
still there.
What happens if you just run cmd_modversions on the as rule? It relies on
!defined(__ASSEMBLY__), but we're feeding the result to genksyms, not as.
It would require the header be included in the .S file and be protected for
asm builds.
This seems like it *could* be made to work, but there's a few problems.
- .h files are not made for C consumption. Matter of manually adding the
ifdef guards, which isn't terrible.
- .S files do not all include their .h where the C declaration is. Also
will cause some churn but doable and maybe not completely unreasonable.
- genksyms parser barfs when it hits the assembly of the .S file. Best
way to fix that seems just send the #include and EXPORT_SYMBOL lines
from the .S to the preprocessor. That's a bit of a rabbit hole too, with
some .S files being included, etc.
I'm not sure what to do here. If nobody cares and we lose CRCs for .S
exports, then okay we can whitelist those relocs easily. If we don't want
to lose the functionality, the above might work but it's a bit intrusive
an is going to require another cycle of prep patches to go through arch
code first.
Or suggestions for alternative approach?
Thanks,
Nick
From: Nicholas Piggin <npiggin@gmail.com> Date: 2016-08-26 03:59:04
On Mon, 22 Aug 2016 20:47:58 +1000
Nicholas Piggin [off-list ref] wrote:
On Fri, 19 Aug 2016 20:44:55 +1000
Nicholas Piggin [off-list ref] wrote:
quoted
On Fri, 19 Aug 2016 10:37:00 +0200
Michal Marek [off-list ref] wrote:
quoted
On 2016-08-19 07:09, Stephen Rothwell wrote:
[snip]
quoted
quoted
quoted
I may be missing something, but genksyms generates the crc's off the
preprocessed C source code and we don't have any for the asm files ...
Of course you are right. Which means that we are losing type information
for these exports for CONFIG_MODVERSIONS purposes. I guess it's
acceptable, since the asm functions are pretty basic and their
signatures do not change.
I don't completely agree. It would be nice to have the functionality
still there.
What happens if you just run cmd_modversions on the as rule? It relies on
!defined(__ASSEMBLY__), but we're feeding the result to genksyms, not as.
It would require the header be included in the .S file and be protected for
asm builds.
This seems like it *could* be made to work, but there's a few problems.
- .h files are not made for C consumption. Matter of manually adding the
ifdef guards, which isn't terrible.
- .S files do not all include their .h where the C declaration is. Also
will cause some churn but doable and maybe not completely unreasonable.
- genksyms parser barfs when it hits the assembly of the .S file. Best
way to fix that seems just send the #include and EXPORT_SYMBOL lines
from the .S to the preprocessor. That's a bit of a rabbit hole too, with
some .S files being included, etc.
I'm not sure what to do here. If nobody cares and we lose CRCs for .S
exports, then okay we can whitelist those relocs easily. If we don't want
to lose the functionality, the above might work but it's a bit intrusive
an is going to require another cycle of prep patches to go through arch
code first.
Or suggestions for alternative approach?
Here is a quick patch that I think should catch missing CRCs in
architecture independent way. If we merge something like this, we
can whitelist the symbols in arch/powerpc so people get steered to
the right place.
Powerpc seems to be the only one really catching this, and it's
only as a side effect of a test run for CONFIG_RELOCATABLE kernels,
which means version failures probably slipped through other archs.
I'll clean it up, do some more testing, and submit it unless
anybody dislikes it or has a better way to do it.
Thanks,
Nick
@@ -663,6 +665,10 @@ static void handle_modversions(struct module *mod, struct elf_info *info,elsesymname++;#endif+if(is_crc&&!mod->is_dot_o){+constchar*e=is_vmlinux(mod->name)?"":".ko";+warn("EXPORT symbol \"%s\" [%s%s] version generation failed, symbol will not be versioned.\n",symname+strlen(CRC_PFX),mod->name,e);+}mod->unres=alloc_symbol(symname,ELF_ST_BIND(sym->st_info)==STB_WEAK,mod->unres);
From: Nicholas Mc Guire <hidden> Date: 2016-08-26 06:28:27
On Fri, Aug 26, 2016 at 01:58:03PM +1000, Nicholas Piggin wrote:
quoted hunk
On Mon, 22 Aug 2016 20:47:58 +1000
Nicholas Piggin [off-list ref] wrote:
quoted
On Fri, 19 Aug 2016 20:44:55 +1000
Nicholas Piggin [off-list ref] wrote:
quoted
On Fri, 19 Aug 2016 10:37:00 +0200
Michal Marek [off-list ref] wrote:
quoted
On 2016-08-19 07:09, Stephen Rothwell wrote:
[snip]
quoted
quoted
quoted
I may be missing something, but genksyms generates the crc's off the
preprocessed C source code and we don't have any for the asm files ...
Of course you are right. Which means that we are losing type information
for these exports for CONFIG_MODVERSIONS purposes. I guess it's
acceptable, since the asm functions are pretty basic and their
signatures do not change.
I don't completely agree. It would be nice to have the functionality
still there.
What happens if you just run cmd_modversions on the as rule? It relies on
!defined(__ASSEMBLY__), but we're feeding the result to genksyms, not as.
It would require the header be included in the .S file and be protected for
asm builds.
This seems like it *could* be made to work, but there's a few problems.
- .h files are not made for C consumption. Matter of manually adding the
ifdef guards, which isn't terrible.
- .S files do not all include their .h where the C declaration is. Also
will cause some churn but doable and maybe not completely unreasonable.
- genksyms parser barfs when it hits the assembly of the .S file. Best
way to fix that seems just send the #include and EXPORT_SYMBOL lines
from the .S to the preprocessor. That's a bit of a rabbit hole too, with
some .S files being included, etc.
I'm not sure what to do here. If nobody cares and we lose CRCs for .S
exports, then okay we can whitelist those relocs easily. If we don't want
to lose the functionality, the above might work but it's a bit intrusive
an is going to require another cycle of prep patches to go through arch
code first.
Or suggestions for alternative approach?
Here is a quick patch that I think should catch missing CRCs in
architecture independent way. If we merge something like this, we
can whitelist the symbols in arch/powerpc so people get steered to
the right place.
Powerpc seems to be the only one really catching this, and it's
only as a side effect of a test run for CONFIG_RELOCATABLE kernels,
which means version failures probably slipped through other archs.
I'll clean it up, do some more testing, and submit it unless
anybody dislikes it or has a better way to do it.
Thanks,
Nick