Skip to content

gcc: Pull in libstdc++ getentropy usage fix #526

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

stephanosio
Copy link
Member

@stephanosio stephanosio commented Jul 25, 2022

This commit pulls in the GCC patch that fixes the problem in which the
libstdc++ incorrectly picks up the availability of the "getentropy" and
"arc4random" functions and uses them for "std::random_device" leading
to "undefined reference to getentropy" link errors.

Signed-off-by: Stephanos Ioannidis root@stephanos.io

GCC PR: zephyrproject-rtos/gcc#8

Fixes #519

@stephanosio stephanosio added the area: libstdc++ Issues related to libstdc++ (GNU C++ Library) label Jul 25, 2022
@stephanosio stephanosio added this to the 0.15.0 milestone Jul 25, 2022
@stephanosio stephanosio added the DNM DO NOT MERGE label Jul 25, 2022
@stephanosio
Copy link
Member Author

DNM until zephyrproject-rtos/gcc#8 is merged and the commit reference is updated in this PR.

@stephanosio stephanosio force-pushed the fix_libstdcxx_getentropy branch from c4db5d4 to 2f6224b Compare July 25, 2022 16:58
This commit pulls in the GCC patch that fixes the problem in which the
libstdc++ incorrectly picks up the availability of the "getentropy" and
"arc4random" functions and uses them for "std::random_device" leading
to "undefined reference to `getentropy`" link errors.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
@stephanosio stephanosio force-pushed the fix_libstdcxx_getentropy branch from 2f6224b to 56431d1 Compare July 26, 2022 02:20
@stephanosio stephanosio removed the DNM DO NOT MERGE label Jul 26, 2022
@stephanosio stephanosio marked this pull request as ready for review July 26, 2022 02:21
Copy link
Member Author

@stephanosio stephanosio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested by running tests/subsys/cpp/libcxx at stephanosio/zephyr@bc4dd7d

The tests/subsys/cpp/libcxx/cpp.libcxx.newlib fails to link for qemu_cortex_a53 with the following error message:

/home/stephanos/Downloads/test2/zephyr-sdk-0.15.0-beta2-2-g2f6224b/aarch64-zephyr-elf/bin/../lib/gcc/aarch64-zephyr-elf/12.1.0/../../../../aarch64-zephyr-elf/bin/ld.bfd: discarded output section: `.got.plt'
collect2: error: ld returned 1 exit status

The above link failure is unrelated to the change in this PR and likely has to do with a behavioural change in the recenet Binutils releases.

A similar issue observed and fixed in the Linux kernel:
https://www.spinics.net/lists/kernel/msg3571205.html

To be fixed later during the Zephyr integration stage since this is not a Zephyr SDK issue.

@stephanosio stephanosio merged commit e04544d into zephyrproject-rtos:main Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: libstdc++ Issues related to libstdc++ (GNU C++ Library)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

undefined reference to getentropy in libstdc++
1 participant