• Pierre Langlois's avatar
    [arm] Restrict usage of pc-relative LDR. · 5361c57b
    Pierre Langlois authored
    Disallow using the PC as a base in LDR and instead provide a dedicated assembler
    method for pc-relative loads. The reason for this is that the generic
    `Assembler::ldr` method may decide to generate more instructions if the offset
    is out of range, and if the PC was the base, we would get surprising
    results. For example:
    
    ~~~
    ldr r0, [pc, #0xcabba9e]
    ~~~
    
    is not equivalent to:
    
    ~~~
    movw ip, #0xba9e
    movt ip, #0xcab
    ldr r0, [pc, ip]
    ~~~
    
    since the reference to the PC has moved down two instructions!
    
    We could teach the assembler to handle those cases correctly, but pc-relative
    loads are used in specific cases only so that's not necessary.
    
    As a drive-by, remove a reference to code aging.
    
    Bug: 
    Change-Id: I586d83a418db52cf28d3b524f889bf40f077998a
    Reviewed-on: https://chromium-review.googlesource.com/847008Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
    Commit-Queue: Pierre Langlois <pierre.langlois@arm.com>
    Cr-Commit-Position: refs/heads/master@{#50475}
    5361c57b
assembler-arm.cc 181 KB