buglibffcall - foreign function call libraries - Bugs: bug #62422, vacall test fails with PIE-enabled...

 
 

bug #62422: vacall test fails with PIE-enabled GCC on RISC-V systems

Submitter:  Raymond Wong <infiwang>
Submitted:  Fri 06 May 2022 12:22:19 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  haible
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 08 May 2022 01:57:02 PM UTC, comment #2: 

With this tarball, all the tests would pass on my system now. Thanks!

Raymond Wong <infiwang>
Sun 08 May 2022 12:29:28 PM UTC, comment #1: 

Thanks for the report.

> by appending "-no-pie" flag in makefile


This wouldn't solve the problem when the library is being used in an executable that is being built with -fpie.

> changing %hi/%lo pairs to %pcrel_hi/%pcrel_lo


I don't know enough about RISC-V. I thought that transforming non-PIC to PIC code implied replacing one instruction

  lui a5,addr

with two instructions

  auipc a5,addr@got
  ld a5,0(a5)

> adding PIC support by mimicking arm/armhf change from the 2.1 release


A good idea; thanks! I'm taking this approach. Please try this tarball:
https://alpha.gnu.org/gnu/libffcall/libffcall-2.4-20220508.tar.gz

Bruno Haible <haible>
Group administrator
Fri 06 May 2022 12:22:19 PM UTC, original submission:  

Hi, I'm working on keywording libffcall for Gentoo Linux RISC-V. I'm working on libffcall-2.4, my environment is Gentoo Linux RISC-V with lp64d profile on a HiFive Unmatched, GCC 11.3.0.
The build.log was from Gentoo's portage system. I've checked that build from source also has the same output.
When I follow README to build and test from source, make check would always fail on vacall, as ld complains that it cannot relocate R_RISCV64_HI20 when making a shared object.
I've done some troubleshooting, it seems that Gentoo Linux has GCC PIC/PIE enabled by default. I can make it pass all the tests by appending "-no-pie" flag in makefile, changing %hi/%lo pairs to %pcrel_hi/%pcrel_lo, or adding PIC support by mimicking arm/armhf change from the 2.1 release.

Raymond Wong <infiwang>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #53179:  build.log added by infiwang (73KiB - text/x-log)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by haible (Posted a comment)
  • -email is unavailable- added by infiwang (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-05-08 haible StatusNone Fixed
        Assigned toNone haible
        Open/ClosedOpen Closed
    2022-05-06 infiwang Attached File- Added build.log, #53179

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code