This is an archive of the discontinued LLVM Phabricator instance.

'.' is not absolute
ClosedPublic

Authored by rafael on Oct 31 2016, 1:21 PM.

Details

Summary

With this patch we keep track of the fact that . is a position in the file and therefore not absolute. This allow us to compute relative relocations that involve symbol that are defined in linker scripts with '.'.

This fixes https://llvm.org/bugs/show_bug.cgi?id=30406

There is still more work to track absoluteness over the various expressions, but this should unblock linking the EFI bootloader.

Diff Detail

Event Timeline

rafael updated this revision to Diff 76461.Oct 31 2016, 1:21 PM
rafael retitled this revision from to '.' is not absolute.
rafael updated this object.
rafael added reviewers: ruiu, evgeny777, phosek.
rafael added a subscriber: llvm-commits.
ruiu added inline comments.Oct 31 2016, 1:30 PM
ELF/LinkerScript.cpp
1190

instead, replace false with []() { return false; }.

ELF/LinkerScript.h
45–46

Instead of T, can we use just uint64_t?

47–48

This function is too thin as a wrapper for Expr(T, std::function<bool()>), so I wouldn't add this.

rafael updated this revision to Diff 76471.Oct 31 2016, 1:57 PM
ruiu accepted this revision.Oct 31 2016, 2:02 PM
ruiu edited edge metadata.

LGTM

This revision is now accepted and ready to land.Oct 31 2016, 2:02 PM
phosek accepted this revision.Nov 1 2016, 2:37 PM
phosek edited edge metadata.

LGTM

emaste added a subscriber: emaste.Nov 1 2016, 2:41 PM

With this change the EFI bootloader links, although it does not work. The UEFI firmware reports "Error reported: Invalid Parameter" when it tries to execute the lld-linked BOOTx64.efi. To be investigated.

evgeny777 accepted this revision.Nov 2 2016, 12:22 AM
evgeny777 edited edge metadata.

LGTM

Do you plan to merge this patch? We're still hitting this issue in our build and it'd be great to have this patch in.

This change was committed in rL285641

espindola closed this revision.Mar 14 2018, 4:22 PM
espindola added a subscriber: espindola.

285641