Skip to content

Commit

Permalink
OpenBSD: disable indirect branch tracking (crystal-lang#13665)
Browse files Browse the repository at this point in the history
OpenBSD 7.4+ enforces Indirect Branch Tracking but we're not yet
compatible in Crystal, so we disable the feature for the time being.
  • Loading branch information
ysbaddaden committed Oct 22, 2024
1 parent 806ef9b commit 8b08f4e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/compiler/crystal/compiler.cr
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,13 @@ module Crystal
else
link_flags = @link_flags || ""
link_flags += " -rdynamic"

if program.has_flag?("openbsd")
# OpenBSD requires Indirect Branch Tracking by default, but we're not
# compatible (yet), so we disable it for now:
link_flags += " -Wl,-znobtcfi"
end

{DEFAULT_LINKER, %(#{DEFAULT_LINKER} "${@}" -o #{Process.quote_posix(output_filename)} #{link_flags} #{program.lib_flags(@cross_compile)}), object_names}
end
end
Expand Down

0 comments on commit 8b08f4e

Please sign in to comment.