ercoppa Guru


Joined: 10 Dec 2005 Posts: 371 Location: roma
|
Posted: Fri May 07, 2010 1:22 pm Post subject: GlibC con -O0 |
|
|
Salve, per questioni universitarie, mi occorrerebbe avere le GlibC senza ottimizzazioni (quindi -O0), purtroppo se nel make.conf imposto:
Code: |
CFLAGS="-march=core2 -O0 -pipe"
CXXFLAGS="${CFLAGS}"
|
Eppure emerge mi flitra le mie impostazioni e impone in fase di compilazione (la march non è mi interessa):
Qualcuno mi sa dare qualche dritta su come poter intervenire?
EDIT:
Grazie ad alcune dritte ricevute in IRC, ho capito che la logico di filtraggio delle flags per le GlibC è specificata in /usr/portage/sys-libs/glibc/files/eblits/common.eblit. Spulciando questo file vi troviamo:
Code: |
# [b]Lock glibc at -O2 -- linuxthreads needs it and we want to be[/b]
# conservative here. -fno-strict-aliasing is to work around #155906
filter-flags -O?
append-flags -O2 -fno-strict-aliasing
|
Ed ovviamente il primo commento non è stato messo lì per caso
Volendo farsi del male e tentando comunque con O0, la compilazione fallisce con:
Code: |
/var/tmp/portage/sys-libs/glibc-2.10.1-r2/work/build-default-i686-pc-linux-gnu-nptl/config.h:3:3: error: #error "glibc cannot be compiled without optimization"
rm -f /var/tmp/portage/sys-libs/glibc-2.10.1-r2/work/build-default-i686-pc-linux-gnu-nptl/csu/abi-tag.h.new
sed -e 's/#.*$//' -e '/^[ ]*$/d' ../abi-tags | \
while read conf tagos tagver; do \
test `expr 'i686-pc-linux-gnu' \
: "$conf"` != 0 || continue; \
( echo "$tagos" | \
sed -e 's/[^0-9xXa-fA-F ]//' \
-e 's/^/#define __ABI_TAG_OS /'; \
echo "#ifndef __ABI_TAG_VERSION"; \
echo "$tagver" | \
sed -e 's/[^0-9xXa-fA-F]/ /g' -e 's/ *$//' \
-e 's/ /,/g' -e 's/^/# define __ABI_TAG_VERSION /'; \
echo "#endif" ) > /var/tmp/portage/sys-libs/glibc-2.10.1-r2/work/build-default-i686-pc-linux-gnu-nptl/csu/abi-tag.h.new; \
done
mv -f /var/tmp/portage/sys-libs/glibc-2.10.1-r2/work/build-default-i686-pc-linux-gnu-nptl/csu/version-info.hT /var/tmp/portage/sys-libs/glibc-2.10.1-r2/work/build-default-i686-pc-linux-gnu-nptl/csu/version-info.h
make[2]: *** [/var/tmp/portage/sys-libs/glibc-2.10.1-r2/work/build-default-i686-pc-linux-gnu-nptl/tcb-offsets.h] Error 1
make[2]: *** Waiting for unfinished jobs....
if test -r /var/tmp/portage/sys-libs/glibc-2.10.1-r2/work/build-default-i686-pc-linux-gnu-nptl/csu/abi-tag.h.new; then mv -f /var/tmp/portage/sys-libs/glibc-2.10.1-r2/work/build-default-i686-pc-linux-gnu-nptl/csu/abi-tag.h.new /var/tmp/portage/sys-libs/glibc-2.10.1-r2/work/build-default-i686-pc-linux-gnu-nptl/csu/abi-tag.h; \
else echo >&2 'This configuration not matched in ../abi-tags'; exit 1; fi
make[2]: *** [/var/tmp/portage/sys-libs/glibc-2.10.1-r2/work/build-default-i686-pc-linux-gnu-nptl/tlsdesc.h] Error 1
make[2]: Leaving directory `/var/tmp/portage/sys-libs/glibc-2.10.1-r2/work/glibc-2.10.1/csu'
make[1]: *** [csu/subdir_lib] Error 2
make[1]: Leaving directory `/var/tmp/portage/sys-libs/glibc-2.10.1-r2/work/glibc-2.10.1'
make: *** [all] Error 2
* ERROR: sys-libs/glibc-2.10.1-r2 failed:
* make for default failed
*
* Call stack:
* ebuild.sh, line 54: Called src_compile
* environment, line 3804: Called eblit-run 'src_compile'
* environment, line 1234: Called eblit-glibc-src_compile
* src_compile.eblit, line 207: Called toolchain-glibc_src_compile
* src_compile.eblit, line 123: Called die
* The specific snippet of code:
* make PARALLELMFLAGS="${MAKEOPTS}" || die "make for ${ABI} failed"
*
* If you need support, post the output of 'emerge --info =sys-libs/glibc-2.10.1-r2',
* the complete build log and the output of 'emerge -pqv =sys-libs/glibc-2.10.1-r2'.
* This ebuild is from an overlay: '/usr/local/portage/'
* The complete build log is located at '/var/tmp/portage/sys-libs/glibc-2.10.1-r2/temp/build.log'.
* The ebuild environment file is located at '/var/tmp/portage/sys-libs/glibc-2.10.1-r2/temp/environment'.
* S: '/var/tmp/portage/sys-libs/glibc-2.10.1-r2/work/glibc-2.10.1'
|
So che sto potrei farmi molto male ma avete qualche suggerimento?
EDIT2:
Questo mi annulla ogni possibilità:
Quote: |
1.23. Why do I get:
`#error "glibc cannot be compiled without optimization"',
when trying to compile GNU libc with GNU CC?
{AJ,CO} There are a couple of reasons why the GNU C library will not work
correctly if it is not complied with optimzation.
In the early startup of the dynamic loader (_dl_start), before
relocation of the PLT, you cannot make function calls. You must inline
the functions you will use during early startup, or call compiler
builtins (__builtin_*).
Without optimizations enabled GNU CC will not inline functions. The
early startup of the dynamic loader will make function calls via an
unrelocated PLT and crash.
Without auditing the dynamic linker code it would be difficult to remove
this requirement.
Another reason is that nested functions must be inlined in many cases to
avoid executable stacks.
In practice there is no reason to compile without optimizations, therefore
we require that GNU libc be compiled with optimizations enabled.
|
(preso dai sorgenti delle GlibC)
Grazie in anticipo, saluti. |
|