calling from one libfoo.a to another

travis@subspacefield.org travis@subspacefield.org
Wed Mar 10 22:16:00 GMT 2010


On Wed, Mar 10, 2010 at 02:07:03PM -0800, Brian Budge wrote:
> I'm not sure I understand.  I believe that in the past I've done what
> you're talking about without issues.  Do you have a minimal example?

What follows is a minimal example of what I'm trying to do.
Problem is, on my test system,
gcc version 4.2.1 (Apple Inc. build 5646) (dot 1)
it works.  On my target system, an embedded system that I'm targetting
with a cross-compiling gcc 3.x, and emulating, it fails.
My co-worker is reporting on his system that it is segfaulting, and that
may well be what's happening on the embedded/emulated system.  I know
that's a little vague, but the target system is very complex and
I'm still learning it.  Troubleshooting is painful...  at this point
I'm inferring errors from log files, as opposed to debugging with gdb
as I would normally.

14:03:41 travis@sevenheavens 2 0 bash$ cat main.c
int main () {
  weakcall();
}
14:07:53 travis@sevenheavens 2 0 bash$ cat call.c
extern void weak() __attribute__ ((weak));

void weakcall () { weak(); }
14:07:59 travis@sevenheavens 2 0 bash$ cat weak.c
#include <stdio.h>

void weak() { printf("hi\n"); }
14:08:01 travis@sevenheavens 2 0 bash$ cat Makefile 
#! /usr/bin/make -f

all: main.o weak.o
        gcc main.o foo.o

libweak.a: weak.o
        ar -rcs libweak.a weak.o

libcall.a: call.o
        ar -rcs libcall.a call.o

.PHONY: lib
lib: libweak.a libcall.a main.o
        gcc main.o -L. -lweak -lcall

.PHONY: clean
clean:
        rm *.a *.o a.out
-- 
A Weapon of Mass Construction
My emails do not have attachments; it's a digital signature that your mail
program doesn't understand. | http://www.subspacefield.org/~travis/ 
If you are a spammer, please email john@subspacefield.org to get blacklisted.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20100310/f434c8da/attachment.sig>


More information about the Gcc-help mailing list