[PATCH] Fix const pointer assignment trick on clang 9+

Denys Vlasenko vda.linux at googlemail.com
Thu Oct 7 13:26:07 UTC 2021


On Wed, Sep 29, 2021 at 11:37 AM LoveSy <lovesykun at gmail.com> wrote:
>
> From: YU Jincheng <shana at zju.edu.cn>
>
> - clang 9+ will load the const pointer first before the const
>   pointer assignment trick and thus cause null pointer defer.
> - This patch creates a shadow variable to prevent the above from
>   happening for clang 9+.
> - Also, this patch applies `BB_GLOBAL_CONST` to all variables
>   using the same trick, allowing archs or toolchains having the
>   same issue to bypass this trick correctly.
>
> This patch fixes https://bugs.busybox.net/show_bug.cgi?id=14231
> and https://bugs.busybox.net/show_bug.cgi?id=14236

While we are looking at less obscure ways to convince clang to behave,
I applied most of the change - the part which generalizes the trick.
Thank you. Please pull current git.


More information about the busybox mailing list