Skip to content

Commit 38fabca

Browse files
committed
Merge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 asm updates from Ingo Molnar: "Two changes: - Remove (some) remnants of the vDSO's fake section table mechanism that were left behind when the vDSO build process reverted to using "objdump -S" to strip the userspace image. - Remove hardcoded POPCNT mnemonics now that the minimum binutils version supports the symbolic form" * 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/vdso: Remove a stale/misleading comment from the linker script x86/vdso: Remove obsolete "fake section table" reservation x86: Use POPCNT mnemonics in arch_hweight.h
2 parents 8465625 + 2943480 commit 38fabca

File tree

3 files changed

+2
-43
lines changed

3 files changed

+2
-43
lines changed

arch/x86/entry/vdso/vdso-layout.lds.S

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,6 @@
77
* This script controls its layout.
88
*/
99

10-
#if defined(BUILD_VDSO64)
11-
# define SHDR_SIZE 64
12-
#elif defined(BUILD_VDSO32) || defined(BUILD_VDSOX32)
13-
# define SHDR_SIZE 40
14-
#else
15-
# error unknown VDSO target
16-
#endif
17-
18-
#define NUM_FAKE_SHDRS 13
19-
2010
SECTIONS
2111
{
2212
/*
@@ -60,20 +50,8 @@ SECTIONS
6050
*(.bss*)
6151
*(.dynbss*)
6252
*(.gnu.linkonce.b.*)
63-
64-
/*
65-
* Ideally this would live in a C file, but that won't
66-
* work cleanly for x32 until we start building the x32
67-
* C code using an x32 toolchain.
68-
*/
69-
VDSO_FAKE_SECTION_TABLE_START = .;
70-
. = . + NUM_FAKE_SHDRS * SHDR_SIZE;
71-
VDSO_FAKE_SECTION_TABLE_END = .;
7253
} :text
7354

74-
.fake_shstrtab : { *(.fake_shstrtab) } :text
75-
76-
7755
.note : { *(.note.*) } :text :note
7856

7957
.eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr
@@ -87,11 +65,6 @@ SECTIONS
8765

8866
.text : { *(.text*) } :text =0x90909090,
8967

90-
/*
91-
* At the end so that eu-elflint stays happy when vdso2c strips
92-
* these. A better implementation would avoid allocating space
93-
* for these.
94-
*/
9568
.altinstructions : { *(.altinstructions) } :text
9669
.altinstr_replacement : { *(.altinstr_replacement) } :text
9770

arch/x86/entry/vdso/vdso2c.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ enum {
7676
sym_hpet_page,
7777
sym_pvclock_page,
7878
sym_hvclock_page,
79-
sym_VDSO_FAKE_SECTION_TABLE_START,
80-
sym_VDSO_FAKE_SECTION_TABLE_END,
8179
};
8280

8381
const int special_pages[] = {
@@ -98,12 +96,6 @@ struct vdso_sym required_syms[] = {
9896
[sym_hpet_page] = {"hpet_page", true},
9997
[sym_pvclock_page] = {"pvclock_page", true},
10098
[sym_hvclock_page] = {"hvclock_page", true},
101-
[sym_VDSO_FAKE_SECTION_TABLE_START] = {
102-
"VDSO_FAKE_SECTION_TABLE_START", false
103-
},
104-
[sym_VDSO_FAKE_SECTION_TABLE_END] = {
105-
"VDSO_FAKE_SECTION_TABLE_END", false
106-
},
10799
{"VDSO32_NOTE_MASK", true},
108100
{"__kernel_vsyscall", true},
109101
{"__kernel_sigreturn", true},

arch/x86/include/asm/arch_hweight.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,9 @@
55
#include <asm/cpufeatures.h>
66

77
#ifdef CONFIG_64BIT
8-
/* popcnt %edi, %eax */
9-
#define POPCNT32 ".byte 0xf3,0x0f,0xb8,0xc7"
10-
/* popcnt %rdi, %rax */
11-
#define POPCNT64 ".byte 0xf3,0x48,0x0f,0xb8,0xc7"
128
#define REG_IN "D"
139
#define REG_OUT "a"
1410
#else
15-
/* popcnt %eax, %eax */
16-
#define POPCNT32 ".byte 0xf3,0x0f,0xb8,0xc0"
1711
#define REG_IN "a"
1812
#define REG_OUT "a"
1913
#endif
@@ -24,7 +18,7 @@ static __always_inline unsigned int __arch_hweight32(unsigned int w)
2418
{
2519
unsigned int res;
2620

27-
asm (ALTERNATIVE("call __sw_hweight32", POPCNT32, X86_FEATURE_POPCNT)
21+
asm (ALTERNATIVE("call __sw_hweight32", "popcntl %1, %0", X86_FEATURE_POPCNT)
2822
: "="REG_OUT (res)
2923
: REG_IN (w));
3024

@@ -52,7 +46,7 @@ static __always_inline unsigned long __arch_hweight64(__u64 w)
5246
{
5347
unsigned long res;
5448

55-
asm (ALTERNATIVE("call __sw_hweight64", POPCNT64, X86_FEATURE_POPCNT)
49+
asm (ALTERNATIVE("call __sw_hweight64", "popcntq %1, %0", X86_FEATURE_POPCNT)
5650
: "="REG_OUT (res)
5751
: REG_IN (w));
5852

0 commit comments

Comments
 (0)