[BOLT] Change order of new sections
authorMaksim Panchenko <maks@fb.com>
Wed, 5 Oct 2022 00:12:02 +0000 (17:12 -0700)
committerMaksim Panchenko <maks@fb.com>
Fri, 7 Oct 2022 18:20:42 +0000 (11:20 -0700)
commit5fca9c5763e85c81bdbd61c67825a63cfdb0058f
treea0f7b427cbdd03b7a8097fdec7cc8c4d695dae26
parent0b213c9090369ff43060816aed38cb6c67e228f8
[BOLT] Change order of new sections

While the order of new sections in the output binary was deterministic
in the past (i.e. there was no run-to-run variation), it wasn't always
rational as we used size to define the precedence of allocatable
sections within "code" or "data" groups (probably unintentionally).
Fix that by defining stricter section-ordering rules.

Other than the order of sections, this should be NFC.

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D135235
bolt/include/bolt/Core/BinarySection.h
bolt/lib/Core/BinarySection.cpp
bolt/test/runtime/X86/section-order.test [new file with mode: 0644]