Hi,

ucfront-ld tool chokes on the "NONE" libc option (for standalone toolchains with built-in uClibc, for example).

Dumping the environment inside config/common/config.arch, I have:

CONFIG_DEFAULTS_LIBC_NONE=y
CONFIG_LIBCDIR=

Here's what ucfront-ld says about that:

FATAL: Could not determine libc. Are $CONFIG_DEFAULTS_LIBC_... and $CONFIG_LIBCDIR set correctly?

Obviously in the LIBC_NONE case ucfront-ld doesn't have a lot to do, but one place it is used is when common/config.arch tests linker support for --fatal-warnings:

ifeq "$(shell $(LD) --fatal-warnings 2>&1 | grep 'unrecogni.ed option')" ""
            # Linker warnings are almost always a sign of badness
            LDFLAGS  += -Wl,--fatal-warnings
    endif

With LIBC_NONE, ucfront-ld doesn't get as far as invoking $(CROSS)-ld - it just pukes about LIBCDIR.

ucfront-ld assumes that if it's CONFIG_DEFAULTS_LIBC_NONE, then CONFIG_LIBCDIR should not be set. This is wrong, CONFIG_LIBCDIR is set, but empty. There's another error whereby it would pass an empty libdirectory on the command line, so we'd get

$(LD) ... -L {nothing} ...

which is also bogus.

Attached patch seems to work OK here, but I couldn't actually find any dist apps that explicitly invoke the linker - all seem to do it via $(GCC). Any comments?

Thanks,

John
Index: tools/ucfront/ucfront-ld.c
===================================================================
--- tools/ucfront/ucfront-ld.c  (revision 2231)
+++ tools/ucfront/ucfront-ld.c  (working copy)
@@ -282,6 +282,9 @@
                        x_asprintf(&libc_libdir, "%s/lib/%s", rootdir, 
config_libcdir);
                }
        }
+       else if (getenv("CONFIG_DEFAULTS_LIBC_NONE")) {
+               libtype = LIBTYPE_NONE;
+       }
        else {
                fatal("Could not determine libc. Are $CONFIG_DEFAULTS_LIBC_... 
and $CONFIG_LIBCDIR set correctly?"); 
        }
@@ -325,8 +328,10 @@
        if (!nostdlib) {
                args_add(stripped_args, "-nostdlib");
 
-               args_add(stripped_args, "-L");
-               args_add(stripped_args, libc_libdir);
+               if(libc_libdir) {
+                       args_add(stripped_args, "-L");
+                       args_add(stripped_args, libc_libdir);
+               }
 
                x_asprintf(&e, "%s/lib", rootdir);
                args_add(stripped_args, "-L");
_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to