ix86: fix vDSO build
PATCH 1/1 ix86: fix vDSO build
Relying on static functions used just once to get inlined (and subsequently have dead code paths eliminated) is wrong: Compilers are free to decide whether they do this, regardless of optimization level. With this not happening for vdso_addr() (observed with gcc 4.1.x), an unresolved reference to align_vdso_addr() causes the build to fail.
--- arch/x86/vdso/vma.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86/vdso/vma.c +4 -0
@@ -62,6 +62,9 @@ struct linux_binprm;Only used for the 64-bit and x32 vdsos. */ static unsigned long vdso_addr (unsigned long start,unsigned len) { +#ifdef CONFIG_X86_32 +return 0 ; +#else unsigned long addr, end;unsigned offset; end = (start +PMD_SIZE -1 ) &PMD_MASK ;
@@ -83,6 +86,7 @@ static unsigned long vdso_addr(unsigned addr =align_vdso_addr (addr);return addr; +#endif }static int map_vdso (const struct vdso_image *image,bool calculate_addr)
Quoted 8 lines · Jan Beulich
Relying on static functions used just once to get inlined (and subsequently have dead code paths eliminated) is wrong: Compilers are free to decide whether they do this, regardless of optimization level. With this not happening for
vdso_addr()(observed with gcc 4.1.x), an unresolved reference toalign_vdso_addr()causes the build to fail.Signed-off-by Jan Beulich <[email protected]>Cc Andy Lutomirski <[email protected]>
Any chance you could send a dump of the symbol and relocation tables of a .so.dbg with this problem? I'm curious why checkundef.sh never caught it.
--Andy
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 03.07.14 at 17:34, <[email protected]> wrote:
Quoted 6 lines · Jan Beulich
Relying on static functions used just once to get inlined (and subsequently have dead code paths eliminated) is wrong: Compilers are free to decide whether they do this, regardless of optimization level. With this not happening for
vdso_addr()(observed with gcc 4.1.x), an unresolved reference toalign_vdso_addr()causes the build to fail.
Quoted 4 lines
Quoted 2 lines
Signed-off-by Jan Beulich <[email protected]>Cc Andy Lutomirski <[email protected]>Acked-by Andy Lutomirski <[email protected]>
Thanks (also for the other one).
Quoted 3 lines
Any chance you could send a dump of the symbol and relocation tables of a .so.dbg with this problem? I'm curious why
checkundef.shnever caught it.
vma.o is part of the kernel, not the .so.
Jan
Quoted 13 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 03.07.14 at 17:34, <[email protected]> wrote:
Quoted 6 lines · Jan Beulich
Relying on static functions used just once to get inlined (and subsequently have dead code paths eliminated) is wrong: Compilers are free to decide whether they do this, regardless of optimization level. With this not happening for
vdso_addr()(observed with gcc 4.1.x), an unresolved reference toalign_vdso_addr()causes the build to fail.Quoted 4 lines
Quoted 2 lines
Signed-off-by Jan Beulich <[email protected]>Cc Andy Lutomirski <[email protected]>Acked-by Andy Lutomirski <[email protected]>
Quoted 7 lines
Thanks (also for the other one).
Quoted 3 lines
Any chance you could send a dump of the symbol and relocation tables of a .so.dbg with this problem? I'm curious why
checkundef.shnever caught it.vma.o is part of the kernel, not the .so.
Duh :)
--Andy
Quoted 5 lines · Jan Beulich
Relying on static functions used just once to get inlined (and subsequently have dead code paths eliminated) is wrong: Compilers are free to decide whether they do this, regardless of optimization level. With this not happening for
vdso_addr()(observed with gcc 4.1.x), an unresolved reference toalign_vdso_addr()causes the build to fail.
Quoted 35 lines
Signed-off-by Jan Beulich <[email protected]>Cc Andy Lutomirski <[email protected]>--- arch/x86/vdso/vma.c | 4 ++++ 1 file changed, 4 insertions(+)arch/x86/vdso/vma.c +4
-1@@ -62,6 +62,9 @@ struct linux_binprm;Only used for the 64-bit and x32 vdsos. */ static unsigned long vdso_addr (unsigned long start,unsigned len) { +#ifdef CONFIG_X86_32 +return 0 ; +#else unsigned long addr, end;unsigned offset; end = (start +PMD_SIZE -1 ) &PMD_MASK ;@@ -83,6 +86,7 @@ static unsigned long vdso_addr(unsigned addr =align_vdso_addr (addr);return addr; +#endif }static int map_vdso (const struct vdso_image *image,bool calculate_addr) --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 25 lines · On Thu, 03 Jul 2014 15:35:07 +0100 "Jan Beulich" <[email protected]> wrote:
Relying on static functions used just once to get inlined (and subsequently have dead code paths eliminated) is wrong: Compilers are free to decide whether they do this, regardless of optimization level. With this not happening for
vdso_addr()(observed with gcc 4.1.x), an unresolved reference toalign_vdso_addr()causes the build to fail.Signed-off-by Jan Beulich <[email protected]>Cc Andy Lutomirski <[email protected]>--- arch/x86/vdso/vma.c | 4 ++++ 1 file changed, 4 insertions(+)arch/x86/vdso/vma.c +3
-0@@ -62,6 +62,9 @@ struct linux_binprm;Only used for the 64-bit and x32 vdsos. */ static unsigned long vdso_addr (unsigned long start,unsigned len) { +#ifdef CONFIG_X86_32 +return 0 ; +#else unsigned long addr, end;unsigned offset; end = (start +PMD_SIZE -1 ) &PMD_MASK ;
arch/x86/vdso/vma.c static unsigned long vdso_addr(unsigned · line 92
Quoted 7 lines
arch/x86/vdso/vma.c +1
-0@@ -83,6 +86,7 @@ static unsigned long vdso_addr(unsigned addr =align_vdso_addr (addr);return addr; +#endif }static int map_vdso (const struct vdso_image *image,bool calculate_addr)
H. Peter Anvin
reviewerQuoted 5 lines · Jan Beulich
Relying on static functions used just once to get inlined (and subsequently have dead code paths eliminated) is wrong: Compilers are free to decide whether they do this, regardless of optimization level. With this not happening for
vdso_addr()(observed with gcc 4.1.x), an unresolved reference toalign_vdso_addr()causes the build to fail.
The fix seems odd... more of the flavor of "happens to work" unless I'm misunderstanding something. If this needs to be inlined, wouldn't __always_inline make more sense?
What am I missing?
-hpa
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 11.07.14 at 00:58, <[email protected]> wrote:
Quoted 5 lines · Jan Beulich
Relying on static functions used just once to get inlined (and subsequently have dead code paths eliminated) is wrong: Compilers are free to decide whether they do this, regardless of optimization level. With this not happening for
vdso_addr()(observed with gcc 4.1.x), an unresolved reference toalign_vdso_addr()causes the build to fail.
Quoted 5 lines
The fix seems odd... more of the flavor of "happens to work" unless I'm misunderstanding something. If this needs to be inlined, wouldn't
__always_inlinemake more sense?What am I missing?
I think this is a matter of taste: Personally I think __always_inline should be used rather rarely, as it takes away decisions from the compiler that it would (generally) be in the better position to make.
Sorry for the late reply (was on vacation),
Jan
tip-bot for Jan Beulich
merge bot[tip:x86/urgent] x86-32, vdso: Fix vDSO build error due to missing align_vdso_addr()
In reply to Jan Beulichx86-32, vdso: Fix vDSO build error due to missing align_vdso_addr()
Commit-ID: d093601be5e97d2729614419d0d256ed3b6a56b0 Gitweb: http://git.kernel.org/tip/d093601be5e97d2729614419d0d256ed3b6a56b0 Author: Jan Beulich <[email protected]> AuthorDate: Thu, 3 Jul 2014 15:35:07 +0100 Committer: H. Peter Anvin <[email protected]> CommitDate: Thu, 10 Jul 2014 16:06:04 -0700
x86-32, vdso: Fix vDSO build error due to missing align_vdso_addr()
Relying on static functions used just once to get inlined (and subsequently have dead code paths eliminated) is wrong: Compilers are free to decide whether they do this, regardless of optimization level. With this not happening for vdso_addr() (observed with gcc 4.1.x), an unresolved reference to align_vdso_addr() causes the build to fail.
[ hpa: vdso_addr() is never actually used on x86-32, as calculate_addr
in map_vdso() is always false. It ought to be possible to clean this up further, but this fixes the immediate problem. ]
--- arch/x86/vdso/vma.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86/vdso/vma.c +4 -0
@@ -62,6 +62,9 @@ struct linux_binprm;Only used for the 64-bit and x32 vdsos. */ static unsigned long vdso_addr (unsigned long start,unsigned len) { +#ifdef CONFIG_X86_32 +return 0 ; +#else unsigned long addr, end;unsigned offset; end = (start +PMD_SIZE -1 ) &PMD_MASK ;
@@ -83,6 +86,7 @@ static unsigned long vdso_addr(unsigned long start, unsigned len) addr =align_vdso_addr (addr);return addr; +#endif }static int map_vdso (const struct vdso_image *image,bool calculate_addr)