Hi, Molnar i try to compile selftests/x86 with gcc-6, however get below error info: renyl:~/linux/tools/testing/selftests/x86$ make gcc -m32 -o single_step_syscall_32 -O2 -g -std=gnu99 -pthread -Wall single_step_syscall.c -lrt -ldl -lm gcc -m32 -o sysret_ss_attrs_32 -O2 -g -std=gnu99 -pthread -Wall sysret_ss_attrs.c -lrt -ldl -lm gcc -m32 -o syscall_nt_32 -O2 -g -std=gnu99 -pthread -Wall syscall_nt.c -lrt -ldl -lm gcc -m32 -o ptrace_syscall_32 -O2 -g -std=gnu99 -pthread -Wall ptrace_syscall.c raw_syscall_helper_32.S -lrt -ldl -lm gcc -m32 -o test_mremap_vdso_32 -O2 -g -std=gnu99 -pthread -Wall test_mremap_vdso.c -lrt -ldl -lm gcc -m32 -o check_initial_reg_state_32 -O2 -g -std=gnu99 -pthread -Wall -Wl,-ereal_start -static check_initial_reg_state.c -lrt -ldl -lm gcc -m32 -o sigreturn_32 -O2 -g -std=gnu99 -pthread -Wall sigreturn.c -lrt -ldl -lm gcc -m32 -o ldt_gdt_32 -O2 -g -std=gnu99 -pthread -Wall ldt_gdt.c -lrt -ldl -lm gcc -m32 -o iopl_32 -O2 -g -std=gnu99 -pthread -Wall iopl.c -lrt -ldl -lm gcc -m32 -o protection_keys_32 -O2 -g -std=gnu99 -pthread -Wall protection_keys.c -lrt -ldl -lm protection_keys.c: In function ��setup_hugetlbfs��: protection_keys.c:816:6: warning: unused variable ��i�� [-Wunused-variable] int i; ^ protection_keys.c:815:6: warning: unused variable ��validated_nr_pages�� [-Wunused-variable] int validated_nr_pages; ^~~~~~~~~~~~~~~~~~ protection_keys.c: In function ��test_pkey_syscalls_bad_args��: protection_keys.c:1136:6: warning: unused variable ��bad_flag�� [-Wunused-variable] int bad_flag = (PKEY_DISABLE_ACCESS | PKEY_DISABLE_WRITE) + 1; ^~~~~~~~ protection_keys.c: In function ��test_pkey_alloc_exhaust��: protection_keys.c:1153:16: warning: unused variable ��init_val�� [-Wunused-variable] unsigned long init_val; ^~~~~~~~ protection_keys.c:1152:16: warning: unused variable ��flags�� [-Wunused-variable] unsigned long flags; ^~~~~ protection_keys.c: In function ��pkey_disable_set��: protection_keys.c:68:5: warning: ��orig_pkru�� may be used uninitialized in this function [-Wmaybe-uninitialized] if (!(condition)) { \ ^ protection_keys.c:465:6: note: ��orig_pkru�� was declared here u32 orig_pkru; ^~~~~~~~~ gcc -m32 -o test_vdso_32 -O2 -g -std=gnu99 -pthread -Wall test_vdso.c -lrt -ldl -lm gcc -m32 -o entry_from_vm86_32 -O2 -g -std=gnu99 -pthread -Wall entry_from_vm86.c -lrt -ldl -lm gcc -m32 -o syscall_arg_fault_32 -O2 -g -std=gnu99 -pthread -Wall syscall_arg_fault.c -lrt -ldl -lm gcc -m32 -o test_syscall_vdso_32 -O2 -g -std=gnu99 -pthread -Wall test_syscall_vdso.c thunks_32.S -lrt -ldl -lm gcc -m32 -o unwind_vdso_32 -O2 -g -std=gnu99 -pthread -Wall unwind_vdso.c -lrt -ldl -lm gcc -m32 -o test_FCMOV_32 -O2 -g -std=gnu99 -pthread -Wall test_FCMOV.c -lrt -ldl -lm gcc -m32 -o test_FCOMI_32 -O2 -g -std=gnu99 -pthread -Wall test_FCOMI.c -lrt -ldl -lm gcc -m32 -o test_FISTTP_32 -O2 -g -std=gnu99 -pthread -Wall test_FISTTP.c -lrt -ldl -lm gcc -m32 -o vdso_restorer_32 -O2 -g -std=gnu99 -pthread -Wall vdso_restorer.c -lrt -ldl -lm gcc -m64 -o single_step_syscall_64 -O2 -g -std=gnu99 -pthread -Wall single_step_syscall.c -lrt -ldl gcc -m64 -o sysret_ss_attrs_64 -O2 -g -std=gnu99 -pthread -Wall sysret_ss_attrs.c thunks.S -lrt -ldl <====== /usr/bin/ld: /tmp/ccQk38ro.o: relocation R_X86_64_32S against `.text' can not be used when making a shared object; recompile with -fPIC <====== /usr/bin/ld: final link failed: Nonrepresentable section on output collect2: error: ld returned 1 exit status Makefile:47: recipe for target 'sysret_ss_attrs_64' failed make: *** [sysret_ss_attrs_64] Error 1 renyl:~/linux/tools/testing/selftests/x86$ accroding to the error hint, try to use "-fPIC" option to compile it again, still get the same error: renyl:~/linux/tools/testing/selftests/x86$ gcc -m64 -o sysret_ss_attrs_64 -O2 -g -std=gnu99 -pthread -Wall sysret_ss_attrs.c thunks.S -lrt -ldl -fPIC /usr/bin/ld: /tmp/ccfPXvLD.o: relocation R_X86_64_32S against `.text' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Nonrepresentable section on output collect2: error: ld returned 1 exit status renyl:~/linux/tools/testing/selftests/x86$ gcc -m64 -o sysret_ss_attrs_64 -O2 -g -std=gnu99 -pthread -Wall sysret_ss_attrs.c thunks.S -lrt -ldl -shared -fPIC /usr/bin/ld: /tmp/ccciMMeD.o: relocation R_X86_64_32S against `.text' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Nonrepresentable section on output collect2: error: ld returned 1 exit status renyl:~/linux/tools/testing/selftests/x86$ currently, gcc-6 as my default compile: renyl:~/linux/tools/testing/selftests/x86$ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 6.3.0-6' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 6.3.0 20170205 (Debian 6.3.0-6) renyl:~/linux/tools/testing/selftests/x86$ however, it work well with gcc-5: renyl:~/linux/tools/testing/selftests/x86$ gcc-5 -m64 -o sysret_ss_attrs_64 -O2 -g -std=gnu99 -pthread -Wall sysret_ss_attrs.c thunks.S -lrt -ldl renyl:~/linux/tools/testing/selftests/x86$ ll sysret_ss_attrs_64 -rwxrwxr-x 1 renyl renyl 13144 Feb 20 16:36 sysret_ss_attrs_64 renyl:~/linux/tools/testing/selftests/x86$ or use "-static" model to link library, also work fine. renyl:~/linux/tools/testing/selftests/x86$ gcc-6 -m64 -o sysret_ss_attrs_64 -O2 -g -std=gnu99 -pthread -Wall sysret_ss_attrs.c thunks.S -lrt -ldl -static renyl:~/linux/tools/testing/selftests/x86$ ll sysret_ss_attrs_64 -rwxrwxr-x 1 renyl renyl 1218576 Feb 20 16:33 sysret_ss_attrs_64 renyl:~/linux/tools/testing/selftests/x86$ -- Thanks Ren Yilong -- To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html