]> git.hungrycats.org Git - bees/commitdiff
test: link bench-bees-plan against the sectioned bees-util rebuild
authorZygo Blaxell <bees@furryterror.org>
Thu, 16 Jul 2026 15:18:48 +0000 (11:18 -0400)
committerZygo Blaxell <bees@furryterror.org>
Sat, 5 Sep 2026 04:04:14 +0000 (00:04 -0400)
bench-bees-plan links no bees-util object at all, so it never resolved the
BeesStats::s_global / add_count symbols that the instrumented
test-bees-plan-lib.o it shares with test-bees-plan references.  Link
test-bees-util-lib.o, the function-sectioned rebuild of bees-util.cc that
test-bees-plan already uses, so --gc-sections keeps only BeesStats here too.

Also drop the backslash line-continuations from bench-bees-plan.cc's build-
recipe comment: a '\' at the end of a // line is a multi-line comment that
gcc's -Wcomment rejects under -Werror.  Point the comment at `make
bench-bees-plan` instead of a stale hand-build command.

Assisted-by: Claude-Code:claude-opus-4-8
Assisted-by: Claude-Code:claude-opus-5
test/Makefile
test/bench-bees-plan.cc

index 0ad0781e1309204fd76984ec6fb07bbb7f1c0802..b8559a0b9590480edbe36bd76118285e4dbe5f01 100644 (file)
@@ -207,8 +207,10 @@ bench-bees-plan.dep: bench-bees-plan.cc ../makeflags Makefile
        $(CXX) $(BEES_CXXFLAGS) -I../src -M -MF $@ -MT bench-bees-plan.o $<
 -include bench-bees-plan.dep
 
-bench-bees-plan: bench-bees-plan.o test-bees-plan-lib.o ../makeflags Makefile ../lib/libcrucible.a
-       $(CXX) $(BEES_CXXFLAGS) $(SECTION_FLAGS) $(BEES_LDFLAGS) -Wl,--gc-sections -o $@ bench-bees-plan.o test-bees-plan-lib.o $(LIBS)
+# Links test-bees-util-lib.o for the same BEESCOUNT symbols test-bees-plan needs
+# (bench-bees-plan.o pulls the same instrumented test-bees-plan-lib.o).
+bench-bees-plan: bench-bees-plan.o test-bees-plan-lib.o test-bees-util-lib.o ../makeflags Makefile ../lib/libcrucible.a
+       $(CXX) $(BEES_CXXFLAGS) $(SECTION_FLAGS) $(BEES_LDFLAGS) -Wl,--gc-sections -o $@ bench-bees-plan.o test-bees-plan-lib.o test-bees-util-lib.o $(LIBS)
 
 $(REPL_TESTS): %: %.o $(REPL_OBJS) ../makeflags Makefile ../lib/libcrucible.a
        $(CXX) $(BEES_CXXFLAGS) $(BEES_LDFLAGS) -o $@ $< $(REPL_OBJS) $(LIBS)
index cdac752c1310e7287e47fbce49dd4e9fab9dd13a..c965207a2c3f3355d1b66258bd643b4b4cccecc6 100644 (file)
@@ -3,19 +3,15 @@
 // it exists to reproduce the CPU/memory scaling of the search on large,
 // heavily-overlapping match pools locally, without looping through bigtest.
 //
-// Build (from test/):
-//   make test-bees-plan-lib.o
-//   clang++ $(BEES_CXXFLAGS) -I../src -ffunction-sections -fdata-sections \
-//       -Wl,--gc-sections -o bench-bees-plan \
-//       bench-bees-plan.cc test-bees-plan-lib.o -L../lib -lcrucible -lpthread -latomic
-// (--gc-sections is required: test-bees-plan-lib.o is all of bees-plan.cc,
-//  which contains functions this bench never calls — CostReport's operator<<
-//  and BeesPlan::print (needing pretty(double) and BeesExtent::bytenr) and
-//  BeesCandidateQueue::pick_best_candidate (needing BeesExtent::phys_size) —
-//  that reference symbols this standalone link does not provide.  The section
-//  GC drops them because nothing reachable from main() calls them.)
+// Build (from test/): make bench-bees-plan
+// The Makefile links it against the function-sectioned test-bees-plan-lib.o and
+// test-bees-util-lib.o with --gc-sections, which drops the bees-plan.cc code this
+// bench never calls (CostReport's operator<<, BeesPlan::print, and
+// BeesCandidateQueue::pick_best_candidate — needing pretty(double) / BeesExtent
+// bytenr / phys_size) plus the unused rest of bees-util.cc, so the standalone
+// link resolves only what main() reaches.
 //
-// Usage: ./bench-bees-plan [num_matches] [region_blocks] [max_match_blocks] \
+// Usage: ./bench-bees-plan [num_matches] [region_blocks] [max_match_blocks]
 //                          [seed] [per-type-max] [total-max]
 
 #include "bees-plan.h"