Bug 274056 - devel/libffi: fix build with lld 17 on i386
Summary: devel/libffi: fix build with lld 17 on i386
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: i386 Any
: --- Affects Some People
Assignee: Dimitry Andric
URL:
Keywords:
Depends on:
Blocks: 273753
  Show dependency treegraph
 
Reported: 2023-09-23 20:04 UTC by Dimitry Andric
Modified: 2023-09-25 05:56 UTC (History)
0 users

See Also:
kbowling: maintainer-feedback+


Attachments
devel/libffi: fix build with lld 17 on i386 (760 bytes, patch)
2023-09-23 20:07 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2023-09-23 20:04:08 UTC
As reported in bug 273753#c12, devel/libffi fails to link with lld 17, at least on i386:

libtool: link: cc -shared  -fPIC -DPIC  src/.libs/prep_cif.o src/.libs/types.o src/.libs/raw_api.o src/.libs/java_raw_api.o src/.libs/closures.o src/.libs/tramp.o src/x86/.libs/ffi.o src/x86/.libs/sysv.o    -O2 -fstack-protector-strong -Wl,--version-script -Wl,libffi.map -fstack-protector-strong   -Wl,-soname -Wl,libffi.so.8 -o .libs/libffi.so.8.1.2
ld: error: version script assignment of 'LIBFFI_BASE_8.0' to symbol 'ffi_java_raw_call' failed: symbol not defined
ld: error: version script assignment of 'LIBFFI_CLOSURE_8.0' to symbol 'ffi_prep_java_raw_closure' failed: symbol not defined
ld: error: version script assignment of 'LIBFFI_CLOSURE_8.0' to symbol 'ffi_prep_java_raw_closure_loc' failed: symbol not defined
cc: error: linker command failed with exit code 1 (use -v to see invocation)

This is because the symbols it complains about are not implemented on i386, due to the FFI_NATIVE_RAW_API define being nonzero.

Fix it by adding more #if statements to libffi.map.in.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2023-09-23 20:07:27 UTC
Created attachment 245173 [details]
devel/libffi: fix build with lld 17 on i386
Comment 2 commit-hook freebsd_committer freebsd_triage 2023-09-24 20:33:25 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0cff34eb46ae4c1bfc4a041c730524500a628986

commit 0cff34eb46ae4c1bfc4a041c730524500a628986
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-09-23 20:05:49 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2023-09-24 20:31:15 +0000

    devel/libffi: fix build with lld 17

    As reported in bug 273753#c12, devel/libffi fails to link with lld 17,
    at least on i386:

    libtool: link: cc -shared  -fPIC -DPIC  src/.libs/prep_cif.o src/.libs/types.o src/.libs/raw_api.o src/.libs/java_raw_api.o src/.libs/closures.o src/.libs/tramp.o src/x86/.libs/ffi.o src/x86/.libs/sysv.o    -O2 -fstack-protector-strong -Wl,--version-script -Wl,libffi.map -fstack-protector-strong   -Wl,-soname -Wl,libffi.so.8 -o .libs/libffi.so.8.1.2
    ld: error: version script assignment of 'LIBFFI_BASE_8.0' to symbol 'ffi_java_raw_call' failed: symbol not defined
    ld: error: version script assignment of 'LIBFFI_CLOSURE_8.0' to symbol 'ffi_prep_java_raw_closure' failed: symbol not defined
    ld: error: version script assignment of 'LIBFFI_CLOSURE_8.0' to symbol 'ffi_prep_java_raw_closure_loc' failed: symbol not defined
    cc: error: linker command failed with exit code 1 (use -v to see invocation)

    This is because the symbols it complains about are not implemented on
    i386, due to the FFI_NATIVE_RAW_API define being nonzero.

    Fix it by adding more #if statements to libffi.map.in.

    PR:             274056
    Approved by:    kbowling (maintainer)
    MFH:            2023Q3

 devel/libffi/files/patch-libffi.map.in (new) | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)