Bug 40641 - gcc-4.4.0 does not honor the alway_inline attribute when using -Os
Summary: gcc-4.4.0 does not honor the alway_inline attribute when using -Os
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-03 16:15 UTC by Florian Fainelli
Modified: 2009-09-26 17:59 UTC (History)
1 user (show)

See Also:
Host: i486-linux-gnu-
Target: mips-openwrt-linux-uclibc
Build: i486-linux-gnu-
Known to work:
Known to fail:
Last reconfirmed:


Attachments
ldso.Os.i preprocessed file (20.59 KB, text/x-csrc)
2009-07-03 16:16 UTC, Florian Fainelli
Details
ldso.Os.i preprocessed file with non-inlined syscalls (20.59 KB, text/x-csrc)
2009-08-04 08:58 UTC, Florian Fainelli
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Fainelli 2009-07-03 16:15:28 UTC
This is a bug report from an OpenWrt user that I have also noticed myself.
uClibc requires its syscalls to be inlined and therefore the attribute
always_inline was added to ensure inlining.

When gcc is called with -Os the always_inline attribute is not honored,
resulting in a non working uClibc ldso. Please find the environmnet below.

This is probably related to the regression closed here:

System type: Debian testing compiling OpenWrt trunk 16656
GCC configuration: Using built-in specs.
Target: mips-openwrt-linux-uclibc
Configured with: /home/florian/dev/openwrt/trunk/build_dir/toolchain-mips_gcc-4.4.0_uClibc-0.9.30.1/gcc-4.4.0/configure --prefix=/home/florian/dev/openwrt/trunk/staging_dir/toolchain-mips_gcc-4.4.0_uClibc-0.9.30.1/usr --build=i486-linux-gnu --host=i486-linux-gnu --target=mips-openwrt-linux-uclibc --with-gnu-ld --enable-target-optspace --disable-libgomp --disable-libmudflap --disable-multilib --disable-nls --with-float=soft --with-gmp=/home/florian/dev/openwrt/trunk/staging_dir/host --with-mpfr=/home/florian/dev/openwrt/trunk/staging_dir/host --disable-decimal-float --disable-libssp --disable-__cxa_atexit --enable-languages=c --enable-shared --enable-threads --disable-tls --with-slibdir=/home/florian/dev/openwrt/trunk/staging_dir/toolchain-mips_gcc-4.4.0_uClibc-0.9.30.1/lib
Thread model: posix
gcc version 4.4.0 (GCC)

