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