Skip to contentSkip to conversation

Add -nodefaultlibs while compiling against klibc

PATCH In review Martin Hicks 4 participants 6 messages Nov 25, 2003 – Dec 8, 2003 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add -nodefaultlibs while compiling against klibc

Greg,

This patch adds -nodefaultlibs to LDFLAGS when compiling udev against klibc. This fixes the warning that I was getting when using $(LD)=gcc in the versions after Makefile.klibc disappeared. The problem was that it was still including a "-lc" in the call to the linker.

mh

Signature · 41 lines
Martin Hicks                Wild Open Source Inc.
[email protected]     613-266-2296


# This is a BitKeeper generated patch for the following project:
# Project Name: udev
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.228   -> 1.229  
#	            Makefile	1.38    -> 1.39   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/11/25	[email protected]	1.229
# Add the -nodefaultlibs option to LDFLAGS while compiling
# againt klibc.  This fixes the build for ia64.
# --------------------------------------------
#
diff -Nru a/Makefile b/Makefile
--- a/Makefile	Tue Nov 25 12:26:18 2003
+++ b/Makefile	Tue Nov 25 12:26:18 2003
@@ -124,7 +124,7 @@
 		-I$(INCLUDE_DIR)/bits$(BITSIZE) -I$(GCCINCDIR) -Iklibc/linux/include \
 		-D__KLIBC__
 	LIB_OBJS -	LDFLAGS = --static --nostdlib -nostartfiles
+	LDFLAGS = --static --nostdlib -nostartfiles -nodefaultlibs
 else
 	CRT0  	LIBC = 




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#1 lore raw
Quoted 6 lines · Martin Hicks

Greg,

This patch adds -nodefaultlibs to LDFLAGS when compiling udev against klibc. This fixes the warning that I was getting when using $(LD)=gcc in the versions after Makefile.klibc disappeared. The problem was that it was still including a "-lc" in the call to the linker.

Thanks, I've applied this.

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to Martin Hicks
Quoted 6 lines · Martin Hicks

Greg,

This patch adds -nodefaultlibs to LDFLAGS when compiling udev against klibc. This fixes the warning that I was getting when using $(LD)=gcc in the versions after Makefile.klibc disappeared. The problem was that it was still including a "-lc" in the call to the linker.

this gives me linker errors on ppc and ia64:

