On 27 July 2012 22:36, Martin Sucha <[email protected]> wrote: >> > According to ELF specification, an undefined weak symbol does not >> > generate an error message, but is instead set to zero. This could make >> > debugging harder if you forget about it (a run-time error instead of >> > link-time error). >> >> I don't know what exactly you are referring to. When resolving a >> reference, it doesn't matter if the symbol is weak or not (except when >> there are multiple definitions). GCC does issue an error if it can't >> create an alias you want it to create. > > I'm referring to [1], page 24: >> When the link editor searches archive libraries, it extracts archive members >> that contain definitions of undefined global symbols. The member’s definition >> may be either a global or a weak symbol. The link editor does not extract >> archive members to resolve undefined weak symbols. Unresolved weak symbols >> have a zero value. > > and [2]: >> An _undefined_ weak symbol will not cause the linker to error out if a >> definition is not found. Instead, the symbol will be filled in with a default >> value of 0. > > [1] http://www.skyfree.org/linux/references/ELF_Format.pdf > [2] http://blog.omega-prime.co.uk/?p=121#linux > > But this may not affect the result if the object files are structured in a way > you described above, I just pointed this out as I found it when looking up > some info about weak symbols. >
I see. For what I have in mind, alias and its target would be defined in the same object file (using a GNU C extension), so this peculiarity wouldn't affect us. _______________________________________________ HelenOS-devel mailing list [email protected] http://lists.modry.cz/cgi-bin/listinfo/helenos-devel
