Skip to contentSkip to conversation

PATCH -- Was: link error MODE_SKAS and ! MODE_TT in 2.4.26-2 + uml.sf.net patches

uml-devel D. Bahi 2 participants 2 messages Aug 6, 2004 – Aug 9, 2004 2 messages not in the archive User-mode Linux (UML)

lore
Share & tools
lore

D. Bahi

author
#2 lore raw
In reply to a message not in the archive

this patch fixes the unresolved link time error with a conditional around the definition of CAN_KMALLOC

and removes the unnedded -SEARCH_DIR line from dyn_link.ld.in (this actually gets in the way if using a non- system toolchain and it's removal should not affect any properly built toolchain). --
db

Quoted 5 lines · D. Bahi

sorry about my own follow up - it's a trivial bug:

rather than wrap CAN_KMALLOC with multiple macro conditionals to avoid 'tracing_pid' being referenced i just added the line

Quoted 38 lines

int tracing_pid = -1

to arch/um/kern/skas/process.c so that it parallels kern/tt/tracer.c this might mask more critical references introduced in the future however. so the multiple macro fix would be the proper one i guess...

Quoted 28 lines · D. Bahi

i think this has been like this for some time... as i remember trying to turn of TT completely in earlier releases:

CONFIG_MODE_SKAS=y
CONFIG_X86_CMPXCHG=y
# CONFIG_MODE_TT is not set
# CONFIG_STATIC_LINK is not set

results in:

gcc -Wl,-T,arch/um/dyn_link.ld -Wl,-rpath,/lib -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc \
-o linux arch/um/main.o vmlinux.o -L/usr/lib -lutil
arch/um/main.o(.text+0x363): In function `__wrap_malloc':
arch/um/main.c:187: undefined reference to tracing_pid' arch/um/main.o(.text+0x3e2): In function __wrap_free':
arch/um/main.c:231: undefined reference to tracing_pid' arch/um/main.o(.text+0x425):arch/um/main.c:235: undefined reference to tracing_pid'
collect2: ld returned 1 exit status
make: *** [linux] Error 1

arch/um/main.c:187 is in void *__wrap_malloc(int size)
==> else ret = um_vmalloc(size);

arch/um/main.c:231 and :235 are in void __wrap_free(void *ptr)
==> if(CAN_KMALLOC())
==> if(CAN_KMALLOC())

arch/um/dyn_link.ld.in +1 -1
@@ -1,7 +1,7 @@
 OUTPUT_FORMAT("ELF_FORMAT")
 OUTPUT_ARCH(ELF_ARCH)
 ENTRY(_start)
-SEARCH_DIR("/usr/local/i686-pc-linux-gnu/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
+
 /* Do we need any of these for elf?
    __DYNAMIC = 0;    */
 SECTIONS
arch/um/main.c +5 -0
@@ -171,8 +171,13 @@
 	return(uml_exitcode);
 }
 
+#ifdef UML_CONFIG_MODE_TT
 #define CAN_KMALLOC() \
 	(kmalloc_ok && CHOOSE_MODE((getpid() != tracing_pid), 1))
+#else
+#define CAN_KMALLOC() \
+	(kmalloc_ok)
+#endif
 
 extern void *__real_malloc(int);
 
#3 lore raw
Quoted 2 lines · [email protected] said:

this patch fixes the unresolved link time error with a conditional around the definition of CAN_KMALLOC

I don't see that here. If you look at the definition of CHOOSE_MODE, you'll see that it's conditional on CONFIG_MODE_TT and CONFIG_MODE_SKAS in such a way that if a mode is configured out, any code associated with it disappears.

I think you didn't do that build from a clean pool.

Jeff

-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel