Commit 69bf40c4 authored by Fangrui Song's avatar Fangrui Song
Browse files

[Driver][CodeGen] Support -fpatchable-function-entry=N,M and...

[Driver][CodeGen] Support -fpatchable-function-entry=N,M and __attribute__((patchable_function_entry(N,M))) where M>0

Reviewed By: nickdesaulniers

Differential Revision: https://reviews.llvm.org/D73072
parent 01da05b7
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -3998,8 +3998,6 @@ def PatchableFunctionEntryDocs : Documentation {
before the function entry and N-M NOPs after the function entry. This attribute
takes precedence over the command line option ``-fpatchable-function-entry=N,M``.
``M`` defaults to 0 if omitted.

Currently, only M=0 is supported.
}];
}

+1 −0
Original line number Diff line number Diff line
@@ -115,6 +115,7 @@ CODEGENOPT(XRayIgnoreLoops , 1, 0)
VALUE_CODEGENOPT(XRayInstructionThreshold , 32, 200)

VALUE_CODEGENOPT(PatchableFunctionEntryCount , 32, 0) ///< Number of NOPs at function entry
VALUE_CODEGENOPT(PatchableFunctionEntryOffset , 32, 0)

CODEGENOPT(InstrumentForProfiling , 1, 0) ///< Set when -pg is enabled.
CODEGENOPT(CallFEntry , 1, 0) ///< Set when -mfentry is enabled.
+1 −1
Original line number Diff line number Diff line
@@ -408,7 +408,7 @@ def err_drv_unsupported_indirect_jump_opt : Error<
def err_drv_unknown_indirect_jump_opt : Error<
  "unknown '-mindirect-jump=' option '%0'">;
def err_drv_unsupported_fpatchable_function_entry_argument : Error<
  "the second argument of '-fpatchable-function-entry' must be 0 or omitted">;
  "the second argument of '-fpatchable-function-entry' must be smaller than the first argument">;

def warn_drv_unable_to_find_directory_expected : Warning<
  "unable to find %0 directory, expected to be in '%1'">,
+3 −0
Original line number Diff line number Diff line
@@ -372,6 +372,9 @@ def fsanitize_coverage_no_prune
def fsanitize_coverage_stack_depth
    : Flag<["-"], "fsanitize-coverage-stack-depth">,
      HelpText<"Enable max stack depth tracing">;
def fpatchable_function_entry_offset_EQ
    : Joined<["-"], "fpatchable-function-entry-offset=">, MetaVarName<"<M>">,
      HelpText<"Generate M NOPs before function entry">;
def fprofile_instrument_EQ : Joined<["-"], "fprofile-instrument=">,
    HelpText<"Enable PGO instrumentation. The accepted value is clang, llvm, "
             "or none">, Values<"none,clang,llvm">;
+1 −1
Original line number Diff line number Diff line
@@ -1714,7 +1714,7 @@ def fno_max_type_align : Flag<["-"], "fno-max-type-align">, Group<f_Group>;
def fpascal_strings : Flag<["-"], "fpascal-strings">, Group<f_Group>, Flags<[CC1Option]>,
  HelpText<"Recognize and construct Pascal-style string literals">;
def fpatchable_function_entry_EQ : Joined<["-"], "fpatchable-function-entry=">, Group<f_Group>, Flags<[CC1Option]>,
  HelpText<"Generate N NOPs at function entry">;
  MetaVarName<"<N,M>">, HelpText<"Generate M NOPs before function entry and N-M NOPs after function entry">;
def fpcc_struct_return : Flag<["-"], "fpcc-struct-return">, Group<f_Group>, Flags<[CC1Option]>,
  HelpText<"Override the default ABI to return all structs on the stack">;
def fpch_preprocess : Flag<["-"], "fpch-preprocess">, Group<f_Group>;
Loading