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

lld fails to link kernel modules on FreeBSD/arm: can't create dynamic relocation R_ARM_ABS32 against local symbol in readonly segment #32770

Closed
emaste opened this issue Jun 12, 2017 · 8 comments
Labels
bugzilla Issues migrated from bugzilla invalid Resolved as invalid, i.e. not a bug lld:ELF

Comments

@emaste
Copy link
Member

emaste commented Jun 12, 2017

Bugzilla Link 33423
Resolution INVALID
Resolved on Jun 21, 2017 11:01
Version unspecified
OS FreeBSD
Blocks #23588

Extended Description

Bug created for tracking - reproduction tarball will be added.

While linking the FreeBSD/arm kernel modules the linking fails with errors of the form:

ld -m armelf_fbsd -Bshareable -d -warn-common -o accf_data.ko.full accf_data.kld
ld: error: can't create dynamic relocation R_ARM_ABS32 against local symbol in readonly segment

defined in accf_data.kld
referenced by accf_data.kld:(__set_modmetadata_set_sym__mod_metadata_md_accf_data_on_kernel)

ld: error: can't create dynamic relocation R_ARM_ABS32 against local symbol in readonly segment

defined in accf_data.kld
referenced by accf_data.kld:(__set_modmetadata_set_sym__mod_metadata_md_accf_data)

ld: error: can't create dynamic relocation R_ARM_ABS32 against local symbol in readonly segment

defined in accf_data.kld
referenced by accf_data.kld:(__set_sysinit_set_sym_accf_datamodule_sys_init)*** [accf_data.ko.full] Error code 1

@llvmbot
Copy link
Collaborator

llvmbot commented Jun 15, 2017

ping on the reproduction tarball :-)

@llvmbot
Copy link
Collaborator

llvmbot commented Jun 16, 2017

I noticed something similar in another build. Taking a look.

@emaste
Copy link
Member Author

emaste commented Jun 16, 2017

reproducer .tar

@llvmbot
Copy link
Collaborator

llvmbot commented Jun 16, 2017

I noticed something similar in another build. Taking a look.

At least in the case I hit it was just "-z text" being the default. Can you try passing "-z notext"?

@emaste
Copy link
Member Author

emaste commented Jun 17, 2017

At least in the case I hit it was just "-z text" being the default. Can you
try passing "-z notext"?

Indeed, I am able to link the arm kernel modules with -z notext, and for kernel modules applying .text relocations is not unreasonable.

@llvmbot
Copy link
Collaborator

llvmbot commented Jun 19, 2017

At least in the case I hit it was just "-z text" being the default. Can you
try passing "-z notext"?

Indeed, I am able to link the arm kernel modules with -z notext, and for
kernel modules applying .text relocations is not unreasonable.

Yes, a -z text .so is probably the most convenient format for a loadable module that is never shared.

@emaste
Copy link
Member Author

emaste commented Jun 21, 2017

For reference, addressed in FreeBSD here: https://svnweb.freebsd.org/changeset/base/320179

@emaste
Copy link
Member Author

emaste commented Jun 21, 2017

I've now run basic sanity tests with an LLD-linked FreeBSD kernel and modules on BeagleBone black and everything seems fine.

root@beaglebone:~ # readelf --string-dump=.comment sysctl -n kern.bootfile | grep -i link
[ 8a] Linker: LLD 5.0.0 (FreeBSD 305145)

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla invalid Resolved as invalid, i.e. not a bug lld:ELF
Projects
None yet
Development

No branches or pull requests

2 participants