[PATCH] D134820: [LTO][clang] Teaching Clang to Pass Plugin Options to the AIX Linker

Qiongsi Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 28 11:59:40 PDT 2022


qiongsiwu1 created this revision.
qiongsiwu1 added reviewers: w2yehia, MaskRay.
qiongsiwu1 added a project: clang.
Herald added subscribers: ormris, StephenFan, steven_wu, hiraditya, inglorion.
Herald added a project: All.
qiongsiwu1 requested review of this revision.
Herald added a subscriber: cfe-commits.

This patch teaches `clang` to use the prefix `-bplugin_opt:` (instead of `-plugin-opt`) on AIX, when passing plugin options to the linker. This patch follows https://reviews.llvm.org/D134668.

We put the code that decides what plugin option prefix to use at the top of the function `tools::addLTOOptions` and the plugin option prefix, the mcpu prefix, and the opt level prefix are different on AIX. We thought about choosing the strings in a function that reads the linker name and the target triple, or we could push the logic into different derived `ToolChain` classes. But this logic would not be used anywhere else, so these alternatives looked too complicated for what they did. Therefore we are doing it the current way. That said, I am all ears for suggestions to improve this code!

Subsequent code uses the `PluginOptPrefix` variable consistently instead of the hardcoded `-plugin-opt`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134820

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/CommonArgs.h
  clang/test/Driver/lto-aix.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134820.463638.patch
Type: text/x-patch
Size: 18952 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220928/61f37d16/attachment-0001.bin>


More information about the cfe-commits mailing list