On Fri, Mar 3, 2017 at 11:23 AM, Maxim Gusev <[email protected]> wrote: > Yes, Aaron. I tried to figure it all out. > Some option doesn't works correctly. But the compiler and the linker are > supporting these options. > There is a log of "readelf -e imd_cbmem.o": http://pastebin.com/G5y36uU4
The above is indicating that -ffunction-sections and -fdata-sections is not working. All your symbols are in .text and .data so when you attempt to link it'll try to pull in everything which is why you are a getting the link error. > I also have a warning: cannot find entry symbol start; defaulting to > 0000000100187000 before undefined refference errors (but I think it doesn't > affect). > > I have also tried to compile the simple code by gcc: > http://pastebin.com/AYnxTjZx (the compilation string, code and the readelf > log). > I'm not doing something wrong, because I don't see sections with the name of > the function. There is the same with my compiler. > Maybe these options work only in conjunction with others? No. They work on all of our supported architectures as standalone options. > > If I will compile some sources of supported mainboard by coreboot, the > readelf log and sections will be good with appropriate title > (.text.function). > > Thanks a lot! > Regards, Maxim > > > > -------- Original Message -------- > Subject: Re: [coreboot] Some errors by compiling romstage (I am a newbie) > Local Time: 3 Марта 2017 г. 5:54 вечера > UTC Time: 3 Марта 2017 г. 14:54 > From: [email protected] > To: Maxim Gusev <[email protected]>, Coreboot <[email protected]> > > On Fri, Mar 3, 2017 at 8:37 AM, Maxim Gusev <[email protected]> wrote: >> It doesn't work any case. >> As I understood these options remove the unreferenced symbols, but I have >> referenced symbols (the error is undefined reference). >> The definition of the used functions is in the file that is missing at >> this >> stage but all works on other archs. >> > > The symbol might be referenced in one function in that compilation > unit, but if the symbol of the function using the undefined symbols is > not referenced from any of the root symbols then it should be removed. > The fact that it isn't suggests -gc-sections isn't working *or* > -f(data|function)-sections isn't working. As I requested previously, > readelf -e from one of the romstage .o files would confirm the latter. > As it stands now I can't speculate as to what is happening because the > code you are working on isn't published so I can't do anything beyond > request the information I've already requested. > >> >> >> -------- Original Message -------- >> Subject: Re: [coreboot] Some errors by compiling romstage (I am a newbie) >> Local Time: 3 Марта 2017 г. 4:54 дня >> UTC Time: 3 Марта 2017 г. 13:54 >> From: [email protected] >> To: Maxim Gusev <[email protected]>, Coreboot <[email protected]> >> >> On Fri, Mar 3, 2017 at 6:41 AM, Maxim Gusev <[email protected]> wrote: >>> These options are supported. >>> But the option -fno-pie is not supported (Don’t produce a position >>> independent executable). >>> Is it the reason of the fault? >> >> >> I wouldn't think so. If you remove that option does it magically work? >> From the errors you showed -gc-sections along with -fdata-sections and >> -ffunction-sections would have removed the unreferenced symbols and >> not cause a link error. To prove that -f(data|function)-sections are >> working can you provide the readelf -e output from an intermediate .o >> file you compiled for romstage? >> >>> >>> >>> >>> -------- Original Message -------- >>> Subject: Re: [coreboot] Some errors by compiling romstage (I am a newbie) >>> Local Time: 2 Марта 2017 г. 6:01 вечера >>> UTC Time: 2 Марта 2017 г. 15:01 >>> From: [email protected] >>> To: Maxim Gusev <[email protected]> >>> [email protected] <[email protected]> >>> >>> On Thu, Mar 2, 2017 at 8:33 AM, Maxim Gusev <[email protected]> wrote: >>>> Hello, Aaron! >>>> >>>> I am compiling sourses of my arch e2k. >>>> I have compiled bootblock with my sources. There aren't my sources in >>>> other >>>> stages. I have create arch directory and mainboard directory where the >>>> sources are located. >>>> >>>> >>>> >>>> Log: >>>> >>>> /home/maxim/coreboot/util/crossgcc/xgcc/bin/linux-ld: warning: cannot >>>> find >>>> entry symbol start; defaulting to 0000000100187000 >>>> build/romstage/lib/imd_cbmem.o: In function `cbmem_add_bootmem': >>>> /home/maxim/coreboot/src/lib/imd_cbmem.c:287: undefined reference to >>>> `bootmem_add_range' >>>> build/romstage/lib/imd_cbmem.o: In function >>>> `cbmem_add_records_to_cbtable': >>>> /home/maxim/coreboot/src/lib/imd_cbmem.c:314: undefined reference to >>>> `lb_new_record' >>>> make: *** [build/cbfs/fallback/romstage.debug] Error 1 >>>> >>> >>> Does your arch's compiler support -ffuncation-sections and >>> -fdata-sections? As well as your linker supporting --gc-sections ? All >>> the architectures we support have those flags. See Makefile.inc which >>> provides those in CFLAGS_common and LDFLAGS_common. That support >>> allows us to not sprinkle #ifdef's all around in the code when the >>> same source file is compiled for different stages. >>> >>>> >>>> >>>> -------- Original Message -------- >>>> Subject: Re: [coreboot] Some errors by compiling romstage (I am a >>>> newbie) >>>> Local Time: 2 Марта 2017 г. 5:22 вечера >>>> UTC Time: 2 Марта 2017 г. 14:22 >>>> From: [email protected] >>>> To: Maxim Gusev <[email protected]> >>>> [email protected] <[email protected]> >>>> >>>> On Thu, Mar 2, 2017 at 7:24 AM, Maxim Gusev via coreboot >>>> <[email protected]> wrote: >>>>> Hi everbody! >>>>> >>>>> I have a question. Very hope for your help. >>>>> >>>>> When I am compiling the romstage there are 2 errors by the linker: >>>>> Undefined refference to 'bootmem_add_range' >>>>> Undefined refference to 'lb_new_record' in the imd_cbmem.c file (it is >>>>> included in src/lib/Makefile.inc romstage). >>>>> >>>>> The definitions of these functions are in lib/bootmem.c and >>>>> lib/coreboot_table.c accordingly. >>>>> But I can't see the inclusion of these files in romstage in >>>>> src/Makefile.inc >>>>> (only in ramstage): >>>>> ramstage-y += bootmem.c >>>>> ramstage-y += coreboot_table.c >>>>> >>>>> How to solve this problem? >>>>> The inclusion of these files produces a number of other errors, but >>>>> nowhere >>>>> in the code no one does it? Why only I am having this error. >>>> >>>> >>>> What board are you building? Are you working on local patches to your >>>> setup only? What does the build log indicate? >>>> >>>>> >>>>> In General, I don't even need these stages (romstage and ramstage) - I >>>>> want >>>>> to check the performance on real hardware the work of the bootblock, >>>>> but >>>>> the >>>>> toolchain requires me to compile other stages. And the error occurs >>>>> even >>>>> not >>>>> in my code, but my ignorance. >>>>> >>>>> Thanks a lot! >>>>> Regards, Maxim >>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> coreboot mailing list: [email protected] >>>>> https://www.coreboot.org/mailman/listinfo/coreboot >>>> >>>> >>> >>> >> >> > > -- coreboot mailing list: [email protected] https://www.coreboot.org/mailman/listinfo/coreboot

