Re: [kvm-unit-tests PATCH 7/9] s390x: Makefile: Remove snippet flatlib linking

Janosch Frank
2021-09-28T09:57:55Z

On 9/27/21 19:47, Thomas Huth wrote:
> On 22/09/2021 09.18, Janosch Frank wrote:
>> We can't link the flatlib as we do not export everything that it needs
>> and we don't (want to) call the init functions.
>>
>> In the future we might implement a tiny lib that uses select lib
>
> s/select/selected/ ?

Sure

>
>> object files and re-implements functions like assert() and
>> test_facility() to be able to use some parts of the lib.
>>
>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
>> ---
>> s390x/Makefile | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/s390x/Makefile b/s390x/Makefile
>> index 5d1a33a0..d09c0a17 100644
>> --- a/s390x/Makefile
>> +++ b/s390x/Makefile
>> @@ -92,7 +92,7 @@ $(SNIPPET_DIR)/asm/%.gbin: $(SNIPPET_DIR)/asm/%.o $(FLATLIBS)
>> $(OBJCOPY) -I binary -O elf64-s390 -B "s390:64-bit" $@ $@
>>
>> $(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_asmlib) $(FLATLIBS)
>> - $(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/snippets/c/flat.lds $(patsubst %.gbin,%.o,$@) $(snippet_asmlib) $(FLATLIBS)
>> + $(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/snippets/c/flat.lds $(patsubst %.gbin,%.o,$@) $(snippet_asmlib)
>
> Don't we need memcpy() and friends in some cases? ... well, likely not,
> otherwise linking would fail... So:
>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
>

Currently not but we can still import header files and use static things
which is very helpful already. Fixing this will require a lot of thought
since I don't really want to write a new lib just for the snippets but
making them compatible to the flatlib will also require a lot of work.