[BOLT] Don't set code skew in relocations mode.

Summary:
We use code skew in non-relocation mode since functions have fixed
addresses, and internal alignment has to be adjusted wrt the skew.
However in relocation mode it interferes with effective code
alignment, and has to be disabled. I missed it when was re-basing
the relocation diff.

(cherry picked from FBD4599670)
This commit is contained in:
Maksim Panchenko 2017-02-22 11:29:52 -08:00
parent d3e33b6edc
commit 88a461014b
1 changed files with 5 additions and 2 deletions

View File

@ -133,7 +133,7 @@ TopCalledLimit("top-called-limit",
cl::init(100),
cl::ZeroOrMore,
cl::Hidden);
cl::opt<bool>
HotText("hot-text",
cl::desc("hot text symbols support"),
@ -1776,6 +1776,9 @@ void emitFunction(MCStreamer &Streamer, BinaryFunction &Function,
Streamer.SwitchSection(Section);
if (!opts::Relocs)
Streamer.setCodeSkew(EmitColdPart ? 0 : Function.getAddress());
if (opts::Relocs) {
// We have to use at least 2-byte alignment because of C++ ABI.
Streamer.EmitCodeAlignment(2);
@ -2747,7 +2750,7 @@ void RewriteInstance::patchELFSectionHeaderTable(ELFObjectFile<ELFT> *File) {
//
// New section header string table goes last.
// Fix ELF header.
auto NewEhdr = *Obj->getHeader();