All of lore.kernel.org
 help / color / mirror / Atom feed
* kvm-unit-test compilation failed on Ubuntu Yakkety (4.8 kernel)
@ 2016-12-21 12:08 Po-Hsu Lin
  2016-12-21 12:36 ` Andrew Jones
  0 siblings, 1 reply; 3+ messages in thread
From: Po-Hsu Lin @ 2016-12-21 12:08 UTC (permalink / raw)
  To: kvm

Hello,

I found this compilation issue on an Ubuntu Yakkety (kernel 4.8.0-30)
x86_64 system.

When running "make" till the following step:
gcc  -mno-red-zone -m64 -O1 -g -MMD -MF x86/.vmexit.d -Wall -Werror
-fno-omit-frame-pointer    -Wno-frame-address -nostdlib -o
x86/vmexit.elf -Wl,-T,x86/flat.lds x86/vmexit.o x86/cstart64.o
lib/libcflat.a /usr/lib/gcc/x86_64-linux-gnu/6/libgcc.a

It will return:
/usr/bin/ld: x86/cstart64.o: relocation R_X86_64_32 against `.data'
can not be used when making a shared object; recompile with -fPIC

This issue won't go away even with x86/cstart64.o recompiled with the
-fPIC flag:
gcc -fPIC -mno-red-zone -m64 -O1 -g -MMD -MF x86/.cstart64.d -Wall
-Werror  -fno-omit-frame-pointer    -Wno-frame-address -std=gnu99
-ffreestanding -I lib -I lib/x86 -c -nostdlib -o x86/cstart64.o
x86/cstart64.S

The head of the kvm-unit-test repository is 1bde9127da4c

I think maybe it's because the source is assembly code, making the
-fPIC flag useless for it?

System spec
 - CPU: Intel i3-4010U
 - Kernel version: 4.8.0-30-generic #32
 - GCC version: gcc (Ubuntu 6.2.0-5ubuntu12) 6.2.0 20161005

Compilation works fine with Ubuntu Xenial (4.4 kernel, gcc Ubuntu
5.4.0-6ubuntu1~16.04.4 5.4.0 20160609), even with 4.8 kernel on
Xenial, so I think this is more related to the compiler or something.

Thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: kvm-unit-test compilation failed on Ubuntu Yakkety (4.8 kernel)
  2016-12-21 12:08 kvm-unit-test compilation failed on Ubuntu Yakkety (4.8 kernel) Po-Hsu Lin
@ 2016-12-21 12:36 ` Andrew Jones
  2016-12-22  5:57   ` Po-Hsu Lin
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Jones @ 2016-12-21 12:36 UTC (permalink / raw)
  To: Po-Hsu Lin; +Cc: kvm

On Wed, Dec 21, 2016 at 08:08:45PM +0800, Po-Hsu Lin wrote:
> Hello,
> 
> I found this compilation issue on an Ubuntu Yakkety (kernel 4.8.0-30)
> x86_64 system.
> 
> When running "make" till the following step:
> gcc  -mno-red-zone -m64 -O1 -g -MMD -MF x86/.vmexit.d -Wall -Werror
> -fno-omit-frame-pointer    -Wno-frame-address -nostdlib -o
> x86/vmexit.elf -Wl,-T,x86/flat.lds x86/vmexit.o x86/cstart64.o
> lib/libcflat.a /usr/lib/gcc/x86_64-linux-gnu/6/libgcc.a
> 
> It will return:
> /usr/bin/ld: x86/cstart64.o: relocation R_X86_64_32 against `.data'
> can not be used when making a shared object; recompile with -fPIC
> 
> This issue won't go away even with x86/cstart64.o recompiled with the
> -fPIC flag:
> gcc -fPIC -mno-red-zone -m64 -O1 -g -MMD -MF x86/.cstart64.d -Wall
> -Werror  -fno-omit-frame-pointer    -Wno-frame-address -std=gnu99
> -ffreestanding -I lib -I lib/x86 -c -nostdlib -o x86/cstart64.o
> x86/cstart64.S
> 
> The head of the kvm-unit-test repository is 1bde9127da4c
> 
> I think maybe it's because the source is assembly code, making the
> -fPIC flag useless for it?
> 
> System spec
>  - CPU: Intel i3-4010U
>  - Kernel version: 4.8.0-30-generic #32
>  - GCC version: gcc (Ubuntu 6.2.0-5ubuntu12) 6.2.0 20161005
> 
> Compilation works fine with Ubuntu Xenial (4.4 kernel, gcc Ubuntu
> 5.4.0-6ubuntu1~16.04.4 5.4.0 20160609), even with 4.8 kernel on
> Xenial, so I think this is more related to the compiler or something.
>

Does adding '-fno-pic' help?

Thanks,
drew 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: kvm-unit-test compilation failed on Ubuntu Yakkety (4.8 kernel)
  2016-12-21 12:36 ` Andrew Jones
