This is an archive of the discontinued LLVM Phabricator instance.

[lld][test] Handle long build path
AbandonedPublic

Authored by thopre on Dec 3 2020, 12:16 PM.

Details

Summary

LLD test ELF/copy-relocation-zero-nonabs-addr.s fails when the build
path is too long. This is because the DT_NEEDED entry for the shared
library containing object foo encodes the full path to the library. When
the path gets too big, it pushes the beginning of .bss.rel.ro beyond the
expected address of the test and thus the section gets aligned to the
next suitable address.

This commit sets the soname to avoid the build path ending up in the
.dynstr section and thus push .bss.rel.ro further away.

Diff Detail

Event Timeline

thopre created this revision.Dec 3 2020, 12:16 PM
thopre requested review of this revision.Dec 3 2020, 12:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 3 2020, 12:16 PM
Herald added a subscriber: MaskRay. · View Herald Transcript
MaskRay added inline comments.Dec 3 2020, 1:25 PM
lld/test/ELF/copy-relocation-zero-nonabs-addr.s
3

Add --soname=t (or any arbitrary string)

thopre updated this revision to Diff 309354.Dec 3 2020, 1:33 PM

Use --soname instead of changing the CHECK

thopre updated this revision to Diff 309355.Dec 3 2020, 1:36 PM
thopre edited the summary of this revision. (Show Details)

Update description

Harbormaster completed remote builds in B81010: Diff 309355.
MaskRay accepted this revision.Dec 3 2020, 8:03 PM
This revision is now accepted and ready to land.Dec 3 2020, 8:03 PM
thopre updated this revision to Diff 309488.Dec 4 2020, 2:06 AM
thopre edited the summary of this revision. (Show Details)

Use -l instead of passing library as input file

thopre requested review of this revision.EditedDec 4 2020, 2:06 AM

Sorry, the -soname approach did not solve it on our systems (actually we now have debug build all failing) because it adds a DT_SONAME entry on top of the DT_NEEDED which still contain a full path. How about using -l instead?

Sorry, the -soname approach did not solve it on our systems (actually we now have debug build all failing) because it adds a DT_SONAME entry on top of the DT_NEEDED which still contain a full path. How about using -l instead?

@MaskRay Ping?

MaskRay requested changes to this revision.Dec 12 2020, 3:44 PM

Sorry, the -soname approach did not solve it on our systems (actually we now have debug build all failing) because it adds a DT_SONAME entry on top of the DT_NEEDED which still contain a full path. How about using -l instead?

You used it wrongly. You should use something like --soname=t instead of --soname=%t (%t will expand to the absolute path).

This revision now requires changes to proceed.Dec 12 2020, 3:44 PM

Sorry, the -soname approach did not solve it on our systems (actually we now have debug build all failing) because it adds a DT_SONAME entry on top of the DT_NEEDED which still contain a full path. How about using -l instead?

You used it wrongly. You should use something like --soname=t instead of --soname=%t (%t will expand to the absolute path).

I did, see version 2 of this diff which contained not --soname=t but --soname copy-relocation-zero-nonabs. The effect was *adding* a DT_SONAME entry but it did not change the value of the DT_NEEDED entry.

I'll fix and simplify the tests.

The idea is that shared objects for input should set soname. See the description of 0cfa72eaec134693105ec6916aa4692119337a3d

thopre added a comment.EditedDec 12 2020, 3:54 PM

I'll fix and simplify the tests.

The idea is that shared objects for input should set soname. See the description of 0cfa72eaec134693105ec6916aa4692119337a3d

Is it "recent" (few months) behavior change? The system on which I tested the --soname is a few month behind master, so that could explain why it didn't work.

I'll fix and simplify the tests.

The idea is that shared objects for input should set soname. See the description of 0cfa72eaec134693105ec6916aa4692119337a3d

Is it "recent" (few months) behavior change? The system on which I tested the --soname is a few month behind master, so that could explain why it didn't work.

Doh I see what I did wrong, I changed the wrong ld line (the one creating the executable). I'll fix the testcase.

thopre updated this revision to Diff 311417.Dec 12 2020, 4:45 PM
thopre edited the summary of this revision. (Show Details)

Use --soname on the right line

Fixed by 5d1c723b73aff4a33c4653b9f675cf18dea8c7d6
The tests were a bit confusing so they needed rewrite anyway.

thopre abandoned this revision.Dec 13 2020, 8:15 AM

Fixed by 5d1c723b73aff4a33c4653b9f675cf18dea8c7d6
The tests were a bit confusing so they needed rewrite anyway.

Thanks a lot. Abandoning revision then.