
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
25 lines
870 B
C++
25 lines
870 B
C++
//===--- CodeGenOptions.cpp -----------------------------------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Coding style: https://mlir.llvm.org/getting_started/DeveloperGuide/
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "flang/Frontend/CodeGenOptions.h"
|
|
#include <string.h>
|
|
|
|
namespace Fortran::frontend {
|
|
|
|
CodeGenOptions::CodeGenOptions() {
|
|
#define CODEGENOPT(Name, Bits, Default) Name = Default;
|
|
#define ENUM_CODEGENOPT(Name, Type, Bits, Default) set##Name(Default);
|
|
#include "flang/Frontend/CodeGenOptions.def"
|
|
}
|
|
|
|
} // end namespace Fortran::frontend
|