Skip to content

LLVM-BOLT and glibc on x86_64 #85567

@romanovj

Description

@romanovj

First error: no DT_FINI || DT_FINI_ARRAY.
Fixed with creating it

static void fini(void) {}
__attribute__((section(".fini_array"), used)) static typeof(fini) *fini_p = fini;

Second error: can't disassemble function ____longjmp_chk (asm code of this function in sysdeps/x86_64/__longjmp.S)
Fixed by replcaing asm code with nop =)

Third error: BOLT-ERROR: Offset overflow for dynamic relocation

BOLT-INFO: shared object or position-independent executable detected
BOLT-INFO: Target architecture: x86_64
BOLT-INFO: BOLT version: 8c3b2f419a0eb5d5b4702568beee561b740e0b08
BOLT-INFO: first alloc address is 0x0
BOLT-WARNING: debug info will be stripped from the binary. Use -update-debug-sections to keep it.
BOLT-INFO: enabling relocation mode
BOLT-INFO: enabling lite mode
BOLT-ERROR: function __restore_rt/1 is in conflict with FDE [398ff, 39909). Skipping.
BOLT-WARNING: sizes differ for function __setcontext/1. FDE : 125; symbol table : 145. Using max size.
BOLT-WARNING: sizes differ for function setcontext. FDE : 125; symbol table : 145. Using max size.
BOLT-WARNING: sizes differ for function __GI___clone/1. FDE : 48; symbol table : 91. Using max size.
BOLT-WARNING: sizes differ for function clone. FDE : 48; symbol table : 91. Using max size.
BOLT-WARNING: sizes differ for function __clone. FDE : 48; symbol table : 91. Using max size.
BOLT-WARNING: sizes differ for function __clone3/1. FDE : 23; symbol table : 67. Using max size.
BOLT-WARNING: sizes differ for function clone3/1. FDE : 23; symbol table : 67. Using max size.
BOLT-WARNING: sizes differ for function __GI___clone3/1. FDE : 23; symbol table : 67. Using max size.
BOLT-WARNING: FDE [0x3df4d, 0x3df61) conflicts with function __setcontext/1(*2)
BOLT-WARNING: FDE [0xfcc1a, 0xfcc2a) conflicts with function __GI___clone/1(*3)
BOLT-WARNING: FDE [0xfcc2a, 0xfcc3b) conflicts with function __GI___clone/1(*3)
BOLT-WARNING: FDE [0xfcd81, 0xfcd92) conflicts with function __clone3/1(*3)
BOLT-WARNING: FDE [0xfcd92, 0xfcda3) conflicts with function __clone3/1(*3)
BOLT-ERROR: symbol seen in the middle of the function __BOLT_FDE_FUNCat398ff. Skipping.
BOLT-INFO: pre-processing profile using branch profile reader
BOLT-INFO: forcing -jump-tables=move as PIC jump table was detected in function __printf_buffer_flush/1
BOLT-INFO: 321 out of 3749 functions in the binary (8.6%) have non-empty execution profile
BOLT-INFO: 10 functions with profile could not be optimized
BOLT-WARNING: 270 (84.1% of all profiled) functions have invalid (possibly stale) profile. Use -report-stale to see the list.
BOLT-WARNING: 1108082 out of 1109415 samples in the binary (99.9%) belong to functions with invalid (possibly stale) profile.
BOLT-INFO: profile for 1 objects was ignored
BOLT-INFO: the input contains 60 (dynamic count : 0) opportunities for macro-fusion optimization. Will fix instances on a hot path.
BOLT-INFO: 4846 instructions were shortened
BOLT-INFO: removed 1226 empty blocks
BOLT-INFO: removed 1 'repz' prefixes with estimated execution count of 0 times.
BOLT-INFO: basic block reordering modified layout of 13 functions (4.05% of profiled, 0.35% of total)
BOLT-INFO: UCE removed 1 blocks and 1 bytes of code
BOLT-INFO: splitting separates 3231 hot bytes from 11944 cold bytes (21.29% of split functions is hot).
BOLT-INFO: 1 Functions were reordered by LoopInversionPass
BOLT-INFO: hfsort+ reduced the number of chains from 330 to 306
BOLT-INFO: program-wide dynostats after all optimizations before SCTC and FOP:

                 325 : executed forward branches
                  34 : taken forward branches
                 197 : executed backward branches
                 133 : taken backward branches
                  20 : executed unconditional branches
               43301 : all function calls
                  16 : indirect calls
                   0 : PLT calls
              177808 : executed instructions
                1931 : executed load instructions
                 985 : executed store instructions
                   0 : taken jump table branches
                   0 : taken unknown indirect branches
                 542 : total branches
                 187 : taken branches
                 355 : non-taken conditional branches
                 167 : taken conditional branches
                 522 : all conditional branches

                 374 : executed forward branches (+15.1%)
                   5 : taken forward branches (-85.3%)
                 148 : executed backward branches (-24.9%)
                  99 : taken backward branches (-25.6%)
                  25 : executed unconditional branches (+25.0%)
               43301 : all function calls (=)
                  16 : indirect calls (=)
                   0 : PLT calls (=)
              177820 : executed instructions (+0.0%)
                1931 : executed load instructions (=)
                 985 : executed store instructions (=)
                   0 : taken jump table branches (=)
                   0 : taken unknown indirect branches (=)
                 547 : total branches (+0.9%)
                 129 : taken branches (-31.0%)
                 418 : non-taken conditional branches (+17.7%)
                 104 : taken conditional branches (-37.7%)
                 522 : all conditional branches (=)

BOLT-INFO: SCTC: patched 8 tail calls (8 forward) tail calls (0 backward) from a total of 8 while removing 0 double jumps and removing 8 basic blocks totalling 40 bytes of code. CTCs total execution count is 0 and the number of times CTCs are taken is 0
BOLT-WARNING: failed to patch entries in __memmove_sse2_unaligned_erms/1(*2). The function will not be optimized.
BOLT-INFO: padding code to 0x400000 to accommodate hot text
BOLT-INFO: setting __hot_start to 0x200000
BOLT-INFO: setting __hot_end to 0x22d38c
BOLT-INFO: patched build-id (flipped last bit)
BOLT-ERROR: Offset overflow for dynamic relocation

I don't know how to fix it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions