Skip to content
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

Set ENABLE_EXPORTS property for rtl_airband #339

Merged

Conversation

aaron-sierra
Copy link

Make sure that exported functions (i.e. {device}_input_new()) will land in the dynamic symbol table, regardless of level of optimization.

I experienced missing symbols using GCC (10.3.1) with Buildroot (2022-11-rc2). That build environment doesn't leverage the "historical" implicit exporting enabled on other distros through the following module:

/usr/share/cmake-{cmake-version}/Modules/Platform/Linux-GNU.cmake

This is an improved implementation superseding #338

Make sure that exported functions (i.e. {device}_input_new()) will
land in the dynamic symbol table, regardless of level of optimization.

I experienced missing symbols using GCC (10.3.1) with Buildroot
(2022-11-rc2). That build environment doesn't leverage the "historical"
implicit exporting enabled on other distros through the following
module:

    /usr/share/cmake-{cmake-version}/Modules/Platform/Linux-GNU.cmake
@aaron-sierra
Copy link
Author

Before

Note -Wl,--export-dynamic not in linking command.

[100%] Linking CXX executable rtl_airband
cd /home/user/src/buildroot/output/build/rtlsdr-airband-v4.0.2/src && /home/user/src/buildroot/output/host/bin/cmake -E cmake_link_script CMakeFiles/rtl_airband.dir/link.txt --verbose=1
/home/user/src/buildroot/output/host/bin/aarch64-none-linux-gnu-g++ --sysroot=/home/user/src/buildroot/output/host/aarch64-buildroot-linux-gnu/sysroot -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g0 -D_FORTIFY_SOURCE=1 -Wall -Wextra  -DNDEBUG CMakeFiles/rtl_airband_base.dir/config.cpp.o CMakeFiles/rtl_airband_base.dir/input-common.cpp.o CMakeFiles/rtl_airband_base.dir/input-file.cpp.o CMakeFiles/rtl_airband_base.dir/input-helpers.cpp.o CMakeFiles/rtl_airband_base.dir/mixer.cpp.o CMakeFiles/rtl_airband_base.dir/output.cpp.o CMakeFiles/rtl_airband_base.dir/rtl_airband.cpp.o CMakeFiles/rtl_airband_base.dir/squelch.cpp.o CMakeFiles/rtl_airband_base.dir/util.cpp.o CMakeFiles/rtl_airband_base.dir/udp_stream.cpp.o CMakeFiles/rtl_airband_base.dir/version.cpp.o CMakeFiles/rtl_airband_base.dir/input-rtlsdr.cpp.o -o rtl_airband  -ldl -lm -lpthread -lconfig++ -lmp3lame -lshout -lrtlsdr -lfftw3f

Input config functions are not in dynamic symbol table.

$ readelf --dyn-syms buildroot/output/target/usr/bin/rtl_airband | grep _input_new
$ echo $?
1

After

Note -Wl,--export-dynamic in linking command.

[100%] Linking CXX executable rtl_airband
cd /home/user/src/buildroot/output/build/rtlsdr-airband-bd86f1afccc1a19ff9d22022a1aac4a9b6bbfd61/src && /home/user/src/buildroot/output/host/bin/cmake -E cmake_link_script CMakeFiles/rtl_airband.dir/link.txt --verbose=1
/home/user/src/buildroot/output/host/bin/aarch64-none-linux-gnu-g++ --sysroot=/home/user/src/buildroot/output/host/aarch64-buildroot-linux-gnu/sysroot -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g0 -D_FORTIFY_SOURCE=1 -Wall -Wextra  -DNDEBUG -Wl,--export-dynamic CMakeFiles/rtl_airband_base.dir/config.cpp.o CMakeFiles/rtl_airband_base.dir/input-common.cpp.o CMakeFiles/rtl_airband_base.dir/input-file.cpp.o CMakeFiles/rtl_airband_base.dir/input-helpers.cpp.o CMakeFiles/rtl_airband_base.dir/mixer.cpp.o CMakeFiles/rtl_airband_base.dir/output.cpp.o CMakeFiles/rtl_airband_base.dir/rtl_airband.cpp.o CMakeFiles/rtl_airband_base.dir/squelch.cpp.o CMakeFiles/rtl_airband_base.dir/util.cpp.o CMakeFiles/rtl_airband_base.dir/udp_stream.cpp.o CMakeFiles/rtl_airband_base.dir/version.cpp.o CMakeFiles/rtl_airband_base.dir/input-rtlsdr.cpp.o -o rtl_airband  -ldl -lm -lpthread -lconfig++ -lmp3lame -lshout -lrtlsdr -lfftw3f

Input config functions are in dynamic symbol table.

$ readelf --dyn-syms buildroot/output/target/usr/bin/rtl_airband | grep _input_new
   320: 000000000000c444   196 FUNC    GLOBAL DEFAULT   13 file_input_new
   334: 0000000000011bdc   216 FUNC    GLOBAL DEFAULT   13 rtlsdr_input_new
$ echo $?
0

@szpajder szpajder merged commit 40463c2 into charlie-foxtrot:unstable Dec 5, 2022
@szpajder
Copy link
Collaborator

szpajder commented Dec 5, 2022

Merged, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants