[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT PATCH 2/3] lib/ukboot: Call internal constructors



Hey Sharan,

I'll make the necessary changes for the v2 of the patch.

Thanks,

Vlad

On 4/2/19 7:58 PM, Sharan Santhanam wrote:
> Hello Vlad,
>
> this patch fails when compiling the linuxu platform:
>
> In function `ukplat_entry':
> (.text+0x303): undefined reference to `uk_ctortab'
>
>
> One way of solving the problem is with the following fix:
> --- a/plat/linuxu/Linker.uk
> +++ b/plat/linuxu/Linker.uk
> @@ -4,6 +4,7 @@ LINUXU_LDFLAGS-y += -Wl,-e,_liblinuxuplat_start
>  ## Link image
>  ##
>  LINUXU_IMAGE := $(BUILD_DIR)/$(CONFIG_UK_NAME)_linuxu-$(CONFIG_UK_ARCH)
> +LINUXU_LD_SCRIPT-$(CONFIG_ARCH_X86_64) += 
> $(LIBLINUXUPLAT_BASE)/x86/link64.lds
>  LINUXU_LD_SCRIPT_FLAGS := $(addprefix -Wl$(comma)-T,\
>                             $(EXTRA_LD_SCRIPT-y) $(LINUXU_LD_SCRIPT-y))
>
> diff --git a/plat/linuxu/x86/link64.lds b/plat/linuxu/x86/link64.lds
> new file mode 100644
> index 00000000..80611859
> --- /dev/null
> +++ b/plat/linuxu/x86/link64.lds
> @@ -0,0 +1,5 @@
> +SECTIONS
> +{
> +       INCLUDE plat/common/x86/link64.lds
> +}
> +INSERT AFTER .rodata
>
>
> This above solution depends on the [1], we are hoping to upstream this 
> patch as soon as possible. A similar linker script should also be 
> provided for the arm32 linuxu platform.
>
> Thanks & Regards
> Sharan
>
> [1] https://patchwork.unikraft.org/patch/616336/
>
> On 3/21/19 12:40 AM, Vlad-Andrei BĂDOIU (78692) wrote:
>> Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
>> ---
>>   lib/ukboot/boot.c | 26 +++++++++++++++++---------
>>   1 file changed, 17 insertions(+), 9 deletions(-)
>>
>> diff --git a/lib/ukboot/boot.c b/lib/ukboot/boot.c
>> index 48467828..53b32ba4 100644
>> --- a/lib/ukboot/boot.c
>> +++ b/lib/ukboot/boot.c
>> @@ -56,6 +56,7 @@
>>   #include <uk/plat/time.h>
>>   #include <uk/essentials.h>
>>   #include <uk/print.h>
>> +#include <uk/ctors.h>
>>   #include <uk/argparse.h>
>>   #if CONFIG_LIBUKBUS
>>   #include <uk/bus.h>
>> @@ -141,6 +142,7 @@ void ukplat_entry_argp(char *arg0, char *argb, 
>> __sz argb_len)
>>   void ukplat_entry(int argc, char *argv[])
>>   {
>>       int i;
>> +    const uk_ctor_func_t *cfn;
>>       struct thread_main_arg tma;
>>   #if CONFIG_LIBUKALLOC
>>       struct uk_alloc *a = NULL;
>> @@ -165,15 +167,10 @@ void ukplat_entry(int argc, char *argv[])
>>           }
>>       }
>>   -    uk_pr_info("Constructor table at %p - %p\n",
>> -           __init_array_start, &__init_array_end);
>> -    ukplat_ctor_foreach(__init_array_start, __init_array_end, i) {
>> -        if (__init_array_start[i]) {
>> -            uk_pr_debug("Call constructor (entry %d (%p): %p())...\n",
>> -                    i, &__init_array_start[i],
>> -                    __init_array_start[i]);
>> -            __init_array_start[i]();
>> -        }
>> +    uk_pr_info("Unikraft constructors table at %p\n", uk_ctortab);
>> +    for (cfn = uk_ctortab; *cfn != NULL; ++cfn) {
>> +        uk_pr_debug("Call constructor %p\n", *cfn);
>> +        (*cfn)();
>>       }
>>     #if CONFIG_LIBUKALLOC && CONFIG_LIBUKALLOCBBUDDY && 
>> CONFIG_LIBUKBOOT_INITALLOC
>> @@ -255,6 +252,17 @@ void ukplat_entry(int argc, char *argv[])
>>       tma.argc = argc;
>>       tma.argv = argv;
>>   +    uk_pr_info("Constructor table at %p - %p\n",
>> +            __init_array_start, &__init_array_end);
>> +    ukplat_ctor_foreach(__init_array_start, __init_array_end, i) {
>> +        if (__init_array_start[i]) {
>> +            uk_pr_debug("Call constructor (entry %d (%p): %p())...\n",
>> +                    i, &__init_array_start[i],
>> +                    __init_array_start[i]);
>> +            __init_array_start[i]();
>> +        }
>> +    }
>> +
>>   #if CONFIG_LIBUKSCHED
>>       main_thread = uk_thread_create("main", main_thread_func, &tma);
>>       if (unlikely(!main_thread))
>>

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.