Bug 21071

Summary: can't able to create static link of dynamic object.
Product: binutils Reporter: Bharath <snbraj>
Component: ldAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED INVALID    
Severity: normal CC: snbraj
Priority: P3    
Version: 2.22   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:

Description Bharath 2017-01-20 23:04:37 UTC
Hi ,

I am trying to create static link of dynamic objects & archives.


Below is the commands & flags used,getting below errors.

/local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/x86_64-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc --sysroot=/local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/auto --disable-shared -Wundef -Wstrict-prototypes -Wno-trigraphs -g -O0 -fno-inline -fno-short-enums -fpic -D_GNU_SOURCE -I.. -O2 -pipe -g -feliminate-unused-debug-types -fstack-protector-all -pie -fpie -D_FORTIFY_SOURCE=2 -static -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-z -Wl,relro -Wl,-z -Wl,now -o applypatch applypatch-applypatch.o applypatch-bspatch.o applypatch-bsdiff.o applypatch-imgpatch.o applypatch-freecache.o applypatch-utils.o applypatch-main.o  -lz /local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/auto/usr/lib64/libbz2.a /local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/auto/usr/lib64/libmincrypt.a /local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/auto/usr/lib64/libcutils.so /local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/auto/usr/lib64/liblog.so /local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/auto/usr/lib64/libglib-2.0.so /local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/auto/usr/lib64/libstdc++.a ../mtdutils/.libs/libmtdutils.a ../edify/.libs/libedify.a ../minzip/.libs/libminzip.a -lm -lpthread
/local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/x86_64-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/4.9.3/ld: attempted static link of dynamic object `/local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/auto/usr/lib64/libcutils.so'
collect2: error: ld returned 1 exit status

Is there any switch to override this?

Regards
Bharath
Comment 1 Bharath 2017-01-20 23:38:34 UTC
we have to remove static flag