On Thu, 2021-03-04 at 14:38 +0900, Hajime Tazaki wrote: > > objcopy (from binutils) can localize symbols (i.e., objcopy -L > sem_init $orig_file $new_file).
This doesn't seem to be sufficient. > It also does renaming symbols. But > not sure this is the ideal solution. Even that doesn't seem to actually work/help? I still get libcom_err trying to call UML's sem_init, even after doing objcopy --redefine-sym sem_init=uml_sem_init > How does UML handle symbol conflicts between userspace code and Linux > kernel (like this case sem_init) ? AFAIK, libnl has a same symbol as > Linux kernel (genlmsg_put) and others can possibly do as well. I think like I said it just doesn't but since you don't have much userspace code linked with UML it never really mattered? We only link a 'linux' binary, after all. How does LKL handle this though? It should be far more affected? Despite the objcopy *not* fixing it, this does seem to: diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S index dacbfabf66d8..2f2a8ce92f1e 100644 --- a/arch/um/kernel/dyn.lds.S +++ b/arch/um/kernel/dyn.lds.S @@ -6,6 +6,12 @@ OUTPUT_ARCH(ELF_ARCH) ENTRY(_start) jiffies = jiffies_64; +VERSION { + { + local: *; + }; +} + SECTIONS { PROVIDE (__executable_start = START); diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S index 45d957d7004c..7a8e2b123e29 100644 --- a/arch/um/kernel/uml.lds.S +++ b/arch/um/kernel/uml.lds.S @@ -7,6 +7,12 @@ OUTPUT_ARCH(ELF_ARCH) ENTRY(_start) jiffies = jiffies_64; +VERSION { + { + local: *; + }; +} + SECTIONS { /* This must contain the right address - not quite the default ELF one.*/ johannes