This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Allow discarding of .rela.plt
ClosedPublic

Authored by martell on Nov 24 2018, 2:45 PM.

Details

Summary

When linking the linux kernel on ppc64 le

ld.lld -EL -m elf64lppc -Bstatic --orphan-handling=warn --build-id -o .tmp_vmlinux1 -T ./arch/powerpc/kernel/vmlinux.lds --whole-archive built-in.a --no-whole-archive --start-group lib/lib.a --end-group
ld.lld: error: discarding .rela.plt section is not allowed

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

martell created this revision.Nov 24 2018, 2:45 PM
martell updated this revision to Diff 175167.Nov 24 2018, 4:42 PM

update tests

grimar added a subscriber: grimar.Nov 25 2018, 11:59 PM

This is probably fine. The test was introduced in D41640.

Before D41640 the constructions like /DISCARD/ : { *(.rela.plt) were completely ignored,
but after that patch, we could discard them or report an error.

I think we report an error just because it seems uncommon for scripts to discard this section
and we never faced that before. I assume your script do that, is it correct?
(I did not find how the macro DISCARDS expands in
https://github.com/spotify/linux/blob/master/arch/powerpc/kernel/vmlinux.lds.S#L262)

ruiu accepted this revision.Nov 26 2018, 9:06 AM

Yeah I believe this is fine too. LGTM.

This revision is now accepted and ready to land.Nov 26 2018, 9:06 AM

Sorry only getting around to this comment now. I think this is probably what you are looking for
https://github.com/torvalds/linux/blob/master/arch/powerpc/kernel/vmlinux.lds.S#L387

grimar added a comment.Dec 4 2018, 4:37 AM

Sorry only getting around to this comment now. I think this is probably what you are looking for
https://github.com/torvalds/linux/blob/master/arch/powerpc/kernel/vmlinux.lds.S#L387

Thanks!

This revision was automatically updated to reflect the committed changes.