Page MenuHomePhabricator

[LLD][ELF][ARM] Accept and ignore -p and -no-pipeline-knowledge
ClosedPublic

Authored by peter.smith on Feb 22 2019, 2:39 AM.

Details

Summary

The linux kernel uses an old flag -p/-no-pipeline-knowledge that is accepted by bfd and gold but ignored by modern versions of them. The original option is very old and is pre-ABI, it sometimes comes up in code-bases that had support for pre ABI toolchains. Linux uses the option in its shorter -p form in 3 places arch/arm/Makefile arch/arm/boot/bootp/Makefile and arch/arm/boot/compressed/Makefile and a defconfig link will fail with LLD unless I manually remove it. Given that it is simple to accept and ignore I thought it would be worth doing that for increased GNU compatibility.

Gold documentation of options https://manpages.debian.org/stretch/binutils-arm-linux-gnueabi/arm-linux-gnueabi-ld.gold.1.en.html search for no-pipeline-knowledge, the -p option is a short form alias. It is marked as ignored for compatibility.

Diff Detail

Repository
rL LLVM

Event Timeline

peter.smith created this revision.Feb 22 2019, 2:39 AM

I have no objections.

ruiu accepted this revision.Feb 22 2019, 2:31 PM

LGTM

Perhaps we should remove the usage of these flags from the Linux kernel even after this patch has landed because they are just dead flags, but this patch per se looks good to me.

This revision is now accepted and ready to land.Feb 22 2019, 2:31 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 25 2019, 2:48 AM

The three places were removed https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=091bb549f7722723b284f63ac665e2aedcf9dec9

This has been a no-op in binutils since 2004 (see commit dea514f51da1 in that tree). Given that the lowest officially supported of binutils for the kernel is 2.20, which was released in 2009, nobody needs this flag around so just remove it. Commit 1a381d4a0a9a ("arm64: remove no-op -p linker flag") did the same for arm64.

Maybe we can delete the the compatibility code in a future release, lld 10, or 11?

The three places were removed https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=091bb549f7722723b284f63ac665e2aedcf9dec9

This has been a no-op in binutils since 2004 (see commit dea514f51da1 in that tree). Given that the lowest officially supported of binutils for the kernel is 2.20, which was released in 2009, nobody needs this flag around so just remove it. Commit 1a381d4a0a9a ("arm64: remove no-op -p linker flag") did the same for arm64.

Maybe we can delete the the compatibility code in a future release, lld 10, or 11?

Sounds reasonable, I don't think that there is an existing community that have standardized a linux version and are varying their LLVM release on ARM, and I've not seen this option anywhere else. Having said that this does raise the issue of deprecation, in an ideal world when we want to take an option out in release N then we should have the option print a "This option is deprecated and will be removed from the next release." in release N - 1. That way we should flush out anyone depending on the option.