Page MenuHomePhabricator

[AIX] Emit error for -G option on AIX
ClosedPublic

Authored by Xiangling_L on Oct 21 2020, 10:29 AM.

Details

Summary
  1. Emit error for -G driver option on AIX
  2. Adjust cmake file to use -Wl,-G instead of -G

Rationale to error on -G:
On AIX, legacy XL compiler uses -G to produce a shared object enabled for use with the run-time linker, which has different meanings from what it is used for in Clang. And in Clang, other targets do not have -G map to another functionality in their legacy compiler. So this error is more important when we are on AIX.

Diff Detail

Event Timeline

Xiangling_L created this revision.Oct 21 2020, 10:29 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptOct 21 2020, 10:29 AM
Xiangling_L requested review of this revision.Oct 21 2020, 10:29 AM

Could we add some rationale to the patch summary about why we would want to deliberately emitting an error for AIX?

clang/lib/Driver/ToolChains/Clang.cpp
4961

Question: When do we query RawTriple, and when we should query Triple?

Xiangling_L marked an inline comment as done.Oct 21 2020, 2:02 PM
Xiangling_L added inline comments.
clang/lib/Driver/ToolChains/Clang.cpp
4961

RawTriple in this function means the triple you passed in or the default one.

Triple in this function means a ToolChain's effective triple.
An effective triple is:

the Clang triple to use for this target, which may take into account the command line arguments. For example, on Darwin the -mmacosx-version-min= command line argument (which
sets the deployment target) determines the version in the triple passed to Clang.

So I feel, if there is no special condition we need to consider, we just use RawTriple.

Xiangling_L edited the summary of this revision. (Show Details)Oct 21 2020, 2:08 PM
clang/test/Driver/aix-err-options.c
2

Does this need a call to not?

clang/lib/Driver/ToolChains/Clang.cpp
4962

Either remove the braces here or add braces for the outer block.

Refer to the

// Use braces for the outer `if` since the nested `for` is braced.

example under https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements.

Xiangling_L marked 3 inline comments as done.Oct 22 2020, 8:37 AM
Xiangling_L added inline comments.
clang/test/Driver/aix-err-options.c
2

Using not will fail the testcase.

Xiangling_L marked an inline comment as done.

Fix the formatting issues;

LGTM; thanks!

clang/test/Driver/aix-err-options.c
2

Got it; didn't know -### has such an effect on the return code.

This revision is now accepted and ready to land.Oct 22 2020, 9:01 AM
This revision was automatically updated to reflect the committed changes.