[NetBSD-PR lib/46163] netbsd-6 build broken at tests/lib/libobjc
see detail: http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=46163
if libobjc is built with -g(=debug) option + -stdc={c99,gnu99} some inline function(objc_read_* etc) become missing undefined symbol.
- gcc always erase inline function body.
- but gcc don't expand inline function into caller.
- so inline function become undefined symbol
Comments (6)
-
reporter -
reporter $ gcc --version gcc (NetBSD nb2 20110806) 4.5.3 Copyright (C) 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
reporter i confirmed gcc 4.8.2(CentOS7) still have same problem.
-
reporter ISO/IEC9899:1999 says that if you want export the symbol and exand inline same time, decrate following prototype:
extern void foo(void); inline void foo() { ... }
or if you want only expand inline function, use static inline:
static inline void foo() { ... }
but libobjc's code don't have extern prototype or static inline decls. it is bad behavior.
-
reporter i believe following function in archive.c is not public API because these were not defined in objc.h.
__objc_read_nbyte_uint __objc_read_nbyte_ulong __objc_write_class __objc_write_object __objc_write_selector objc_read_char objc_read_int objc_read_long objc_read_selector objc_read_short objc_read_string objc_read_unsigned_char objc_read_unsigned_int objc_read_unsigned_long objc_read_unsigned_short objc_write_char objc_write_int objc_write_long objc_write_selector objc_write_short objc_write_string objc_write_string_atomic objc_write_unsigned_char objc_write_unsigned_int objc_write_unsigned_long objc_write_unsigned_short
so that simply change inline -> static inline.
following function in sendmsg.c too.
__objc_get_forward_imp
be aware, recent gcc applied following patch:
https://patchwork.ozlabs.org/patch/433574/
they revive __objc_get_forward_imp symbol. but i don't think it is not nessesary expect get_imp() ABI.
-
reporter - changed status to resolved
BUGFIX: Issue
#102- [NetBSD-PR lib/46163] netbsd-6 build broken at tests/lib/libobjc.→ <<cset 1aca6e490182>>
- Log in to comment
minimal case is:
compile and check symbol:
if -O2 is specified, foo() is expaned as inline.
but if -g is specified, foo() is not expaned so it become undefined symbol.