bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GNU ar on Solaris creates invalid archives in some cases


From: Bruno Haible
Subject: GNU ar on Solaris creates invalid archives in some cases
Date: Fri, 5 Nov 2004 16:43:18 +0100
User-agent: KMail/1.5

Hi,

This is hurting the gnulib project: GNU ar version 2.15, used on Solaris 7 or
Solaris 9, creates invalid .a files if there are no exported symbols.

Test case:

$ cat > hello.c
#include <stdio.h>
int main () { printf("Hello World\n"); return 0; }
$ gcc -c hello.c

$ gnu-ar --version
GNU ar 2.15
Copyright 2004 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.

$ cat > dummy.c
typedef int dummy;
$ gcc -c dummy.c
$ /bin/rm -f empty.a
$ gnu-ar cru empty.a dummy.o
$ /usr/ccs/bin/ld hello.o empty.a -lc -o a.out
ld: fatal: file empty.a: unknown type, unable to process using elf(3E) libraries
ld: fatal: File processing errors. No output written to a.out
$ echo $?
1

Test case that shows that there is no problem if the system's 'ar' is used:

$ cat > dummy.c
typedef int dummy;
$ gcc -c dummy.c
$ /bin/rm -f empty.a
$ /usr/ccs/bin/ar cru empty.a dummy.o
$ /usr/ccs/bin/ld hello.o empty.a -lc -o a.out
$ echo $?
0

Test case that shows that there is no problem if there are exported symbols:

$ cat > dummy.c
int dummy;
$ gcc -c dummy.c
$ /bin/rm -f empty.a
$ gnu-ar cru empty.a dummy.o
$ /usr/ccs/bin/ld hello.o empty.a -lc -o a.out
$ echo $?
0

Bruno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]