0

I've read some documentation that mentions malloc as a weak symbol,such as:

  1. https://en.wikipedia.org/wiki/Weak_symbol
  2. An alternative for the deprecated __malloc_hook functionality of glibc

But I don't see malloc declared as a weak symbol in the source code(malloc.c),which is confusing to me. I have the following questions to ask:

  1. Is malloc really a weak symbol? If so, where is it declared as a weak symbol
  2. an-alternative-for-the-deprecated-malloc-hook-functionality-of-glibc mentioned "but in static linking malloc is not a weak symbol, resulting in a multiple definition error at link time".Static links can allow multiple weak symbols, why does this lead to symbol conflict?

Thanks.

UKeeySDis
  • 51
  • 7

0 Answers0