phongn opened a new pull request, #13797:
URL: https://github.com/apache/trafficserver/pull/13797

   `esicore` deliberately leaves `ts::tsutil` off its link line so that 
`esi.so` and `combo_handler.so` don't embed their own copy of tsutil (see 
`plugins/esi/lib/CMakeLists.txt`). Each ESI test was therefore expected to link 
`ts::tsutil` itself, but `test_gzip`, `test_utils` and 
`test_combo_handler_utils` don't.
   
   With GNU ld and lld this stays hidden, because those tests never pull in the 
`esicore` members that use tsutil. mold does: for `test_gzip` it extracts 
`EsiProcessor.cc.o` from `libesicore.a` (which holds a weak copy of an inline 
`std::string` member that `libswoc.so` references). That drags in 
`IncludeUrlValidator.cc.o` and its `Regex` references:
   
   ```
   mold: error: undefined symbol: Regex::compile(std::basic_string_view<char, 
std::char_traits<char> >, std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> >&, int&, unsigned int)
   >>> referenced by IncludeUrlValidator.cc
   >>>               
plugins/esi/lib/libesicore.a(IncludeUrlValidator.cc.o):(EsiLib::IncludeUrlValidator::setHostAllowRegex(...))
   ```
   
   This change links `ts::tsutil` once, from `esitest`. Every ESI test links 
`esitest`, and it is never part of a plugin. The now-redundant per-test 
`ts::tsutil` entries are removed. The plugin link lines are unchanged.
   
   Testing (AlmaLinux 9, gcc 11.5, `dev` preset):
   - Unpatched master with mold 2.40.4 (`-B/usr/libexec/mold`): `test_gzip`, 
`test_utils` and `test_combo_handler_utils` fail to link.
   - With this change, all 8 ESI test binaries plus `esi.so` and 
`combo_handler.so` build, and the tests pass, with each of mold 2.40.4, lld 
21.1.8 and GNU ld 2.35.2.
   - `esi.so` still has no tsutil on its link line.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to