@ 2016-12-22  5:57   ` Po-Hsu Lin
  0 siblings, 0 replies; 3+ messages in thread
From: Po-Hsu Lin @ 2016-12-22  5:57 UTC (permalink / raw)
  To: Andrew Jones; +Cc: kvm

Hi Andrew,

No, this '-fno-pic' flag does not help.

Like the "-fPIC" flag, I have tried this with just for x86/cstart64.o
and for all files with configure.
Non of them can work.

Thanks

On Wed, Dec 21, 2016 at 8:36 PM, Andrew Jones <drjones@redhat.com> wrote:
> On Wed, Dec 21, 2016 at 08:08:45PM +0800, Po-Hsu Lin wrote:
>> Hello,
>>
>> I found this compilation issue on an Ubuntu Yakkety (kernel 4.8.0-30)
>> x86_64 system.
>>
>> When running "make" till the following step:
>> gcc  -mno-red-zone -m64 -O1 -g -MMD -MF x86/.vmexit.d -Wall -Werror
>> -fno-omit-frame-pointer    -Wno-frame-address -nostdlib -o
>> x86/vmexit.elf -Wl,-T,x86/flat.lds x86/vmexit.o x86/cstart64.o
>> lib/libcflat.a /usr/lib/gcc/x86_64-linux-gnu/6/libgcc.a
>>
>> It will return:
>> /usr/bin/ld: x86/cstart64.o: relocation R_X86_64_32 against `.data'
>> can not be used when making a shared object; recompile with -fPIC
>>
>> This issue won't go away even with x86/cstart64.o recompiled with the
>> -fPIC flag:
>> gcc -fPIC -mno-red-zone -m64 -O1 -g -MMD -MF x86/.cstart64.d -Wall
>> -Werror  -fno-omit-frame-pointer    -Wno-frame-address -std=gnu99
>> -ffreestanding -I lib -I lib/x86 -c -nostdlib -o x86/cstart64.o
>> x86/cstart64.S
>>
>> The head of the kvm-unit-test repository is 1bde9127da4c
>>
>> I think maybe it's because the source is assembly code, making the
>> -fPIC flag useless for it?
>>
>> System spec
>>  - CPU: Intel i3-4010U
>>  - Kernel version: 4.8.0-30-generic #32
>>  - GCC version: gcc (Ubuntu 6.2.0-5ubuntu12) 6.2.0 20161005
>>
>> Compilation works fine with Ubuntu Xenial (4.4 kernel, gcc Ubuntu
>> 5.4.0-6ubuntu1~16.04.4 5.4.0 20160609), even with 4.8 kernel on
>> Xenial, so I think this is more related to the compiler or something.
>>
>
> Does adding '-fno-pic' help?
>
> Thanks,
> drew

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-12-22  5:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-21 12:08 kvm-unit-test compilation failed on Ubuntu Yakkety (4.8 kernel) Po-Hsu Lin
2016-12-21 12:36 ` Andrew Jones
2016-12-22  5:57   ` Po-Hsu Lin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.