Error messages: /tmp/ccgtrVyI.o: In function `Color': /home/chromium/chromium/src/third_party/WebKit/WebCore/platform/ColorData.gperf:254: undefined reference to `findColor(char const*, unsigned int)' /home/chromium/chromium/src/third_party/WebKit/WebCore/platform/ColorData.gperf:254: undefined reference to `findColor(char const*, unsigned int)' collect2: ld returned 1 exit status Command line: g++ -O0 -g Color-stripped.ii Compiler build configuration: ../configure --prefix=/usr --enable-shared \ --enable-languages=c,c++,fortran,objc,obj-c++ \ --enable-threads=posix --mandir=/usr/share/man \ --infodir=/usr/share/info \ --enable-__cxa_atexit --disable-multilib --libdir=/usr/lib \ --libexecdir=/usr/lib --enable-clocale=gnu \ --disable-libstdcxx-pch \ --with-tune=generic The symbols resolve correctly if compiled with "-O1" or if "__attribute__ ((__gnu_inline__))" is removed from function definition.
Created attachment 18452 [details] Preprocessed test case.
That's correct. In C++ gnu_inline attribute always means the GNU C extern inline function, i.e. it is inlined if deemed desirable and otherwise you must provide an external definition of the function. If you don't do this, don't use gnu_inline attribute...
For clarity, a smaller test is: __inline __attribute__ ((gnu_inline)) void func () { } int main() { func(); return 0; } $ g++ foo.cpp /tmp/cc31L8fw.o: In function `main': foo.cpp:(.text+0x5): undefined reference to `func()' collect2: ld returned 1 exit status Most people who hit this bug are likely using gperf. $ gperf -N func . . . #ifdef __GNUC__ __inline #if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ __attribute__ ((__gnu_inline__)) #endif #endif const char * func (str, len) . . . $ gperf -N func -L C++ # will and avoid this bug :-) but also renames func to Perfect_Hash::func :-(
Same as comment 3, hopefully in pre tags this time. For clarity, a smaller test is: __inline __attribute__ ((gnu_inline)) void func () { } int main() { func(); return 0; } $ g++ foo.cpp /tmp/cc31L8fw.o: In function `main': foo.cpp:(.text+0x5): undefined reference to `func()' collect2: ld returned 1 exit status Most people who hit this bug are likely using gperf. $ gperf -N func . . . #ifdef __GNUC__ __inline #if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ __attribute__ ((__gnu_inline__)) #endif #endif const char * func (str, len) . . . $ gperf -N func -L C++ # will and avoid this bug :-) but also renames func to Perfect_Hash::func :-(