lkml.org 
[lkml]   [2019]   [Sep]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] selftests: kvm: Fix libkvm build error
From
Date
On 24/09/19 22:14, Shuah Khan wrote:
> Fix the following build error:
>
> libkvm.a(assert.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
>
> Add -fPIC to CFLAGS to fix it.

This is wrong, these testcases cannot be position-independent
executables. Can you include the failing command line from "V=1"
output?

The problem seems to be that these definitions are not working properly:

no-pie-option := $(call try-run, echo 'int main() { return 0; }' | \
$(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -no-pie -x c - -o "$$TMP", -no-pie)

LDFLAGS += -pthread $(no-pie-option)

Thanks,

Paolo

> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
> ---
> tools/testing/selftests/kvm/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile
> index 62c591f87dab..b4a55d300e75 100644
> --- a/tools/testing/selftests/kvm/Makefile
> +++ b/tools/testing/selftests/kvm/Makefile
> @@ -44,7 +44,7 @@ INSTALL_HDR_PATH = $(top_srcdir)/usr
> LINUX_HDR_PATH = $(INSTALL_HDR_PATH)/include/
> LINUX_TOOL_INCLUDE = $(top_srcdir)/tools/include
> CFLAGS += -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99 \
> - -fno-stack-protector -fno-PIE -I$(LINUX_TOOL_INCLUDE) \
> + -fno-stack-protector -fPIC -fno-PIE -I$(LINUX_TOOL_INCLUDE) \
> -I$(LINUX_HDR_PATH) -Iinclude -I$(<D) -Iinclude/$(UNAME_M) -I..
>
> no-pie-option := $(call try-run, echo 'int main() { return 0; }' | \
>

\
 
 \ /
  Last update: 2019-09-25 09:49    [W:0.058 / U:1.516 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site