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

Disable RELRO (Support LLD) #5

Merged
merged 1 commit into from
Apr 30, 2024
Merged

Disable RELRO (Support LLD) #5

merged 1 commit into from
Apr 30, 2024

Conversation

gmbr3
Copy link
Collaborator

@gmbr3 gmbr3 commented Apr 24, 2024

No point having PT_GNU_RELRO as ELF data won't exist when merging into PE32+ file

Unbreaks lld usage which complains about linker script
Fixes #4

No point having PT_GNU_RELRO as ELF data won't exist when merging into PE32+ file

Unbreaks lld usage which complains about linker script
Fixes ncroxon#4
gmbr3 added a commit to gmbr3/fwupd-efi that referenced this pull request Apr 24, 2024
No point having PT_GNU_RELRO as ELF data won't exist when merging into PE32+ file

Unbreaks lld usage which complains about linker script
Copy of ncroxon/gnu-efi#5
@hughsie
Copy link
Contributor

hughsie commented Apr 24, 2024

I've tried this on the flatpak cross-build and get:

ld -L/app/lib -Wl,-z,relro,-z,now -Wl,--as-needed  -nostdlib --warn-common --no-undefined --fatal-warnings --build-id=sha1 -z nocombreloc -z norelro -nostdlib --warn-common --no-undefined --fatal-warnings --build-id=sha1 -z nocombreloc -z norelro -shared -Bsymbolic -L/run/build/gnu-efi//apps/../x86_64/lib -L/run/build/gnu-efi//apps/../x86_64/gnuefi /run/build/gnu-efi//apps/../x86_64/gnuefi/crt0-efi-x86_64.o t.o -o t.so -lefi -lgnuefi /usr/lib/gcc/x86_64-unknown-linux-gnu/13.2.0/libgcc.a -T /run/build/gnu-efi//apps/../gnuefi/elf_x86_64_efi.lds

ld: unrecognized option '-Wl,-z,relro,-z,now'

@gmbr3
Copy link
Collaborator Author

gmbr3 commented Apr 24, 2024

I've tried this on the flatpak cross-build and get:

ld -L/app/lib -Wl,-z,relro,-z,now -Wl,--as-needed  -nostdlib --warn-common --no-undefined --fatal-warnings --build-id=sha1 -z nocombreloc -z norelro -nostdlib --warn-common --no-undefined --fatal-warnings --build-id=sha1 -z nocombreloc -z norelro -shared -Bsymbolic -L/run/build/gnu-efi//apps/../x86_64/lib -L/run/build/gnu-efi//apps/../x86_64/gnuefi /run/build/gnu-efi//apps/../x86_64/gnuefi/crt0-efi-x86_64.o t.o -o t.so -lefi -lgnuefi /usr/lib/gcc/x86_64-unknown-linux-gnu/13.2.0/libgcc.a -T /run/build/gnu-efi//apps/../gnuefi/elf_x86_64_efi.lds

ld: unrecognized option '-Wl,-z,relro,-z,now'

Removing RELRO would break NOW aswell, I presume LD means you have conflicting options not that it doesn't know . Any idea where these options are coming from?? Flatpak defaults??

superm1 pushed a commit to fwupd/fwupd-efi that referenced this pull request Apr 24, 2024
No point having PT_GNU_RELRO as ELF data won't exist when merging into PE32+ file

Unbreaks lld usage which complains about linker script
Copy of ncroxon/gnu-efi#5
@hughsie
Copy link
Contributor

hughsie commented Apr 24, 2024

Flatpak defaults??

Yup, you're completely correct -- it's from /etc/flatpak-builder/defaults.json -- opting out of that and with your patch it builds wonderfully. Thanks!

Copy link
Owner

@ncroxon ncroxon left a comment

Choose a reason for hiding this comment

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

Reviewed by Nigel

@ncroxon ncroxon merged commit 145c056 into ncroxon:master Apr 30, 2024
@gmbr3 gmbr3 deleted the fixes branch May 28, 2024 12:57
@gmbr3 gmbr3 added the enhancement New feature or request label Nov 30, 2024
@gmbr3 gmbr3 changed the title Disable RELRO Disable RELRO (Support LLD) Nov 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gnu-efi-3.0.18 fails to link with lld as linker
3 participants