Changeset eb630cf in mainline


Ignore:
Timestamp:
2023-01-18T20:20:29Z (16 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b67ce1ff
Parents:
b83c5e4
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2022-09-02 18:43:01)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2023-01-18 20:20:29)
Message:

Fix handling of ABS32 relocation on arm32

A bad symbol reference in entryjmp.S was creating
an ABS32 relocation causing issues for dynamic
linker, leading to the ABS32 relocation being
generally ignored. However, that was not the
correct solution, as doing so breaks stacktrace
code (which emits global function pointers in
static data, creating ABS32 relocs).

The symbol reference in entryjmp.S was fixed by
converting the function to inline assembly, let
GCC deal with variable addresses.

Location:
uspace/lib/c/arch/arm32
Files:
2 added
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/arch/arm32/meson.build

    rb83c5e4 reb630cf  
    3030arch_src += files(
    3131        'src/atomic.c',
    32         'src/entryjmp.S',
     32        'src/entryjmp.c',
    3333        'src/thread_entry.S',
    3434        'src/syscall.c',
  • uspace/lib/c/arch/arm32/src/atomic.c

    rb83c5e4 reb630cf  
    3434
    3535#include <stdbool.h>
     36#include "ras_page.h"
    3637
    3738volatile unsigned *ras_page;
  • uspace/lib/c/arch/arm32/src/crt0.S

    rb83c5e4 reb630cf  
    4040SYMBOL(_start)
    4141        # Store the RAS page address into the ras_page variable
     42        // FIXME: This only works for not-PIC executables.
    4243        ldr r0, =ras_page
    4344        str r2, [r0]
  • uspace/lib/c/arch/arm32/src/rtld/reloc.c

    rb83c5e4 reb630cf  
    127127
    128128                switch (rel_type) {
    129                 case R_ARM_ABS32:
    130                         DPRINTF("ignore R_ARM_ABS32\n");
    131                         /*
    132                          * Not sure why we get these static relocations, but
    133                          * attempting to process them will crash the
    134                          * loader. If we ignore them, everything
    135                          * seems to work.
    136                          */
    137                         break;
    138 
    139129                case R_ARM_TLS_DTPMOD32:
    140130                        DPRINTF("fixup R_ARM_TLS_DTPMOD32\n");
     
    189179                case R_ARM_GLOB_DAT:
    190180                case R_ARM_JUMP_SLOT:
    191                         DPRINTF("fixup R_ARM_GLOB_DAT/JUMP_SLOT (S)\n");
     181                case R_ARM_ABS32:
     182                        DPRINTF("fixup R_ARM_GLOB_DAT/JUMP_SLOT/ABS32 (S)\n");
    192183                        *r_ptr = sym_addr;
    193184                        break;
Note: See TracChangeset for help on using the changeset viewer.