This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Linkerscript: Fall back to search paths when INCLUDE not found
ClosedPublic

Authored by arichardson on Dec 15 2016, 3:34 PM.

Event Timeline

arichardson retitled this revision from to [ELF] - Linkerscript: Fall back to search paths when INCLUDE not found .
arichardson updated this object.
arichardson added reviewers: ruiu, grimar.
arichardson set the repository for this revision to rL LLVM.
arichardson added a project: lld.
arichardson added a subscriber: llvm-commits.
ruiu edited edge metadata.Dec 15 2016, 3:39 PM

Just curious, are you actually using INLCUDE? If so, what application? (I was looking for a real usage of INCLUDE command.)

ELF/LinkerScript.cpp
1186–1194

Can this be

StringRef Tok = unquote(next());

?

1192

Remove {}.

In D27831#624458, @ruiu wrote:

Just curious, are you actually using INLCUDE? If so, what application? (I was looking for a real usage of INCLUDE command.)

I was attempting to build FreeBSD (mips64) with lld and I get this error from the following script: https://github.com/freebsd/freebsd/blob/master/sys/boot/mips/beri/boot2/flashboot.ldscript

arichardson edited edge metadata.
arichardson removed rL LLVM as the repository for this revision.

address comments

ruiu accepted this revision.Dec 15 2016, 3:51 PM
ruiu edited edge metadata.

LGTM with nits. Thank you for doing this!

ELF/LinkerScript.cpp
1187

Please avoid auto and use StringRef as its type is not obvious by RHS.

1193

Use Optional<StringRef> instead of auto.

This revision is now accepted and ready to land.Dec 15 2016, 3:51 PM
ruiu added a comment.Dec 15 2016, 3:59 PM

I'm sorry but it needs a test. Please take a look at test/ELF/linkerscript/linkerscript.s. We have one test for INCLUDE. You want to add one more for this patch.

emaste added a subscriber: emaste.Dec 15 2016, 11:21 PM
arichardson edited edge metadata.
arichardson marked 2 inline comments as done.

added test case

ruiu added a comment.Dec 16 2016, 9:17 AM

LGTM

test/ELF/linkerscript/linkerscript.s
43 ↗(On Diff #81747)

You don't need this readobj.

arichardson marked 2 inline comments as done.
arichardson retitled this revision from [ELF] - Linkerscript: Fall back to search paths when INCLUDE not found to [ELF] - Linkerscript: Fall back to search paths when INCLUDE not found.

remove unnecessary lllvm-readobj invocation

ruiu added a comment.Dec 19 2016, 6:12 PM

It's still LGTM, so please submit. Thanks.

arichardson marked an inline comment as done.Dec 20 2016, 4:50 AM

I don't have commit access, could you commit for me please?

grimar edited edge metadata.Dec 20 2016, 5:37 AM

This patch reveals an issue we have in LLD, looks some memory corruption or we free a buffer that still using.
Alexander, I know you do not have commit permission yet. I am investigating the issue above and commit this for you after fix it.
Hope in next few hours. Thanks !

So D27987 was posted to fix the issue I mentioned.

This revision was automatically updated to reflect the committed changes.