Skip to content

BOLT optimization of Android executables breaks PIE ? #172257

@jiovf

Description

@jiovf

BOLT optimization of Android executables breaks PIE, causing system crashes.

Crash as follows:
F linker : error: /system/bin/netd: Android only supports position-independent executables (-fPIE)

Have anyone ever encountered this? I don't quite understand what happened here.

BOLT Optimization log is:

BOLT-INFO: shared object or position-independent executable detected
BOLT-INFO: Target architecture: aarch64
BOLT-INFO: BOLT version: 9df34a1379261ed0ed3c5ad99a302fc12bd2ca78
BOLT-INFO: first alloc address is 0x0
BOLT-INFO: creating new program header table at address 0xf0000, offset 0xf0000
BOLT-INFO: enabling relocation mode
BOLT-WARNING: binary is using BTI. Optimized binary may be corrupted
BOLT-WARNING: ignoring symbol __fini_array_start at 0x0, which lies outside .interp
BOLT-WARNING: ignoring symbol __fini_array_end at 0x0, which lies outside .interp
BOLT-INFO: pre-processing profile using YAML profile reader
BOLT-INFO: MarkRAStates ran on 822 functions. Ignored 0 functions (0.00%) because of CFI inconsistencies
BOLT-INFO: number of removed linker-inserted veneers: 0
BOLT-INFO: 63 out of 1091 functions in the binary (5.8%) have non-empty execution profile
BOLT-INFO: 1 function with profile could not be optimized
BOLT-INFO: profile quality metrics for the hottest 63 functions (reporting top 5% values): function CFG discontinuity 99.92%; call graph flow conservation gap 100.00%; CFG flow conservation gap 100.00% (weighted) 100.00% (worst); exception handling usage 0.00% (of total BBEC) 0.00% (of total InvokeEC)
BOLT-INFO: basic block reordering modified layout of 52 functions (82.54% of profiled, 4.32% of total)
BOLT-INFO: 0 Functions were reordered by LoopInversionPass
BOLT-INFO: program-wide dynostats after all optimizations before SCTC and FOP:
               316602 : executed forward branches
              102165 : taken forward branches
               205837 : executed backward branches
              148150 : taken backward branches
                53351 : executed unconditional branches
               159577 : all function calls
               76013 : indirect calls
              75330 : PLT calls
              2588089 : executed instructions
               689371 : executed load instructions
              263283 : executed store instructions
                    0 : taken jump table branches
BOLT-INFO: Starting stub-insertion pass
BOLT-INFO: Inserted 0 stubs in the hot area and 0 stubs in the cold area. Shared 0 times, iterated 1 times.
BOLT-INFO: rewritten pac-ret DWARF info in 822 out of 1203 functions (68.33%).
BOLT-INFO: patched build-id (flipped last bit)
BOLT-INFO: setting __hot_start to 0xf4000
BOLT-INFO: setting __hot_end to 0xfb368

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