link problem--pci.h

Daron Chabot daron.chabot at usask.ca
Tue Sep 18 19:35:42 UTC 2007


I've hit the same bug discussed in this post to rtems-users:
	http://www.rtems.com/ml/rtems-users/2006/april/msg00076.html
I was compiling an application which links against rtems-4.7.1 (a modified version of Till's GeSys package)
when the problem was tripped.

Functions defined as "extern inline" in rtems/pci.h are being (I guess) excluded by a lack of optimization 
during compilation of those units using those functions (i believe "inline" is ignored unless optimization
is enabled). In my case, "if_dc.c" uses "extern inline int pci_read_config_dword()". However, since if_dc.c
is compiled without optimization, the requests in pci.h to inline "pci_xxx_config_xxx()" are ignored:
(snipped from the build of rtems)
	i386-rtems-gcc --pipe -B../../../lib/ -B../../../pc386/lib/ -specs bsp_specs -qrtems -DPACKAGE_NAME=\"rtems-c-src
\" -DPACKAGE_TARNAME=\"rtems-c-src\" -DPACKAGE_VERSION=\"4.7.1\" -DPACKAGE_STRING=\"rtems-c-src\ 4.7.1\" -DPACKAG
E_BUGREPORT=\"http://www.rtems.org/bugzilla\" -I. -I../../../../../rtems-4.7.1/c/src/libchip  -isystem ../../../p
c386/lib/include -D__INSIDE_RTEMS_BSD_TCPIP_STACK__  -Wall -g -MT network/libnetchip_a-if_dc.o -MD -MP -MF networ
k/.deps/libnetchip_a-if_dc.Tpo -c -o network/libnetchip_a-if_dc.o `test -f 'network/if_dc.c' || echo '../../../..
/../rtems-4.7.1/c/src/libchip/'`network/if_dc.c

At any rate, replacing "extern" with "static" relieves the problem (see patch in link above).

Note, I've only encountered this problem on a Scientific Linux (v4.x) box where the native compiler is gcc-3.4.4.
An identical setup on my macbook (which has gcc-4.0.1) produces *no errors*...  weird...

Software details:
rtems-4.7.1 (from cvs)
autoconf-2.60
gcc-g++-4.1.1
automake-1.10
gdb-6.5-rtems-20060713.diff
binutils-2.17-rtems4.7-20061021.diff
gdb-6.5
binutils-2.17
newlib-1.15.0-rtems4.7-20070208.diff
gcc-core-4.1.1-rtems4.7-20070102.diff
newlib-1.15.0
gcc-core-4.1.1

rtems configuration:
../rtems-4.7.1/configure --target=i386-rtems --prefix=/opt/rtems --enable-rdbg --enable-networking 
--enable-posix --enable-cxx --enable-rtemsbsp=pc386



-- dc




More information about the users mailing list