trafficserver icon indicating copy to clipboard operation
trafficserver copied to clipboard

Why are we linking libtsutil.a into all the core plugins?

Open ywkaras opened this issue 1 year ago • 3 comments

https://github.com/apache/trafficserver/blob/33b795f107b13471a6f4dc62da3669d3acf47ca2/cmake/add_atsplugin.cmake#L22

Could we create both libtsutil.a and libtsutil_link_dummy.so, both with the same contents? Link plugins against the dummy, and only liink traffic_server ELF with libtsutil.a? (libtsutil_link_dummy.so would be an installed library for use when linking non-core plugins.)

ywkaras avatar Feb 02 '24 03:02 ywkaras

Hmmm yeh why ? This seems like it’d make each binary unnecessarily large too ? Indont know about the dummy thing but this seems bad regardless.

Why would plugins need either ? The symbols are in the core.

zwoop avatar Feb 02 '24 03:02 zwoop

Hmmm yeh why ? This seems like it’d make each binary unnecessarily large too ? Indont know about the dummy thing but this seems bad regardless.

Why would plugins need either ? The symbols are in the core.

Jason may fatally face-palm if he sees this. It really is helpful to detect what will be load problems due to missing symbols at link time. If we link against the dummy .so, rather than the .a that will be linked into the core executable, the object code will not be pulled into the plugin .so.

ywkaras avatar Feb 02 '24 05:02 ywkaras

For detecting load problems at build-time, consider this approach instead of complicated linker gymnastics: #11008

https://github.com/apache/trafficserver/pull/11008/files#diff-d76a50ed90f4f3c3cc59631b9348502788e6b29d38f35594880f315e7e517b58R66-R76

cmcfarlen avatar Feb 05 '24 14:02 cmcfarlen

I guess this is fixed/moot now.

ywkaras avatar Jun 11 '24 00:06 ywkaras