[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <395d2db1-b860-0da2-a859-d1d840508a46@de.ibm.com>
Date: Tue, 13 Apr 2021 15:11:21 +0200
From: Christian Borntraeger <borntraeger@...ibm.com>
To: Janosch Frank <frankja@...ux.ibm.com>,
Masahiro Yamada <masahiroy@...nel.org>,
linux-kbuild@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
Michal Marek <michal.lkml@...kovi.net>,
Marc Hartmayer <mhartmay@...ux.ibm.com>,
Heiko Carstens <hca@...ux.ibm.com>
Subject: Re: [PATCH 3/4] kbuild: spilt cc-option and friends to
scripts/Makefile.compiler
On 13.04.21 14:51, Janosch Frank wrote:
> On 2/28/21 7:10 AM, Masahiro Yamada wrote:
>> scripts/Kbuild.include is included everywhere, but macros such as
>> cc-option are needed by build targets only.
>>
>> For example, when 'make clean' traverses the tree, it does not need
>> to evaluate $(call cc-option,).
>>
>> Split cc-option, ld-option, etc. to scripts/Makefile.compiler, which
>> is only included from the top Makefile and scripts/Makefile.build.
>>
>> Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
>
> This commit broke the KVM selftest compilation under s390 in linux-next
> for me. Funny enough the compilation is only broken on Ubuntu, under
> Fedora the test fails with an assertion.
>
> FEDORA:
> [root@...ora kvm]# ./set_memory_region_test
> Allowed number of memory slots: 32767
> ==== Test Assertion Failure ====
> lib/kvm_util.c:142: vm->fd >= 0
> pid=1541645 tid=1541645 - Invalid argument
> 1 0x0000000001002f4b: vm_open at kvm_util.c:142
> 2 (inlined by) vm_create at kvm_util.c:258
> 3 0x00000000010015ef: test_add_max_memory_regions at
> set_memory_region_test.c:351
> 4 (inlined by) main at set_memory_region_test.c:397
> 5 0x000003ffa3d2bb89: ?? ??:0
> 6 0x00000000010017ad: .annobin_abi_note.c.hot at crt1.o:?
> KVM_CREATE_VM ioctl failed, rc: -1 errno: 22
>
>
> Ubuntu:
> make[1]: Leaving directory '/mnt/dev/linux'
> gcc -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99
> -fno-stack-protector -fno-PIE -I../../../../tools/include
> -I../../../../tools/arch/s390/include -I../../../../usr/include/
> -Iinclude -Ilib -Iinclude/s390x -I.. -c lib/sparsebit.c -o
> /mnt/dev/linux/tools/testing/selftests/kvm/lib/sparsebit.o
> gcc -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99
> -fno-stack-protector -fno-PIE -I../../../../tools/include
> -I../../../../tools/arch/s390/include -I../../../../usr/include/
> -Iinclude -Ilib -Iinclude/s390x -I.. -c lib/kvm_util.c -o
> /mnt/dev/linux/tools/testing/selftests/kvm/lib/kvm_util.o
> gcc -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99
> -fno-stack-protector -fno-PIE -I../../../../tools/include
> -I../../../../tools/arch/s390/include -I../../../../usr/include/
> -Iinclude -Ilib/s390x -Iinclude/s390x -I.. -c
> lib/s390x/diag318_test_handler.c -o
> /mnt/dev/linux/tools/testing/selftests/kvm/lib/s390x/diag318_test_handler.o
> ar crs /mnt/dev/linux/tools/testing/selftests/kvm/libkvm.a
> /mnt/dev/linux/tools/testing/selftests/kvm/lib/assert.o
> /mnt/dev/linux/tools/testing/selftests/kvm/lib/elf.o
> /mnt/dev/linux/tools/testing/selftests/kvm/lib/io.o
> /mnt/dev/linux/tools/testing/selftests/kvm/lib/kvm_util.o
> /mnt/dev/linux/tools/testing/selftests/kvm/lib/sparsebit.o
> /mnt/dev/linux/tools/testing/selftests/kvm/lib/test_util.o
> /mnt/dev/linux/tools/testing/selftests/kvm/lib/guest_modes.o
> /mnt/dev/linux/tools/testing/selftests/kvm/lib/perf_test_util.o
> /mnt/dev/linux/tools/testing/selftests/kvm/lib/s390x/processor.o
> /mnt/dev/linux/tools/testing/selftests/kvm/lib/s390x/ucall.o
> /mnt/dev/linux/tools/testing/selftests/kvm/lib/s390x/diag318_test_handler.o
> gcc -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99
> -fno-stack-protector -fno-PIE -I../../../../tools/include
> -I../../../../tools/arch/s390/include -I../../../../usr/include/
> -Iinclude -Is390x -Iinclude/s390x -I.. -pthread s390x/memop.c
> /mnt/dev/linux/tools/testing/selftests/kvm/libkvm.a -o
> /mnt/dev/linux/tools/testing/selftests/kvm/s390x/memop
> /usr/bin/ld: /tmp/ccFU8WYF.o: `stdout@@GLIBC_2.2' non-PLT reloc for
> symbol defined in shared library and accessed from executable (rebuild
> file with -fPIC ?)
> /usr/bin/ld: final link failed: bad value
> collect2: error: ld returned 1 exit status
> make: *** [../lib.mk:139:
> /mnt/dev/linux/tools/testing/selftests/kvm/s390x/memop] Error 1
>
It looks like that from tools/testing/selftests/kvm/Makefile
additional linker flags are being ignored with this patch.
no-pie-option := $(call try-run, echo 'int main() { return 0; }' | \
$(CC) -Werror -no-pie -x c - -o "$$TMP", -no-pie)
# On s390, build the testcases KVM-enabled
pgste-option = $(call try-run, echo 'int main() { return 0; }' | \
$(CC) -Werror -Wl$(comma)--s390-pgste -x c - -o "$$TMP",-Wl$(comma)--s390-pgste)
LDFLAGS += -pthread $(no-pie-option) $(pgste-option)
Powered by blists - more mailing lists