Skip to content

components leaking multiple versions of functions leads to random crash (IDFGH-17480) #18431

@boborjan2

Description

@boborjan2

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

5.5.3, esp_audio_codec 2.4.1

Operating System used.

Windows

How did you build your project?

Command line with Make

If you are using Windows, please specify command line type.

None

What is the expected behavior?

Components shall only export symbols defined in their public header files.

What is the actual behavior?

Multiple version of the same functions may be present during the final linking. The linker chooses from those and this leads to undefined results. E.g.:
espressif/esp-adf#1592: multple versions of sbc codec may be present in components/bt and esp_audio_codec.
espressif/esp-adf#1596: multiple versionf of dsp functions may be present when using esp_audio_codec and esp-dsp.

Steps to reproduce.

CONFIG_BT_A2DP_USE_EXTERNAL_CODEC -> undefined
CONFIG_BT_HFP_USE_EXTERNAL_CODEC = 1
Using esp_audio_codec's sbc encoder lead to crash since the one from the bt source tree is chosen by linker.

Build or installation Logs.


Diagnostic report archive.

No response

More Information.

I suggest all component to be linked with -fvisibility=none. Only symbols in the buplic headers shall be exported to avoild the situation above.
e.g:
https://stackoverflow.com/questions/9648655/how-to-hide-the-exported-symbols-name-within-a-shared-library
https://stackoverflow.com/questions/435352/limiting-visibility-of-symbols-when-linking-shared-libraries/452955#452955
https://stackoverflow.com/questions/34797791/choose-exported-symbols-when-linking-an-elf-application-and-shared-library

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions