git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH/RFC v1 1/1] intialize false_but_the_compiler_does_not_know_it_

From
tboegi@web.de <tboegi@web.de>
Date
May 6, 2025, 12:06 UTC
Message-ID
<20250506120644.186968-1-tboegi@web.de>
In-Reply-To
<7efc9c9c-8187-4e10-bf9d-1cbb6aeac124@web.de>
From: Torsten Bögershausen <tboegi@web.de>
Compiling/linking 82e79c63642c on an older MacOs machine leads to this:
Undefined symbols for architecture x86_64:
  "_false_but_the_compiler_does_not_know_it_", referenced from:
      _start_command in libgit.a(run-command.o)

The linker doesn't seem to pick up the symbol: "false_but_the_compiler_does_not_know_it_"

Initializing the variable to 0 fixes the problem: The symbol type changes from 'C' to 'S' and is picked up by the linker.

Helped-by: Koji Nakamaru <koji.nakamaru@gree.net>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
---
 compiler-tricks/not-constant.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Koji Nakamaru: Thanks for the digging. This patch fixes the problem here - as a side note, the change in Makefile alone doesn't help.

diff --git a/compiler-tricks/not-constant.c b/compiler-tricks/not-constant.c
index 1da3ffc2f5..9fb4f275b1 100644
--- a/compiler-tricks/not-constant.c
+++ b/compiler-tricks/not-constant.c
@@ -1,2 +1,2 @@
 #include <git-compat-util.h>
-int false_but_the_compiler_does_not_know_it_;
+int false_but_the_compiler_does_not_know_it_ = 0;
-- 
2.39.5
Previous: Koji NakamaruNext: Junio C Hamano
Message 4 of 7 in “Problems with 82e79c63642c, NOT_CONSTANT with sigfillset()”
  1. Torsten BögershausenMay 4, 2025
  2. Junio C HamanoMay 5, 2025
  3. Koji NakamaruMay 6, 2025
  4. 1/1 intialize false_but_the_compiler_does_not_know_it_tboegi@web.de, May 6, 2025
  5. Junio C HamanoMay 6, 2025
  6. Koji NakamaruMay 7, 2025
  7. Junio C HamanoMay 7, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.