Skip to content

Commit

Permalink
[BOLT] Fix C++ ABI function alignment.
Browse files Browse the repository at this point in the history
Summary: C++ functions have to be aligned at 2-bytes minimum on x86-64.

(cherry picked from FBD5128185)
  • Loading branch information
maksfb committed May 25, 2017
1 parent 5cd5896 commit 174e3a8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions bolt/RewriteInstance.cpp
Expand Up @@ -1884,10 +1884,9 @@ void emitFunction(MCStreamer &Streamer, BinaryFunction &Function,
Streamer.SwitchSection(Section);

if (opts::Relocs) {
Streamer.EmitCodeAlignment(std::max((unsigned)opts::AlignFunctions,
BinaryFunction::MinAlign),
std::max((unsigned)opts::AlignFunctionsMaxBytes,
BinaryFunction::MinAlign - 1));
Streamer.EmitCodeAlignment(BinaryFunction::MinAlign);
Streamer.EmitCodeAlignment(opts::AlignFunctions,
opts::AlignFunctionsMaxBytes);
} else {
Streamer.EmitCodeAlignment(Function.getAlignment());
Streamer.setCodeSkew(EmitColdPart ? 0 : Function.getAddress());
Expand Down

0 comments on commit 174e3a8

Please sign in to comment.