❦ 30 mai 2013 14:17 CEST, Julian Taylor <jtaylor.deb...@googlemail.com> :

> stud fails to build with ld --as-needed.
> With --as-needed libraries need to be placed before objects needing
> their symbols.
>
> Attached patch fixes the issue.

Hi Julian!

Thanks for the patch. I am concerned about the part on libebtree:

> --- a/ebtree/Makefile
> +++ b/ebtree/Makefile
> @@ -1,6 +1,7 @@
>  OBJS = ebtree.o eb32tree.o eb64tree.o ebmbtree.o ebsttree.o ebimtree.o 
> ebistree.o
>  CFLAGS = -O3
>  EXAMPLES = $(basename $(wildcard examples/*.c))
> +LIBS    = -lssl -lcrypto -lev
>  
>  all: libebtree.a
>  
> @@ -10,15 +11,15 @@ libebtree.a: $(OBJS)
>       $(AR) rv $@ $^
>  
>  %.o: %.c
> -     $(CC) $(CFLAGS) -o $@ -c $^
> +     $(CC) $(CFLAGS) -o $@ -c $^ $(LIBS)

When building .o, there is no linker involved, so no need to specify
LIBS, right?
>  
>  examples/%: examples/%.c libebtree.a
> -     $(CC) $(CFLAGS) -I. -o $@ $< -L. -lebtree
> +     $(CC) $(CFLAGS) -I. -o $@ $< -L. -lebtree $(LIBS)
>  
>  test: test32 test64 testst
>  
>  test%: test%.c libebtree.a
> -     $(CC) $(CFLAGS) -o $@ $< -L. -lebtree
> +     $(CC) $(CFLAGS) -o $@ $< -L. -lebtree $(LIBS)

Those executables do not make use of libssl and all. So, no need to link
them, I think.
-- 
Replace repetitive expressions by calls to a common function.
            - The Elements of Programming Style (Kernighan & Plauger)

Attachment: pgpRuXr_OqCA_.pgp
Description: PGP signature

Reply via email to