https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78253

            Bug ID: 78253
           Summary: [ARM] call weak function instead of strong when called
                    through pointer
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: clyon at gcc dot gnu.org
  Target Milestone: ---

This is a forward/summary of https://bugs.linaro.org/show_bug.cgi?id=2562

Since GCC 5, on ARM a code fragment like:
some_module.c:
int __attribute__((weak)) some_weak_func(void)
{
    return 10;
}
void save_weak_func_pointer(void)
{
    __weak_func_ptr = some_weak_func;
}

saves the address of the weak implementation in __weak_func_ptr even though the
function can be overridden by a strong implementation in another object file.

so even if main.c has:
int some_weak_func(void)
{
        return 11;
}

when calling through __weak_func_ptr(), we end up calling the weak
implementation.

Reply via email to