Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Issue with LTO build of ei #5609

@saleyn

Description

@saleyn

Describe the bug
ei_* functions are reported as undefined by the linker when linking with libei.a.

This issue appears in some builds of the 24.2 release (presently reproduced in Arch Linux and macOS), where libei.a is getting built with LTO optimization that results in undefined ei_* symbols when linking with that library.

An illustration of this error can be found here.

Notably, when the OTP 24.2 is compiled locally from sources, this doesn't happen, but when the pre-built package is installed from the distribution of Arch/macOS, and the project containing a port program that depends on libei.a is built, undefined symbols are reported.

I believe it boils down to libei.a getting compiled with LTO, which is not something that happened in the releases prior to 24.2.

$ nm /usr/lib/erlang/lib/erl_interface-5.1/lib/libei.a | grep -B2 -A10 ei_connect
nm: ei_connect.o: plugin needed to handle lto object

ei_connect.o:
0000000000000001 C __gnu_lto_slim

ei_resolve.o:
0000000000000001 C __gnu_lto_slim

eirecv.o:
0000000000000001 C __gnu_lto_slim

send.o:
0000000000000001 C __gnu_lto_slim

Whereas a locally compiled 24.2 has a different output:

$ nm /opt/sw/erlang/24.2/lib/erlang/lib/erl_interface-5.1/lib/libei.a | grep ei_connect
ei_connect.o:
0000000000003050 T ei_connect
                 U ei_connect_ctx_t__
0000000000000a40 t ei_connect_helper
0000000000003110 T ei_connect_host_port
0000000000003080 T ei_connect_host_port_tmo
0000000000002e00 T ei_connect_init
0000000000000018 b ei_connect_initialized
0000000000002a50 T ei_connect_init_ussi
0000000000002ef0 T ei_connect_tmo
0000000000002a30 T ei_connect_xinit
0000000000002480 T ei_connect_xinit_ussi
                 U ei_connect_t__
0000000000000910 T ei_connect_ctx_t__
0000000000001360 T ei_connect_t__

Metadata

Metadata

Assignees

Labels

bugIssue is reported as a bugteam:VMAssigned to OTP team VM

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions