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

drm-kmod: Export symbols #327

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

emaste
Copy link
Member

@emaste emaste commented Dec 8, 2024

We currently rely on the kernel linker resolving undefined references against local symbols from other kernel modules. Be explicit about the symbols to export, in advance of changing that behaviour.

PR: 207898
Sponsored by: The FreeBSD Foundation

We currently rely on the kernel linker resolving undefined references
against local symbols from other kernel modules.  Be explicit about the
symbols to export, in advance of changing that behaviour.

PR:		207898
Sponsored by:	The FreeBSD Foundation
@evadot
Copy link
Contributor

evadot commented Dec 8, 2024

Wouldn't this be a pain to keep track of ?

@emaste
Copy link
Member Author

emaste commented Dec 8, 2024

It'll be a bit of a pain, but it's not too bad. I generated these largely with a sed expression: sed -E -n 's/^.*EXPORT_SYMBOL[A-Z_]*\((.*)\).*$/EXPORT_SYMS+= \1/p.

We could take the same approach as Linux and use EXPORT_SYMBOL to control this (e.g. output the symbols to a special section similar to linker sets, then process those into the export list for linking).

The alternative is to just set EXPORT_SYMS=YES but it really is a bug that we're linking against local symbols from other modules.

@emaste
Copy link
Member Author

emaste commented Dec 8, 2024

Also linuxkpi_video currently has EXPORT_SYMS=YES.

In my tree I've changed it to:

# drivers/video/aperture.c
EXPORT_SYMS+=  __aperture_remove_legacy_vga_devices
EXPORT_SYMS+=  aperture_remove_conflicting_devices
EXPORT_SYMS+=  aperture_remove_conflicting_pci_devices
EXPORT_SYMS+=  devm_aperture_acquire_for_platform_device

# drivers/video/hdmi.c
EXPORT_SYMS+=  hdmi_audio_infoframe_check
EXPORT_SYMS+=  hdmi_audio_infoframe_init
EXPORT_SYMS+=  hdmi_audio_infoframe_pack
EXPORT_SYMS+=  hdmi_audio_infoframe_pack_for_dp
EXPORT_SYMS+=  hdmi_audio_infoframe_pack_only
EXPORT_SYMS+=  hdmi_avi_infoframe_check
EXPORT_SYMS+=  hdmi_avi_infoframe_init
EXPORT_SYMS+=  hdmi_avi_infoframe_pack
EXPORT_SYMS+=  hdmi_avi_infoframe_pack_only
EXPORT_SYMS+=  hdmi_drm_infoframe_check
EXPORT_SYMS+=  hdmi_drm_infoframe_init
EXPORT_SYMS+=  hdmi_drm_infoframe_pack
EXPORT_SYMS+=  hdmi_drm_infoframe_pack_only
EXPORT_SYMS+=  hdmi_drm_infoframe_unpack_only
EXPORT_SYMS+=  hdmi_infoframe_check
EXPORT_SYMS+=  hdmi_infoframe_log
EXPORT_SYMS+=  hdmi_infoframe_pack
EXPORT_SYMS+=  hdmi_infoframe_pack_only
EXPORT_SYMS+=  hdmi_infoframe_unpack
EXPORT_SYMS+=  hdmi_spd_infoframe_check
EXPORT_SYMS+=  hdmi_spd_infoframe_init
EXPORT_SYMS+=  hdmi_spd_infoframe_pack
EXPORT_SYMS+=  hdmi_spd_infoframe_pack_only
EXPORT_SYMS+=  hdmi_vendor_infoframe_check
EXPORT_SYMS+=  hdmi_vendor_infoframe_init
EXPORT_SYMS+=  hdmi_vendor_infoframe_pack
EXPORT_SYMS+=  hdmi_vendor_infoframe_pack_only

@evadot
Copy link
Contributor

evadot commented Dec 8, 2024

I would prefer a script in the scripts directory that can generate this and put the result in a submakefile that the main ones include.

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