https://gcc.gnu.org/g:2adb8c48c91775ca722ad22a9f34832ee83a681a
commit r17-6086-g2adb8c48c91775ca722ad22a9f34832ee83a681a Author: Shiva S <[email protected]> Date: Mon Nov 9 23:07:38 2026 -0700 [PATCH] Link hwint.o into the generator programs and libcommon When the host compiler is not GCC (GCC_VERSION < 3004), hwint.h declares floor_log2, exact_log2 and related functions out of line instead of defining them inline. Generators that use vec.o and objects in libcommon then fail to link because hwint.o is only part of OBJS. --- Bootstrapped and regression-tested on x86_64-pc-linux-gnu and aarch64-unknown-linux-gnu. I do not have write access; please commit if approved. gcc/ChangeLog: * hwint.cc: Include bconfig.h for generator files. * Makefile.in (BUILD_RTL): Add build/hwint.o. (OBJS): Move hwint.o from here... (OBJS-libcommon): ...to here. (build/hwint.o): New rule. (build/gencfn-macros, build/genmatch): Depend on build/hwint.o. Signed-off-by: Shiva <[email protected]> Diff: --- gcc/Makefile.in | 10 +++++----- gcc/hwint.cc | 7 +++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 8fa0b552509c..df16b891b62f 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1195,7 +1195,7 @@ BUILD_LIBS = $(BUILD_LIBIBERTY) BUILD_RTL = build/rtl.o build/read-rtl.o build/ggc-none.o \ build/vec.o build/min-insn-modes.o build/gensupport.o \ - build/print-rtl.o build/hash-table.o build/sort.o + build/print-rtl.o build/hash-table.o build/sort.o build/hwint.o BUILD_MD = build/read-md.o BUILD_ERRORS = build/errors.o @@ -1583,7 +1583,6 @@ OBJS = \ hash-map-tests.o \ hash-set-tests.o \ hw-doloop.o \ - hwint.o \ ifcvt.o \ ree.o \ inchash.o \ @@ -1926,7 +1925,7 @@ OBJS-libcommon = \ pub-sub.o \ xml.o \ sbitmap.o \ - vec.o input.o hash-table.o ggc-none.o memory-block.o \ + vec.o input.o hash-table.o ggc-none.o memory-block.o hwint.o \ selftest.o sort.o \ selftest-json.o \ text-art/box-drawing.o \ @@ -3282,6 +3281,7 @@ build/vec.o : vec.cc $(BCONFIG_H) $(SYSTEM_H) $(CORETYPES_H) $(VEC_H) \ build/hash-table.o : hash-table.cc $(BCONFIG_H) $(SYSTEM_H) \ $(CORETYPES_H) $(HASH_TABLE_H) $(GGC_H) toplev.h $(DIAGNOSTIC_CORE_H) build/sort.o : sort.cc $(BCONFIG_H) $(SYSTEM_H) +build/hwint.o : hwint.cc $(BCONFIG_H) $(SYSTEM_H) $(CORETYPES_H) build/inchash.o : inchash.cc $(BCONFIG_H) $(SYSTEM_H) $(CORETYPES_H) \ $(HASHTAB_H) inchash.h build/gencondmd.o : build/gencondmd.cc $(BCONFIG_H) $(SYSTEM_H) \ @@ -3423,7 +3423,7 @@ build/genautomata$(build_exeext) : BUILD_LIBS += -lm build/genrecog$(build_exeext) : build/hash-table.o build/inchash.o build/gencfn-macros$(build_exeext) : build/hash-table.o build/vec.o \ - build/ggc-none.o build/sort.o + build/ggc-none.o build/sort.o build/hwint.o # For stage1 and when cross-compiling use the build libcpp which is # built with NLS disabled. For stage2+ use the host library and @@ -3438,7 +3438,7 @@ build/genmatch.o: BUILD_CPPFLAGS += -DGENMATCH_SELFTESTS endif build/genmatch$(build_exeext) : $(BUILD_CPPLIB) \ - $(BUILD_ERRORS) build/vec.o build/hash-table.o build/sort.o + $(BUILD_ERRORS) build/vec.o build/hash-table.o build/sort.o build/hwint.o # These programs are not linked with the MD reader. build/gengtype$(build_exeext) : build/gengtype-lex.o build/gengtype-parse.o \ diff --git a/gcc/hwint.cc b/gcc/hwint.cc index d89be33f6362..0222b4139f76 100644 --- a/gcc/hwint.cc +++ b/gcc/hwint.cc @@ -17,7 +17,14 @@ You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ +/* This file is compiled twice: once for the generator programs + once for the compiler. */ +#ifdef GENERATOR_FILE +#include "bconfig.h" +#else #include "config.h" +#endif + #include "system.h" #include "coretypes.h"