Compiler output:
mips-openwrt-linux-uclibc-gcc -c ldso/ldso/ldso.c -o ldso/ldso/ldso.oS -include ./include/libc-symbols.h -Wall -Wstrict-prototypes -fno-strict-aliasing -Os -march=octeon -pipe -funit-at-a-time -fhonour-copts -msoft-float -fno-stack-protector -fno-builtin -nostdinc -I./include -I. -I./libc/sysdeps/linux/mips -fno-asm -msoft-float -DUCLIBC_INTERNAL -std=gnu99 -Os -funit-at-a-time -fno-tree-loop-optimize -fno-tree-dominator-opts -fno-strength-reduce -mno-split-addresses -I./libpthread/linuxthreads.old/sysdeps/unix/sysv/linux/mips -I./libpthread/linuxthreads.old/sysdeps/mips -I./libpthread/linuxthreads.old/sysdeps/unix/sysv/linux -I./libpthread/linuxthreads.old/sysdeps/pthread -I./libpthread/linuxthreads.old -I./libpthread -I/home/florian/dev/openwrt/trunk/build_dir/toolchain-mips_gcc-4.4.0_uClibc-0.9.30.1/linux-dev/usr/include/ -I/home/florian/dev/openwrt/trunk/staging_dir/toolchain-mips_gcc-4.4.0_uClibc-0.9.30.1/usr/lib/gcc/mips-openwrt-linux-uclibc/4.4.0//include-fixed -I/home/florian/dev/openwrt/trunk/staging_dir/toolchain-mips_gcc-4.4.0_uClibc-0.9.30.1/usr/lib/gcc/mips-openwrt-linux-uclibc/4.4.0/include -DNDEBUG -mno-split-addresses -fPIC -DSHARED -DNOT_IN_libc -DIS_IN_rtld -fno-stack-protector -E -fno-omit-frame-pointer -I./ldso/ldso/mips -I./ldso/include -I./ldso/ldso -DUCLIBC_RUNTIME_PREFIX="/" -DUCLIBC_LDSO="ld-uClibc.so.0" -DLDSO_ELFINTERP="mips/elfinterp.c" -DNOT_IN_libc -DIS_IN_rtld -fno-stack-protector -E -fno-omit-frame-pointer -I./ldso/ldso/mips -I./ldso/include -I./ldso/ldso -DUCLIBC_RUNTIME_PREFIX="/" -DUCLIBC_LDSO="ld-uClibc.so.0" -MT ldso/ldso/ldso.oS -MD -MP -MF ldso/ldso/.ldso.oS.dep
mips-openwrt-linux-uclibc-gcc -c ldso/ldso/mips/resolve.S -o ldso/ldso/mips/resolve.oS -include ./include/libc-symbols.h -Wall -Wstrict-prototypes -fno-strict-aliasing -Os -march=octeon -pipe -funit-at-a-time -fhonour-copts -msoft-float -fno-stack-protector -fno-builtin -nostdinc -I./include -I. -I./libc/sysdeps/linux/mips -fno-asm -msoft-float -DUCLIBC_INTERNAL -Os -funit-at-a-time -fno-tree-loop-optimize -fno-tree-dominator-opts -fno-strength-reduce -mno-split-addresses -I./libpthread/linuxthreads.old/sysdeps/unix/sysv/linux/mips -I./libpthread/linuxthreads.old/sysdeps/mips -I./libpthread/linuxthreads.old/sysdeps/unix/sysv/linux -I./libpthread/linuxthreads.old/sysdeps/pthread -I./libpthread/linuxthreads.old -I./libpthread -I/home/florian/dev/openwrt/trunk/build_dir/toolchain-mips_gcc-4.4.0_uClibc-0.9.30.1/linux-dev/usr/include/ -I/home/florian/dev/openwrt/trunk/staging_dir/toolchain-mips_gcc-4.4.0_uClibc-0.9.30.1/usr/lib/gcc/mips-openwrt-linux-uclibc/4.4.0//include-fixed -I/home/florian/dev/openwrt/trunk/staging_dir/toolchain-mips_gcc-4.4.0_uClibc-0.9.30.1/usr/lib/gcc/mips-openwrt-linux-uclibc/4.4.0/include -DNDEBUG -mno-split-addresses -fPIC -DSHARED -DNOT_IN_libc -DIS_IN_rtld -fno-stack-protector -E -fno-omit-frame-pointer -I./ldso/ldso/mips -I./ldso/include -I./ldso/ldso -DUCLIBC_RUNTIME_PREFIX="/" -DUCLIBC_LDSO="ld-uClibc.so.0" -MT ldso/ldso/mips/resolve.oS -MD -MP -MF ldso/ldso/mips/.resolve.oS.dep -D__ASSEMBLER__ -Wa,--noexecstack
Comment 1 Florian Fainelli 2009-07-03 16:16:24 UTC
Created attachment 18136 [details]
ldso.Os.i preprocessed file

This file is the preprocessed file which causes problems.
Comment 2 Richard Biener 2009-07-03 17:24:29 UTC
Does -fno-ipa-cp fix it?
Comment 3 Richard Biener 2009-07-03 17:32:57 UTC
Btw, with a cross I cannot seem to reproduce the problem.  How do non-inlined
calls look like with mips?
Comment 4 Florian Fainelli 2009-07-06 10:38:58 UTC
(In reply to comment #2)
> Does -fno-ipa-cp fix it?
> 

Unfortunately, no the problem is still there event with -fno-ipa-cp.
Comment 5 Florian Fainelli 2009-07-06 10:39:26 UTC
(In reply to comment #3)
> Btw, with a cross I cannot seem to reproduce the problem.  How do non-inlined
> calls look like with mips?
> 

Let me attach a file showing how it looks like.
Comment 6 Florian Fainelli 2009-08-04 08:58:16 UTC
Created attachment 18295 [details]
ldso.Os.i preprocessed file with non-inlined syscalls
Comment 7 Florian Fainelli 2009-09-09 15:04:57 UTC
Ping ? Anything else I should provide ? The bug is still present with gcc-4.4.1
Comment 8 Florian Fainelli 2009-09-26 17:59:18 UTC
(In reply to comment #7)
> Ping ? Anything else I should provide ? The bug is still present with gcc-4.4.1
> 

The bug is now solved with Dan's uClibc patch to prevent some registers to be clobberd in syscalls.(In reply to comment #7)
> Ping ? Anything else I should provide ? The bug is still present with gcc-4.4.1
> 

The bug is fixed with the following patch : http://lists.uclibc.org/pipermail/uclibc/2009-September/043020.html