Bug 3944 - identically named symbols overlap and break at runtime
Status: RESOLVED FIXED
Alias: None
Product: ioquake3
Classification: Unclassified
Component: Misc
Version: GIT MASTER
Hardware: PC Linux
: P3 normal
Assignee: Zachary J. Slater
QA Contact: ioquake3 bugzilla mailing list
URL:
Depends on:
Blocks:
 
Reported: 2009-01-21 13:03 EST by Pippijn van Steenhoven
Modified: 2009-09-14 21:46:12 EDT
1 user (show)

See Also:



Description Pippijn van Steenhoven 2009-01-21 13:03:56 EST
when using native code (vm_* = 0), the core loads qagame$platform.so (where $platform is i386 on my machine). this shared library contains the symbol bot_developer, which is an int, defined in game/ai_main.c.

the ioquake3 binary also contains a symbol with the same name, defined in botlib/be_interface.c and used to store a configuration variable. the dynamic loading overwrites references to the symbol and subsequent writes to the configuration variable occur in the wrong memory, overwriting the bot_developer int from "game" and 252 bytes after it. those bytes are part of "botimport", used to export symbols to botlib. an attempt to use a function from botimport (such as botimport.GetMemory) results in a segmentation fault or (depending on compile flags and the actual bytes written (usually '\0') an assertion failure)

a workaround is to enable the compiler flag -fvisibility=hidden to only export symbols that are explicitly marked with __attribute__ ((__visibility__ ((default))).

the real fix is probably to rename one of the symbols.
Comment 1 Ryan C. Gordon 2009-09-14 21:46:12 EDT
Fixed in svn revision #1607.

--ryan.