On 6/7/20 7:15 AM, Syed Nayyar Waris wrote: > On Fri, Jun 5, 2020 at 5:54 PM Andy Shevchenko > wrote: >> On Fri, Jun 05, 2020 at 02:12:54AM +0530, Syed Nayyar Waris wrote: >>> On Sun, May 31, 2020 at 12:50 AM kbuild test robot wrote: >>>>>> WARNING: modpost: lib/test_bitmap.o(.data+0xe80): Section mismatch in reference from the variable clump_test_data to the variable .init.rodata:clump_exp1 >>>> The variable clump_test_data references >>>> the variable __initconst clump_exp1 >>>> If the reference is valid then annotate the >>>> variable with or __refdata (see linux/init.h) or name the variable: >>>> >>>> -- >>>>>> WARNING: modpost: lib/test_bitmap.o(.data+0xec8): Section mismatch in reference from the variable clump_test_data to the variable .init.rodata:clump_exp2 >>>> The variable clump_test_data references >>>> the variable __initconst clump_exp2 >>>> If the reference is valid then annotate the >>>> variable with or __refdata (see linux/init.h) or name the variable: >>>> >>>> -- >>>>>> WARNING: modpost: lib/test_bitmap.o(.data+0xf10): Section mismatch in reference from the variable clump_test_data to the variable .init.rodata:clump_exp3 >>>> The variable clump_test_data references >>>> the variable __initconst clump_exp3 >>>> If the reference is valid then annotate the >>>> variable with or __refdata (see linux/init.h) or name the variable: >>>> >>>> -- >>>>>> WARNING: modpost: lib/test_bitmap.o(.data+0xf58): Section mismatch in reference from the variable clump_test_data to the variable .init.rodata:clump_exp4 >>>> The variable clump_test_data references >>>> the variable __initconst clump_exp4 >>>> If the reference is valid then annotate the >>>> variable with or __refdata (see linux/init.h) or name the variable: >>> I am unable to reproduce the compilation warning. >> You have to enable section mismatch checker. >> >>> I ran the command: >>> make W=1 C=1 ARCH=x86_64 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' lib/ >>> >>> But the compilation warning didn't show up. Can anyone please point to me >>> what I am doing wrong here? How shall I reproduce the warning? Thanks ! >> You put some data into init section of the object, while you are trying to >> access it from non-init one. It's easy-to-fix issue. >> >> -- >> With Best Regards, >> Andy Shevchenko > Thanks! I have made code changes for the above warning. Actually I am > still unable to reproduce the compilation warning. But I believe the > following code fix will fix the compilation warning: > > In file lib/test_bitmap.c > > @@ -692,7 +692,7 @@ struct clump_test_data_params { > unsigned long const *exp; > }; > > -struct clump_test_data_params clump_test_data[] = > +static struct clump_test_data_params clump_test_data[] __initdata = > { {{0}, 2, 0, 64, 8, clump_exp1}, > {{0}, 8, 2, 240, 24, clump_exp2}, > {{0}, 8, 10, 240, 30, clump_exp3}, > > > > Let me know if I should submit a new patchset (v8) for > 'for_each_set_clump' including above code fix. > > Just to share how I attempted to reproduce the warning (but unsuccessful): > > Step 1: Use the config file in attachment. Download, extract, rename > file to .config at the root of the tree. > Step 2: '$ make lib/' > No warning reproduced after above step 2. > Step 3: '$ make W=1 C=1 ARCH=x86_64 CF='-fdiagnostic-prefix > -D__CHECK_ENDIAN__' lib/' > After step 3 I got error in build: > scripts/kconfig/conf --syncconfig Kconfig > CHECK scripts/mod/empty.c > No such file: asan-globals=1 > scripts/Makefile.build:266: recipe for target 'scripts/mod/empty.o' failed > make[1]: *** [scripts/mod/empty.o] Error 1 > Makefile:1147: recipe for target 'prepare0' failed > make: *** [prepare0] Error 2 > > The command in above step 3 was mentioned in the bot mail. > > Regards > Syed Nayyar Waris > Hi Syed Nayyar Waris, We can reproduce the warning with the steps in original report, you may need to build the whole kernel instead of the 'lib'. Best Regards, Rong Chen