+ make udevdir=/dev KLIBC=true DEBUGúlse
gcc --static --nostdlib -nostartfiles -nodefaultlibs -o udev /usr/src/packages/BUILD/udev-008/klibc/klibc/crt0.o udev.o udev_config.o udev-add.o udev-remove.o udevdb.o logging.o namedev.o namedev_parse.o /usr/src/packages/BUILD/udev-008/libsysfs/sysfs_bus.o /usr/src/packages/BUILD/udev-008/libsysfs/sysfs_class.o /usr/src/packages/BUILD/udev-008/libsysfs/sysfs_device.o /usr/src/packages/BUILD/udev-008/libsysfs/sysfs_dir.o /usr/src/packages/BUILD/udev-008/libsysfs/sysfs_driver.o /usr/src/packages/BUILD/udev-008/libsysfs/sysfs_utils.o /usr/src/packages/BUILD/udev-008/libsysfs/dlist.o tdb/tdb.o tdb/spinlock.o klibc_fixups.o /usr/src/packages/BUILD/udev-008/klibc/klibc/libc.a tdb/tdb.o(.text+0x1092): In function `tdb_chainunlock_read':
: undefined reference to `__umodsi3'
tdb/tdb.o(.text+0x1132): In function `tdb_chainunlock':
: undefined reference to `__umodsi3'
tdb/tdb.o(.text+0x15c2): In function `tdb_chainlock_read':
: undefined reference to `__umodsi3'
tdb/tdb.o(.text+0x1662): In function `tdb_chainlock':
: undefined reference to `__umodsi3'
tdb/tdb.o(.text+0x2212): In function `tdb_lockkeys':
: undefined reference to `__umodsi3'
tdb/tdb.o(.text+0x2232): more undefined references to `__umodsi3' follow
/usr/src/packages/BUILD/udev-008/klibc/klibc/libc.a(vsnprintf.o)(.text+0x6e2): In function `vsnprintf':
: undefined reference to `__udivdi3'
/usr/src/packages/BUILD/udev-008/klibc/klibc/libc.a(vsnprintf.o)(.text+0x7a2): In function `vsnprintf':
: undefined reference to `__divsi3'
/usr/src/packages/BUILD/udev-008/klibc/klibc/libc.a(vsnprintf.o)(.text+0xaf2): In function `vsnprintf':
: undefined reference to `__umoddi3'
/usr/src/packages/BUILD/udev-008/klibc/klibc/libc.a(vsnprintf.o)(.text+0xb22): In function `vsnprintf':
: undefined reference to `__udivdi3'
collect2: ld returned 1 exit status
make: *** [udev] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.66470 (%build)

I did that for ppc, against current bk:

klibc/klibc/arch/ppc/Makefile.inc 2003-12-07 22:40:05.000000000 +0100 renamed from klibc/klibc/arch/ppc/Makefile.inc 2002-08-17 02:54:27.000000000 +0200 +6 -1
diff -purNx linux udev-008.orig/klibc/klibc/arch/ppc/Makefile.inc udev-008/klibc/klibc/arch/ppc/Makefile.inc
@@ -8,7 +8,12 @@
 #
 
 ARCHOBJS = \
-       arch/$(ARCH)/setjmp.o
+       arch/$(ARCH)/setjmp.o \
+       libgcc/__divdi3.o \
+       libgcc/__moddi3.o \
+       libgcc/__udivdi3.o \
+       libgcc/__umoddi3.o \
+       libgcc/__udivmoddi4.o
 
 ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS))
 
Signature · 14 lines
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id78&alloc_id371&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#3 lore raw
In reply to Martin Hicks
Quoted 6 lines · Olaf Hering

this gives me linker errors on ppc and ia64:

tdb/tdb.o(.text+0x1092): In function `tdb_chainunlock_read':
: undefined reference to `__umodsi3'

Does this help?

Makefile +1 -0
diff -Nru a/Makefile b/Makefile
@@ -124,7 +124,7 @@
 		-I$(INCLUDE_DIR)/bits$(BITSIZE) -I$(GCCINCDIR) -Iklibc/linux/include \
 		-D__KLIBC__
 	LIB_OBJS -	LDFLAGS = --static --nostdlib -nostartfiles -nodefaultlibs
+	LDFLAGS = --static --nostdlib -nostartfiles -nodefaultlibs -lgcc
 else
 	CRT0  	LIBC 
 

-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id78&alloc_id371&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#4 lore raw
In reply to Martin Hicks
Quoted 10 lines · Arnd Bergmann
Quoted 6 lines · Olaf Hering

this gives me linker errors on ppc and ia64:

tdb/tdb.o(.text+0x1092): In function `tdb_chainunlock_read':
: undefined reference to `__umodsi3'

Does this help?

Nope. I had to do something very similar to what Olaf posted for ppc to get ia64 to compile again. Judging from the Makefile.inc in other arches this is the correct thing to do.

I wonder what I compiled when I tested that patch? Obviously not a build against klibc...

Attached is the patch that I'm going to send to the klibc list for ia64. I'll let Olaf send the ppc fixes. I don't have a ppc machine. mh

Signature · 2 lines
Martin Hicks                Wild Open Source Inc.
[email protected]     613-266-2296

# This is a BitKeeper generated patch for the following project:
# Project Name: The kernel C library
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.251 -> 1.252
# klibc/arch/ia64/Makefile.inc 1.5 -> 1.6
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/12/08 [email protected] 1.252
# Add some libgcc object files to Makefile.inc for ia64.
# --------------------------------------------
#

klibc/arch/ia64/Makefile.inc +9 -1
diff -Nru a/klibc/arch/ia64/Makefile.inc b/klibc/arch/ia64/Makefile.inc
@@ -10,7 +10,15 @@
 ARCHOBJS = \
 	arch/$(ARCH)/vfork.o \
 	arch/$(ARCH)/setjmp.o \
-	arch/$(ARCH)/pipe.o
+	arch/$(ARCH)/pipe.o \
+	libgcc/__divdi3.o \
+	libgcc/__divsi3.o \
+	libgcc/__udivdi3.o \
+	libgcc/__udivsi3.o \
+	libgcc/__umodsi3.o \
+	libgcc/__umoddi3.o \
+	libgcc/__udivmodsi4.o \
+	libgcc/__udivmoddi4.o
 
 ARCHSOOBJS = $(patsubst %o,%.lo,%(ARCHOBJS))
 
#5 lore raw
In reply to Martin Hicks
Quoted 10 lines · Martin Hicks
Quoted 9 lines · Arnd Bergmann
Quoted 6 lines · Olaf Hering

this gives me linker errors on ppc and ia64:

tdb/tdb.o(.text+0x1092): In function `tdb_chainunlock_read':
: undefined reference to `__umodsi3'

Quoted 5 lines
Quoted 1 line

Does this help?

Nope. I had to do something very similar to what Olaf posted for ppc to get ia64 to compile again. Judging from the Makefile.inc in other arches this is the correct thing to do.

s390 seems fail as well, have to verify it.

Signature · 14 lines
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id78&alloc_id371&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel