[all-commits] [llvm/llvm-project] ec94f3: [LTO][clang] Teaching Clang to Pass Plugin Options...

Qiongsi Wu via All-commits all-commits at lists.llvm.org
Wed Oct 12 12:59:24 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ec94f372d1c13b40029519a50184258d4de24a13
  Author: Qiongsi Wu <qiongsiwu at gmail.com>
  Date:   2022-10-12 (Wed, 12 Oct 2022)

  Changed paths:
    M clang/lib/Driver/ToolChains/AIX.cpp
    M clang/lib/Driver/ToolChains/AIX.h
    M clang/lib/Driver/ToolChains/CommonArgs.cpp
    M clang/lib/Driver/ToolChains/CommonArgs.h
    A clang/test/Driver/lto-aix.c

  Log Message:
  [LTO][clang] Teaching Clang to Pass Plugin Options to the AIX Linker

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`. 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`.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D134820

More information about the All-commits mailing list