linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Janosch Frank <frankja@linux.ibm.com>,
	Masahiro Yamada <masahiroy@kernel.org>,
	linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	Michal Marek <michal.lkml@markovi.net>,
	Marc Hartmayer <mhartmay@linux.ibm.com>,
	Heiko Carstens <hca@linux.ibm.com>
Subject: Re: [PATCH 3/4] kbuild: spilt cc-option and friends to scripts/Makefile.compiler
Date: Tue, 13 Apr 2021 15:11:21 +0200	[thread overview]
Message-ID: <395d2db1-b860-0da2-a859-d1d840508a46@de.ibm.com> (raw)
In-Reply-To: <86dadf33-70f7-a5ac-cb8c-64966d2f45a1@linux.ibm.com>



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@kernel.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@fedora 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)


  reply	other threads:[~2021-04-13 13:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-28  6:10 [PATCH 1/4] kbuild: add image_name to no-sync-config-targets Masahiro Yamada
2021-02-28  6:10 ` [PATCH 2/4] kbuild: prefix $(srctree)/ to some included Makefiles Masahiro Yamada
2021-02-28  6:10 ` [PATCH 3/4] kbuild: spilt cc-option and friends to scripts/Makefile.compiler Masahiro Yamada
2021-04-13 12:51   ` Janosch Frank
2021-04-13 13:11     ` Christian Borntraeger [this message]
2021-04-15  7:34       ` Masahiro Yamada
2021-02-28  6:10 ` [PATCH 4/4] kbuild: include Makefile.compiler only when compiler is required Masahiro Yamada
2021-02-28  7:00   ` Masahiro Yamada
2021-03-18 21:13   ` Nathan Chancellor
2021-03-18 23:36     ` Masahiro Yamada
2021-03-08 14:10 ` [PATCH 1/4] kbuild: add image_name to no-sync-config-targets Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=395d2db1-b860-0da2-a859-d1d840508a46@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=frankja@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=mhartmay@linux.ibm.com \
    --cc=michal.lkml@markovi.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).