This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Pass -u to linker correctly.
ClosedPublic

Authored by kito-cheng on Jun 29 2021, 2:17 AM.

Details

Summary

-u is a linker option used to pretend a symbol is undefined,
this option are common used for forcing archive member extraction.

This option should pass to ld, and many other toolchain in Clang
like tools::gnutools has pass that too.

Diff Detail

Event Timeline

kito-cheng created this revision.Jun 29 2021, 2:17 AM
kito-cheng requested review of this revision.Jun 29 2021, 2:17 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 29 2021, 2:17 AM
MaskRay requested changes to this revision.Jun 30 2021, 12:36 PM

-u is a linker option used to pretend a symbol is undefined, this option are common used for force pull-in weak symbol.

for forcing archive member extraction.

weak symbols are somewhat orthogonal.

clang/test/Driver/riscv-args.c
5

Just place all linker options on one run line.

It decreases the number of RUN lines and additionally checks the order (though usually unimportant).

This revision now requires changes to proceed.Jun 30 2021, 12:36 PM

Address @MaskRay's comment

MaskRay added inline comments.Jul 1 2021, 9:47 AM
clang/test/Driver/riscv-args.c
5

The test hasn't been updated?

kito-cheng added inline comments.Jul 8 2021, 12:33 AM
clang/test/Driver/riscv-args.c
5

Oh, I only update the testcase I added.

Update testcase.

kito-cheng edited the summary of this revision. (Show Details)Jul 8 2021, 12:34 AM
MaskRay added inline comments.Jul 9 2021, 10:39 AM
clang/test/Driver/riscv-args.c
5

You can place all link options on the same RUN line.

This additionally checks the order.

Changes:

  • Add 2 testcases
MaskRay added a comment.EditedJul 13 2021, 10:04 AM

The update was not what I expected. I said that there should be just one RUN line and you can place -T, -u, --defsym and all other linker options on that line.

This additionally allows us to get a sense of the order.

Each new RUN line consumes some resources on testing machines.

Changes:

  • Update testcase again.
MaskRay accepted this revision.Jul 13 2021, 9:24 PM
This revision is now accepted and ready to land.Jul 13 2021, 9:24 PM
This revision was landed with ongoing or failed builds.Jul 13 2021, 11:25 PM
This revision was automatically updated to reflect the committed changes.