This is an archive of the discontinued LLVM Phabricator instance.

[AIX][Clang][K] Create `-K` Option for AIX.
ClosedPublic

Authored by francii on Mar 19 2023, 3:54 PM.

Details

Summary

-K is a linker option on AIX, that is used to align the header, text, data, and loader sections of the output file so
that each section begins on a page boundary.

This patch creates the -K option in clang. On non-AIX targets, the "unsupported option" error is thrown.

Diff Detail

Event Timeline

francii created this revision.Mar 19 2023, 3:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 19 2023, 3:54 PM
francii requested review of this revision.Mar 19 2023, 3:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 19 2023, 3:54 PM
francii edited the summary of this revision. (Show Details)
francii edited the summary of this revision. (Show Details)
francii updated this revision to Diff 506447.Mar 19 2023, 4:01 PM

nit: spacing

francii updated this revision to Diff 506575.Mar 20 2023, 7:25 AM

Add test case

francii updated this revision to Diff 506580.Mar 20 2023, 7:34 AM

Clean up test case

francii updated this revision to Diff 508709.Mar 27 2023, 9:48 AM

Remove NoArgumentUnused, claim -K when checking target.

@francii, what happens when -K is used on a pure-compile (-c) invocation? Do we get an "unused" message? Should we be testing that?
I think we should be testing the diagnostic for the "wrong target" usage as well?

@francii, what happens when -K is used on a pure-compile (-c) invocation? Do we get an "unused" message? Should we be testing that?
I think we should be testing the diagnostic for the "wrong target" usage as well?

When compiling with -c, we will get the "unused" message. I will include a test case for it.

Do we need a test case for the diagnostic? If we are only supporting one target, which triple would be used for the test?

Do we need a test case for the diagnostic? If we are only supporting one target, which triple would be used for the test?

I think we do need a test case for the diagnostic. I suspect it should be in a separate file.
Unlike a lot of the options work we did for AIX, this is adding a new option (not processing an existing one).
I suggest powerpc64-unknown-linux-gnu for the triple.

francii updated this revision to Diff 511208.Apr 5 2023, 2:26 PM

Add -c test case

francii updated this revision to Diff 511431.Apr 6 2023, 8:45 AM

Add unsupported target test case

daltenty added inline comments.May 8 2023, 8:12 AM
clang/lib/Driver/ToolChains/Clang.cpp
6331

Let's not claim here, just in case this isn't a link step invocation.

francii updated this revision to Diff 520455.May 8 2023, 11:41 AM

Don't claim -k when checking target

francii marked an inline comment as done.May 8 2023, 11:41 AM
daltenty accepted this revision.May 8 2023, 3:29 PM

LGTM, with minor fixup as noted

clang/test/Driver/aix-ld.c
1104

nit: I think you missed a conflict marker on the last update

This revision is now accepted and ready to land.May 8 2023, 3:29 PM
francii updated this revision to Diff 520502.May 8 2023, 3:50 PM

Remove leftover marker

francii marked an inline comment as done.May 8 2023, 3:50 PM
This revision was landed with ongoing or failed builds.May 8 2023, 3:54 PM
This revision was automatically updated to reflect the committed changes.