[PATCH] D131533: [Flang][Driver] Enable PIC in the frontend
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 12 14:26:55 PDT 2022
MaskRay added inline comments.
================
Comment at: flang/lib/Frontend/CompilerInvocation.cpp:151
+static llvm::Reloc::Model getRelocationFromName(llvm::StringRef model) {
+ if (model.equals("static"))
+ return llvm::Reloc::Static;
----------------
awarzynski wrote:
> Only `-fpic` and `-fpie` are tested/supported right? Please, could you trim this accordingly? Or, alternatively, expand the test.
Prefer `==` to `equals`
================
Comment at: flang/lib/Frontend/CompilerInvocation.cpp:297
+ }
+ if (args.hasArg(clang::driver::options::OPT_mrelocation_model)) {
+ llvm::StringRef model =
----------------
Use `getLastArg` when you need to do both `hasArg` and `getLastArgValue`.
================
Comment at: flang/lib/Frontend/FrontendActions.cpp:532
+ // Set PIC/PIE level LLVM module flags.
+ if (auto PICLevel = ci.getInvocation().getFrontendOpts().PICLevel)
+ llvmModule->setPICLevel(*PICLevel);
----------------
expand `auto`
================
Comment at: flang/test/Driver/driver-help.f90:131
! HELP-FC1-NEXT: -module-suffix <suffix> Use <suffix> as the suffix for module files (the default value is `.mod`)
+! HELP-FC1-NEXT: -mrelocation-model <value>
+! HELP-FC1-NEXT: The relocation model to use
----------------
wrong indentation?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131533/new/
https://reviews.llvm.org/D131533
More information about the cfe-commits
mailing list