[all-commits] [llvm/llvm-project] ef5ede: [Flang][Driver] Add support for PIC

Usman Nadeem via All-commits all-commits at lists.llvm.org
Mon Aug 22 11:11:15 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ef5ede52efbff6ffa9f8c40dc3c6276146e6ff45
      https://github.com/llvm/llvm-project/commit/ef5ede52efbff6ffa9f8c40dc3c6276146e6ff45
  Author: Usman Nadeem <mnadeem at quicinc.com>
  Date:   2022-08-22 (Mon, 22 Aug 2022)

  Changed paths:
    M clang/include/clang/Driver/Options.td
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Driver/ToolChains/CommonArgs.cpp
    M clang/lib/Driver/ToolChains/CommonArgs.h
    M clang/lib/Driver/ToolChains/Flang.cpp
    M clang/lib/Driver/ToolChains/Flang.h
    M clang/lib/Driver/ToolChains/Linux.cpp
    M flang/include/flang/Frontend/CodeGenOptions.def
    M flang/include/flang/Frontend/CodeGenOptions.h
    M flang/lib/Frontend/CodeGenOptions.cpp
    M flang/lib/Frontend/CompilerInvocation.cpp
    M flang/lib/Frontend/FrontendActions.cpp
    M flang/test/Driver/driver-help.f90
    M flang/test/Driver/pic-flags.f90

  Log Message:
  -----------
  [Flang][Driver] Add support for PIC

This patch does the following:

 - Consumes the PIC flags (fPIC/fPIE/fropi/frwpi etc) in flang-new.
   tools::ParsePICArgs() in ToolChains/CommonArgs.cpp is used for this.
 - Adds FC1Option to "-mrelocation-model", "-pic-level", and "-pic-is-pie"
   command line options.
 - Adds the above options to flang/Frontend/CodeGenOptions' data structure.
 - Sets the relocation model in the target machine, and
 - Sets module flags for the respective PIC/PIE type in LLVM IR.

I have tried my best to replicate how clang does things.

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

Change-Id: I68fe64910be28147dc5617826641cea71b92d94d




More information about the All-commits mailing list