Modify

Opened 8 years ago

Closed 7 years ago

#7590 closed defect (fixed)

awk: can't resolve symbol '__gtdf2' on AR7

Reported by: Ralph Loader <suckfish@…> Owned by: florian
Priority: normal Milestone:
Component: packages Version: Backfire 10.03
Keywords: Cc:

Description

Running ipcalc.sh 1.2.3.4 gives the error:

# ipcalc.sh 1.2.3.4
awk: can't resolve symbol 'gtdf2' on AR7

Copying /lib/libgcc_s.so off the router, it appears that the file is broken: nm claims no symbols, objdump gives an error, readelf claims the symbol is present.

# mipsel-openwrt-linux-nm --dynamic libgcc_s.so.1
libgcc_s.so.1: No symbols

# mipsel-openwrt-linux-objdump -T libgcc_s.so.1

libgcc_s.so.1: file format elf32-tradlittlemips

mipsel-openwrt-linux-objdump: libgcc_s.so.1: Invalid operation

# mipsel-openwrt-linux-readelf -D -s libgcc_s.so.1 |grep gtd

9 36: 00001950 168 FUNC GLOBAL DEFAULT 8 gtdf2

This occurs both with recent trunk and with backfire branch.

My current config settings for the toolchain are:

CONFIG_TARGET_ar7=y
CONFIG_LINUX_2_6_32=y
CONFIG_BINUTILS_VERSION_2_20_1=y
CONFIG_GCC_VERSION_4_4_3=y

and toolchain flag strings all left at defaults.

Attachments (1)

nostaticlibgcc.patch (1022 bytes) - added by Ralph Loader <suckfish@…> 8 years ago.
The change from my previous comment, wrapped as a diff again openwrt.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 8 years ago by Ralph Loader <suckfish@…>

Actually, it appears that the problem is just that awk (busybox) is not linked against libgcc_s.so.1; forcing the library to be loaded with LD_PRELOAD fixes the problem:

# LD_PRELOAD=/lib/libgcc_s.so.1 ipcalc.sh 1.2.3.4
IP=1.2.3.4
NETMASK=0.0.0.0
BROADCAST=255.255.255.255
NETWORK=0.0.0.0
PREFIX=0

# ldd /usr/bin/awk

libcrypt.so.0 => /lib/libcrypt.so.0 (0x2aabf000)
libm.so.0 => /lib/libm.so.0 (0x2aae3000)
libc.so.0 => /lib/libc.so.0 (0x2ab01000)
ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x2aaa8000)

comment:2 Changed 8 years ago by Ralph Loader <suckfish@…>

The following patch against busybox stops the problem from happening, by removing the -static-libgcc flag from the busybox link.

I suspect that there is are two underlying toolchain problems:

  • the linker should error instead of producing a binaries with an unresolvable symbol;
  • presumably the static libgcc should contain gtdf2

Someone who knows more about gcc and binutils than me should probably comment on that.

[PS. I see trac is converting a double-underscore to an underlined word...]

--- ./build_dir/target-mipsel_uClibc-0.9.30.2/busybox-1.15.3/Makefile.flags~	2009-12-12 14:45:08.000000000 +1300
+++ ./build_dir/target-mipsel_uClibc-0.9.30.2/busybox-1.15.3/Makefile.flags	2010-07-10 19:39:45.460697441 +1200
@@ -49,7 +49,7 @@
 # -fno-guess-branch-probability: prohibit pseudo-random guessing
 # of branch probabilities (hopefully makes bloatcheck more stable):
 CFLAGS += $(call cc-option,-fno-guess-branch-probability,)
-CFLAGS += $(call cc-option,-funsigned-char -static-libgcc,)
+CFLAGS += $(call cc-option,-funsigned-char,)
 CFLAGS += $(call cc-option,-falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1,)
 
 # FIXME: These warnings are at least partially to be concerned about and should

Changed 8 years ago by Ralph Loader <suckfish@…>

The change from my previous comment, wrapped as a diff again openwrt.

comment:3 Changed 8 years ago by florian

  • Owner changed from developers to florian
  • Status changed from new to accepted

I will try to see why you get such a linker error. Your patch looks good however.

comment:4 Changed 7 years ago by anonymous

this also seems to break dnsmasq

root@gw:~# /etc/init.d/dnsmasq restart
awk: can't resolve symbol 'gtdf2' in lib 'awk'.

dnsmasq: bad command line options: bad dhcp-range
root@gw:~#

comment:5 Changed 7 years ago by Djamel Ouerdi <djamel.ouerdi@…>

Same issue on the trunk release (Backfire 10.03, r23069), freshly compiled with basic options for an Asus wl500gp.
Here is the logread command output:

Jan  1 00:00:29 OpenWrt user.info sysinit: awk: can't resolve symbol '__gtdf2'
Jan  1 00:00:29 OpenWrt user.info sysinit: dnsmasq: bad command line options: bad dhcp-range
Jan  1 00:00:29 OpenWrt daemon.crit dnsmasq[897]: bad command line options: bad dhcp-range
Jan  1 00:00:29 OpenWrt daemon.crit dnsmasq[897]: FAILED to start up

comment:6 Changed 7 years ago by oliver.metz@…

We see the same behaviour when using mklibs.
For reference: http://trac.freetz.org/ticket/1063#comment:30

Unfortunately the ticket is in German language.

Our temporary fix is to link libm against libgcc_s_pic (static version) in mklibs script.
http://trac.freetz.org/attachment/ticket/1063/mklibs_libm.patch

comment:7 Changed 7 years ago by Borromini

I have the same issue with a 10.03.1-rc4 build (r24045 checkout). Unresolved symbol with awk, dnsmasq fails, and I'm only able to connect using a static IP.

comment:8 Changed 7 years ago by jow

Disable mklibs (strip unecessary symbols from libraries).

comment:9 Changed 7 years ago by Borromini

Thanks jow that worked.

comment:10 Changed 7 years ago by jow

  • Resolution set to fixed
  • Status changed from accepted to closed

Should be fixed by r24984.

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.