Re: [PATCH 1/2] kvm-unit-tests: invoke $LD explicitly in

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 01, 2022 at 01:09:13PM -0400, Dan Cross wrote:
> On Wed, Jun 1, 2022 at 3:03 AM Thomas Huth <thuth@xxxxxxxxxx> wrote:
> > On 26/05/2022 19.39, Dan Cross wrote:
> > > Change x86/Makefile.common to invoke the linker directly instead
> > > of using the C compiler as a linker driver.
> > >
> > > This supports building on illumos, allowing the user to use
> > > gold instead of the Solaris linker.  Tested on Linux and illumos.
> > >
> > > Signed-off-by: Dan Cross <cross@xxxxxxxxxxxxxxxxx>
> > > ---
> > >   x86/Makefile.common | 6 +++---
> > >   1 file changed, 3 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/x86/Makefile.common b/x86/Makefile.common
> > > index b903988..0a0f7b9 100644
> > > --- a/x86/Makefile.common
> > > +++ b/x86/Makefile.common
> > > @@ -62,7 +62,7 @@ else
> > >   .PRECIOUS: %.elf %.o
> > >
> > >   %.elf: %.o $(FLATLIBS) $(SRCDIR)/x86/flat.lds $(cstart.o)
> > > -     $(CC) $(CFLAGS) -nostdlib -o $@ -Wl,-T,$(SRCDIR)/x86/flat.lds \
> > > +     $(LD) -T $(SRCDIR)/x86/flat.lds -nostdlib -o $@ \
> > >               $(filter %.o, $^) $(FLATLIBS)
> > >       @chmod a-x $@
> >
> >
> >   Hi,
> >
> > something seems to be missing here - this is failing our 32-bit
> > CI job:
> >
> >   https://gitlab.com/thuth/kvm-unit-tests/-/jobs/2531237708
> >
> > ld -T /builds/thuth/kvm-unit-tests/x86/flat.lds -nostdlib -o x86/taskswitch2.elf \
> >         x86/taskswitch2.o x86/cstart.o lib/libcflat.a
> > ld: i386 architecture of input file `x86/taskswitch.o' is incompatible with i386:x86-64 output
> > ld: i386 architecture of input file `x86/cstart.o' is incompatible with i386:x86-64 output
> > ld: i386 architecture of input file `lib/libcflat.a(argv.o)' is incompatible with i386:x86-64 output
> > ld: i386 architecture of input file `lib/libcflat.a(printf.o)' is incompatible with i386:x86-64 output
> > ...
> >
> > You can find the job definition in the .gitlab-ci.yml file (it's
> > basically just about running "configure" with --arch=i386).
> 
> Thanks. I think the easiest way to fix this is to plumb an
> argument through to the linker that expands to `-m elf_i386`
> on 32-bit, and possibly, `-m elf_x86_64` on 64-bit. The
> architecture specific Makefiles set the `ldarch` variable,
> and that doesn't seem used anywhere, but I see that's set
> to match the string accepted by the linker scripts/objcopy,
> not something acceptable to `-m`. However, one can add
> something to `LDARGS`, but I see that that's set to include
> the contents of CFLAGS, which means it includes flags
> that are not directly consumable  by the linker itself.
> 
> I think the simplest way forward is to introduce a new
> variable in x86/Makefile.i386 and x86/Makefile.x86_64 and
> refer to that in x86/Makefile.common; possibly `LDEXTRA`?

We do that for arm, but call that argument arch_LDFLAGS.

> I've got an updated patch here that does that, and it seems
> to work (building under both illumos and arch locally), but
> before I send up another patchset, let me know if that
> sounds acceptable?

It does to me.

Thanks,
drew




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux