make section names compatible with -ffunction-sections -fdata-sections: blackfin
PATCH 5/23 make section names compatible with -ffunction-sections -fdata-sections: blackfin
The purpose of this patch is to make kernel buildable with "gcc -ffunction-sections -fdata-sections". This patch fixes blackfin architecture.
--
vda
arch/blackfin/kernel/vmlinux.lds.S +1 -1
@@ -91,7 +91,7 @@ __sdata = .; /* This gets done first, so the glob doesn't suck it in */ . = ALIGN(32); - *(.data.cacheline_aligned) + *(.cacheline_aligned.data) #if !L1_DATA_A_LENGTH . = ALIGN(32);
Quoted 3 lines · Denys Vlasenko
The purpose of this patch is to make kernel buildable with "gcc -ffunction-sections -fdata-sections". This patch fixes blackfin architecture.
the comment right above what you changed says it already works for Blackfin. so you arent fixing it at all.
arch/blackfin/kernel/vmlinux.lds.S line 94
Quoted 4 lines
/* This gets done first, so the glob doesn't suck it in */ . = ALIGN(32);arch/blackfin/kernel/vmlinux.lds.S +1
-1- *(.data.cacheline_aligned) + *(.cacheline_aligned.data)
ive built Blackfin kernels with function/data sections a long time ago ... but iirc, there were toolchain problems, so i havent pursued it since.
if you're going to muck with names, you might as well do it right the first time: move the names into asm-generic/vmlinux.lds.h so we dont have to worry about this kind of churn again.
-mike
Quoted 11 lines · Mike Frysinger
Quoted 3 lines · Denys Vlasenko
The purpose of this patch is to make kernel buildable with "gcc -ffunction-sections -fdata-sections". This patch fixes blackfin architecture.
the comment right above what you changed says it already works for Blackfin. so you arent fixing it at all.
Quoted 4 lines
/* This gets done first, so the glob doesn't suck it in */ . = ALIGN(32);arch/blackfin/kernel/vmlinux.lds.S +1
-1- *(.data.cacheline_aligned) + *(.cacheline_aligned.data)
This may pull in an unrelated data object named "cacheline_aligned" (say, a static variable in a driver). If that variable is not itself aligned to the cacheline size, it will mess up alignment of all objects in .data.cacheline_aligned which follow. Not good.
To be safe from such weird and hard to debug problems it's better to not use names like .data.XXXX at all. I just uniformly renamed al such "special sections" in the kernel to .XXXXX.data
--
vda
Quoted 18 lines · Denys Vlasenko
Quoted 11 lines · Mike Frysinger
Quoted 3 lines · Denys Vlasenko
The purpose of this patch is to make kernel buildable with "gcc -ffunction-sections -fdata-sections". This patch fixes blackfin architecture.
the comment right above what you changed says it already works for Blackfin. so you arent fixing it at all.
Quoted 4 lines
/* This gets done first, so the glob doesn't suck it in */ . = ALIGN(32);arch/blackfin/kernel/vmlinux.lds.S +1
-1- *(.data.cacheline_aligned) + *(.cacheline_aligned.data)This may pull in an unrelated data object named "
cacheline_aligned" (say, a static variable in a driver). If that variable is not itself aligned to the cacheline size, it will mess up alignment of all objects in .data.cacheline_aligned which follow. Not good.
Quoted 4 lines
To be safe from such weird and hard to debug problems it's better to not use names like .data.XXXX at all. I just uniformly renamed al such "special sections" in the kernel to .XXXXX.data
you're right of course ... i obviously hadnt thought of this. please however still abstract this stuff into the common header.
i just tested the current Blackfin kernel and it does build/link/run fine with -ffunction-sections/-fdata-sections. however, --gc-sections still causes crashes (but this is because all of the .init.setup sections are flagged as unused).
-mike