On 2018-05-01 10:54, Ralf Ramsauer wrote:
> On 04/27/2018 08:21 PM, Jan Kiszka wrote:
>> On 2018-04-27 11:36, Ralf Ramsauer wrote:
>>> This won't drop symbols that are marked as used.
>>>
>>> The static, relocateable inmate library lib.a is created by ar. When
>>> linking executables, unreferenced symbols may be dropped, even if they
>>> are attributed as used.
>>>
>>> --whole-archive ensures that those symbols will be linked.
>>>
>>> Whereas on x86, we need --gc-sections.
>>
>> That's something I do not understand yet: With [1] we will build the
>> whole hypervisor, including x86, with --whole-archive, and that works
>> fine on x86 as well.
> 
> That's what happens if I compile x86 inmates with --whole-archive
> instead of --gc-sections:
> 
>   LD
> /home/ralf/workspace/jailhouse/inmates/demos/x86/32-bit-demo-linked.o
> /home/ralf/workspace/jailhouse/inmates/lib/x86/lib32.a(ioapic-32.o): In
> function `ioapic_init':
> /home/ralf/workspace/jailhouse/inmates/lib/x86/ioapic.c:48: undefined
> reference to `map_range'
> /home/ralf/workspace/jailhouse/inmates/lib/x86/lib32.a(smp-32.o): In
> function `smp_start_cpu':
> /home/ralf/workspace/jailhouse/inmates/lib/x86/smp.c:59: undefined
> reference to `delay_us'
> /home/ralf/workspace/jailhouse/inmates/lib/x86/smp.c:61: undefined
> reference to `delay_us'
> /home/ralf/workspace/jailhouse/inmates/lib/x86/lib32.a(pci-32.o): In
> function `pci_find_device':
> /home/ralf/workspace/jailhouse/inmates/lib/x86/../pci.c:47: undefined
> reference to `pci_read_config'
> /home/ralf/workspace/jailhouse/inmates/lib/x86/../pci.c:51: undefined
> reference to `pci_read_config'
> /home/ralf/workspace/jailhouse/inmates/lib/x86/lib32.a(pci-32.o): In
> function `pci_find_cap':
> /home/ralf/workspace/jailhouse/inmates/lib/x86/../pci.c:61: undefined
> reference to `pci_read_config'
> /home/ralf/workspace/jailhouse/inmates/lib/x86/../pci.c:65: undefined
> reference to `pci_read_config'
> /home/ralf/workspace/jailhouse/inmates/lib/x86/../pci.c:68: undefined
> reference to `pci_read_config'
> 
> Interestingly, this only happens to the 32-bit demo inmate.
> 

Because we keep everything, something might be missing now: The 32-bit
lib does not provide support for all features that its big 64-bit
brother has.

I still think this approach is too much of a big hammer. Try
--print-gc-sections on your specific problem (uart section loss) and
play with --undefined as suggested by the ld man page. Not sure if there
is also some linker script statement that can do that trick, but it
might be worth checking.

Jan

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to