Presented by

  • Maciej W. Rozycki

    Maciej W. Rozycki

    Maciej has been into computer architectures since mid 1980s and worked with a number of them, such as Zilog Z80, Intel 8080 and x86, DEC Alpha and VAX, and ARM, MIPS, Power and RISC-V microprocessors, both in stand-alone and embedded computer systems. He has been involved with the Linux kernel since mid 1990s and has made numerous contributions to its various parts, mostly x86 and MIPS platform code and several drivers. His struggle with getting a modern version of the GNU C library running on a MIPS/Linux system has led to his involvement with the GNU toolchain since 2000. He has made many contributions to GCC, GNU binutils, GNU libc and GDB, and worked with various software and hardware teams on developing microprocessor instruction sets, software ABIs and hardware debug solutions. For several years he was also a MIPS port maintainer for GNU binutils and GDB. Ever since he discovered Linux and GNU Maciej has always been a strong supporter of the free software movement. Maciej is currently helping Western Digital with their RISC-V effort.


The RISC-V ISA provides PC-relative addressing, which means that with hardware equipped with an MMU that supports virtual memory addressing the ELF PIC psABI is straightforward and does not require the use of a dedicated GOT or global data pointer (GP) register in code intended for PIE executables or DSOs, because all static addresses can be worked out from the PC with the aid of a couple instructions. This is in particular because at load time virtual addresses of all loadable segments in an ELF PIC image are relocated by adding the same value (the base address in ELF-speak) to all of them, according to how the image has been mapped in virtual memory, which is the difference between the virtual addresses recorded in the file loaded and the corresponding actual addresses in memory, which in turn implies that the distance between the text segment and any other segment remains fixed. This approach does not work for NOMMU systems if we want to keep read-only text/rodata segments shared among processes, because there is no virtual addressing available to remap physical addresses such that for all the processes involved the text and other read-only segments occupy the same addresses while the corresponding read/write data segments are within a fixed distance from the text segment and do not clash with read/write data segments of another process both at a time. The problem can be solved, however it requires that read-only text/rodata segments and read/write data segments are mapped in memory independently of each other, and that in turn precludes the use of PC-relative addressing to reach data. Instead a register has to be set aside to hold the GP, unique to each of all the ELF images/modules (both the main executable and all the DSOs) loaded. This in turn not only requires extending the RISC-V psABI with GP-relative addressing, but defining a new convention for making function calls, such that if a call reaches into another ELF module the value of the GP is updated accordingly. This is handled by creating a data structure, called a function descriptor (the first letters of which contribute to the FD letters in the FDPIC acronym), that associates a value of the GP with each external (preemptible) function symbol. The function descriptor is then used in the code sequence used to make a function call modified such as to load both the GP and the PC with the addresses intended. The use of a GP register, the modified function calling convention, and the new data structures and definitions all comprise the FDPIC psABI. In this talk I am going to discuss a proposed design for the FDPIC psABI for RISC-V systems, and the changes required for the toolchain and the runtime to support it with the Linux/GNU system. Linux Australia: YouTube: