Tian Zhan
2014-07-15 16:31:47 UTC
Hi everyone,
I am porting one project to little endian Power 8, on Ubuntu 14.04,
hit this TOC unknown issue. I checked the code in project(in both C++
and assembly file), no such TOC symbol ever used.
And what's worse, I did not know which module should be blamed for
this TOC issue, because lots of modules in my project have this TOC
symbol(using objdump -t to check), but when they were linked together,
only one TOC left. For example, A B C module both have TOC, then A B C
linked together to generate D, only one TOC left in D, finally insert
module D into Linux kernel, and hit unknown symbol TOC problem.
g++ flags that I used:
-m64 -mlittle-endian -mno-altivec -mtune=power4 -funit-at-a-time
-fno-ivopts -Wa,-maltivec -D_FORTIFY_SOURCE=0 -fno-stack-protector
ld flags:
-m64 -melf64ppc
kernel version:
3.13.0-29-generic
gcc version:
gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2
I use to think that this issue is related with ABIv2 flag that created
first time for little endian power, and kernel did not support the new
ABI perfectly, since I saw lots of Linux kernel patches checked-in for
this new flag(but these patches are not in 3.13.0-29 Ubuntu kernel),
for example, the below 3 patches:
- Build little endian ppc64 kernel with ABIv2
721aeaa9fdf35a672eef8ebdc4cd04bde38c3cea
- Don't build assembly files with ABIv2
http://patchwork.ozlabs.org/patch/341691/
We avoid ABIv2 when building c files since commit b2ca8c89 (powerpc:
Don't use ELFv2 ABI to build the kernel). Do the same for assembly
files.
58aedccb1907f05f702f0f6d8f8a57e8efe485b7
- powerpc: EXPORT_SYMBOL(.TOC.)
For the ELFv2 ABI, powerpc introduces a magic symbol ".TOC.". depmod
then complains that this doesn't resolve (so does modpost, but we could
easily fix that). To export this, we need to use asm.
modpost and depmod both strip "." from symbols for the old PPC64 ELFv1
ABI, so we actually export a "TOC.".
9baeaef64095eab00c232f55df2e7c2d8e89845d
Any idea or suggestion for this TOC issue? Thanks very much for you help.
I am porting one project to little endian Power 8, on Ubuntu 14.04,
hit this TOC unknown issue. I checked the code in project(in both C++
and assembly file), no such TOC symbol ever used.
And what's worse, I did not know which module should be blamed for
this TOC issue, because lots of modules in my project have this TOC
symbol(using objdump -t to check), but when they were linked together,
only one TOC left. For example, A B C module both have TOC, then A B C
linked together to generate D, only one TOC left in D, finally insert
module D into Linux kernel, and hit unknown symbol TOC problem.
g++ flags that I used:
-m64 -mlittle-endian -mno-altivec -mtune=power4 -funit-at-a-time
-fno-ivopts -Wa,-maltivec -D_FORTIFY_SOURCE=0 -fno-stack-protector
ld flags:
-m64 -melf64ppc
kernel version:
3.13.0-29-generic
gcc version:
gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2
I use to think that this issue is related with ABIv2 flag that created
first time for little endian power, and kernel did not support the new
ABI perfectly, since I saw lots of Linux kernel patches checked-in for
this new flag(but these patches are not in 3.13.0-29 Ubuntu kernel),
for example, the below 3 patches:
- Build little endian ppc64 kernel with ABIv2
721aeaa9fdf35a672eef8ebdc4cd04bde38c3cea
- Don't build assembly files with ABIv2
http://patchwork.ozlabs.org/patch/341691/
We avoid ABIv2 when building c files since commit b2ca8c89 (powerpc:
Don't use ELFv2 ABI to build the kernel). Do the same for assembly
files.
58aedccb1907f05f702f0f6d8f8a57e8efe485b7
- powerpc: EXPORT_SYMBOL(.TOC.)
For the ELFv2 ABI, powerpc introduces a magic symbol ".TOC.". depmod
then complains that this doesn't resolve (so does modpost, but we could
easily fix that). To export this, we need to use asm.
modpost and depmod both strip "." from symbols for the old PPC64 ELFv1
ABI, so we actually export a "TOC.".
9baeaef64095eab00c232f55df2e7c2d8e89845d
Any idea or suggestion for this TOC issue? Thanks very much for you help.