Mail Archives: djgpp/2015/07/19/03:57:20
On 07/19/2015 09:49 AM, Ozkan Sezer (sezeroz AT gmail DOT com) [via djgpp AT delorie DOT com] wrote:
> On 7/18/15, Andris Pavenis (andris DOT pavenis AT iki DOT fi) [via
> djgpp-announce AT delorie DOT com] <djgpp-announce AT delorie DOT com> wrote:
>> This is announcement of GCC-5.2.0, GCC-4.9.3, GCC-4.8.5, GCC-4.7.4 and
>> GCC-3.4.6 for DJGPP v2.05
>>
> Thanks.
>
> Although it looks funny that gcc-3.4.6 is link with a libc built with
> gcc-4.7.3 :)
> Can we rebuild 2.05 from latest v2_05_1 branch with gcc-3.4.6 so it'd be
> most compatible?
>
> --
> O.S.
>
Yes I built libc with gcc-4.7. gcc-4.7 has been around longer than gcc-5 and I wanted to avoid
hidden problems.
One example (not really very hidden) that I had to workaround was that calloc() was mis-compiled to
infinite
tail recursion (see example below). I work-arounded that by specifying additional GCC command line
option for nmalloc.
I'm not however completely sure that there are no other better hidden problems.
There should be no problems with C when libc is built with gcc-4.7
C++ or Ada would be other topic, but fortunately libc uses neither of them.
Also many Linux distributions includes also gcc-3.4.6 for compatibility purposes (when some old
software does not build with current GCC).
That does not however be reason for libc being built with gcc-3.4.6
Andris
Konsole output
[andris AT ap 7]$ i586-pc-msdosdjgpp-gcc -v
Using built-in specs.
COLLECT_GCC=i586-pc-msdosdjgpp-gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i586-pc-msdosdjgpp/5.2.0/lto-wrapper
Target: i586-pc-msdosdjgpp
Configured with: ../gnu/gcc-5.20/configure --build=x86_64-redhat-linux-gnu
--host=x86_64-redhat-linux-gnu --target=i586-pc-msdosdjgpp --program-pref
ix=i586-pc-msdosdjgpp- --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin
--sysconfdir=/etc --datadir=/usr/share --includedir=/u
sr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var
--sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share
/info --disable-nls --disable-plugin --disable-lto --enable-libquadmath-support --enable-lto
--with-gmp=/home/andris/rpm_root/BUILD/djcross-gcc-5.2.
0/tmpinst --with-mpfr=/home/andris/rpm_root/BUILD/djcross-gcc-5.2.0/tmpinst
--with-mpc=/home/andris/rpm_root/BUILD/djcross-gcc-5.2.0/tmpinst --enabl
e-version-specific-runtime-libs --enable-languages=c,c++,f95,objc,obj-c++,ada
Thread model: single
gcc version 5.2.0 (GCC)
[andris AT ap 7]$ cat calloc.c
#include <stdlib.h>
#include <string.h>
void *calloc(size_t n, size_t len)
{
void *ptr = malloc(n*len);
if (ptr) {
memset(ptr, 0, n*len);
}
return ptr;
}
[andris AT ap 7]$ i586-pc-msdosdjgpp-gcc -O2 -Wall -S calloc.c -o -
.file "calloc.c"
.section .text.unlikely,"x"
LCOLDB0:
.section .text
LHOTB0:
.p2align 4,,15
.globl _calloc
_calloc:
LFB0:
.cfi_startproc
movl 8(%esp), %eax
movl 4(%esp), %edx
imull %edx, %eax
movl $1, 8(%esp)
movl %eax, 4(%esp)
jmp _calloc
.cfi_endproc
LFE0:
.section .text.unlikely,"x"
LCOLDE0:
.section .text
LHOTE0:
.ident "GCC: (GNU) 5.2.0"
- Raw text -