[U-Boot] [PATCH v2] x86: lib: Implement standalone __udivdi3 etc instead of libgcc ones

Bin Meng bmeng.cn at gmail.com
Wed Nov 29 12:31:32 UTC 2017


Hi Stefan,

On Wed, Nov 29, 2017 at 6:01 PM, Stefan Roese <sr at denx.de> wrote:
> Hi Bin,
>
>
> On 29.11.2017 10:23, Bin Meng wrote:
>>
>> On Wed, Nov 29, 2017 at 4:42 PM, Stefan Roese <sr at denx.de> wrote:
>>>
>>> Hi Bin,
>>>
>>> On 29.11.2017 09:30, Bin Meng wrote:
>>>
>>> <snip>
>>>
>>>>>> I wrote some codes soemthing like:
>>>>>>
>>>>>> s64 a, b, c;
>>>>>> c = a/b;
>>>>>>
>>>>>> The compiler will generate codes to call __divdi3. This works before
>>>>>> your
>>>>>> patch.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Yes, I understand this. But right now, we don't have any code
>>>>> generating this error. And if this will happen at some time, I would
>>>>> prefer to investigate this code sequence introducing this division, to
>>>>> use the division functions / macros available in U-Boot (as mentioned
>>>>> above) and in the kernel instead.
>>>>>
>>>>> Here a short explanation, why this new version is preferred to the
>>>>> currently available functions pulled from libgcc: We are fixing an
>>>>> "ugly" Yocto build problem with this patch, related to 32bit binaries
>>>>> with 64bit toolchains (multilib) building by not relying on anything
>>>>> from libgcc. Please see this thread for some more details:
>>>>>
>>>>> https://www.mail-archive.com/yocto@yoctoproject.org/msg36721.html
>>>>>
>>>>> I hope this helps a bit to understand the motivation behind this patch.
>>>>>
>>>>
>>>> Thanks for the background. I am not familiar with yocto project, but
>>>> is the build broken due to the gcc on the build host does not ship
>>>> with multilib?
>>>
>>>
>>>
>>> Please take a look at the email thread mentioned above for a detailed
>>> explanation. Especially this post should answer your questions:
>>>
>>> https://www.mail-archive.com/yocto@yoctoproject.org/msg36748.html
>>
>>
>> Now I see. Thank you.
>>
>>>
>>>> I am using a 64-bit host with gcc multilib, and there is no such build
>>>> error observed.
>>>
>>>
>>>
>>> Right. This issue is only seen on Yocto builds (AFAIK). But again,
>>> I would really like to see U-Boot x86 being self-contained without
>>> any host libgcc dependencies as on other architectures as well.
>>
>>
>> So to completely resolve such issue to make U-Boot self-contained, we
>> should remove the reference to the host libgcc.a in
>> arch/x86/lib/Makefile, and use CONFIG_USE_PRIVATE_GCC to include the
>> build for div64.o. Thoughts?
>
>
> I was under the impression, that I already removed the host libgcc
> reference completely for x86 with my patch. But you are correct - there
> still is a reference in this Makefile which is used by the standalone
> code, AFAICT.
>
> Any quick idea on how to rid of this one as well?
>

I believe we need change

obj-y  += div64.o

to

lib-$(CONFIG_USE_PRIVATE_LIBGCC) += div64.o

To remove the libgcc dependency completely.

Regards,
Bin


More information about the U-Boot mailing list