Bug 7630

Summary: Provide some hint for the "textrel" QA issue
Product: [Documentation] Reference Reporter: Laszlo Papp <lpapp>
Component: handbookAssignee: Scott Rifenbark <srifenbark>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: Undecided CC: bluelightning, poky.doc.watcher, poky.watcher, srifenbark
Version: unspecified   
Target Milestone: 1.9 M1   
Hardware: x86   
OS: Multiple   
Whiteboard: 27 April 2015: RESOLVED
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Done (doc changes complete)

Description Laszlo Papp 2015-04-20 12:32:34 UTC
The documentation (*) writes:

  ELF binary '<file>' has relocations in .text [textrel] ΒΆ

  The specified ELF binary contains relocations in its .text sections. This   situation can result in a performance impact at runtime.

A hint could be added that the fix is likely to assign -fPIC/-fpic to gcc. This could spare some investigation time for the casual reader.

* http://www.yoctoproject.org/docs/current/ref-manual/ref-manual.html#qa-issue-textrel
Comment 1 Paul Eggleton 2015-04-20 12:35:04 UTC
I agree we should extend this entry as currently it is a bit sparse. It could also be worth linking to this page for further information:

http://www.akkadia.org/drepper/textrelocs.html
Comment 2 Scott Rifenbark 2015-04-20 14:42:40 UTC
Hi, 

I have made a couple changes in the ref-manual.  This bit about runtime performance issues appears in two different places.  Please look at the following sections and give me your feedback:

 * http://www.yoctoproject.org/docs/1.9/ref-manual/ref-manual.html#ref-classes-insane - see the "textrel" bullet item.

 * http://www.yoctoproject.org/docs/1.9/ref-manual/ref-manual.html#qa-issue-textrel

Thanks, 
Scott
Comment 3 Paul Eggleton 2015-04-20 14:56:09 UTC
"If you do experience performance issues.." isn't really correct, it's a suggested resolution to the general issue. Also "assign -fPIC to gcc" isn't really something the user can action.
Comment 4 Scott Rifenbark 2015-04-20 15:14:48 UTC
Paul, 

I need more information to reword this.  How does the developer determine if they are having performance issues due to text relocation?  Are they able to isolate slowdowns to this particular issue?  Would it be better to just say "For runtime performance issues, ..."?  

Also, if the user cannot assign "-fPIC to gcc" as a workaround, how does this workaround get applied?  Is there a workaround?

Thanks, 
Scott
Comment 5 Paul Eggleton 2015-04-20 15:23:04 UTC
That's just it - -fPIC isn't a workaround, it's the proper way to fix it. My issue was mainly in the way you're stating it - it's not that the user should go and check if there are performance issues, they should just fix it and then both the warning and any potential performance issues go away. The problem with "assign -fPIC to gcc" is it doesn't sufficiently explain what to do.

Rather than having this as a "Tip" box I would suggest simply having the following sentence at the end of the first paragraph: 'Typically the way to solve this is by adding -fPIC to the compiler command line options, for example where the software you are building reads CFLAGS from the environment adding the following to the recipe should fix it:

CFLAGS_append = " -fPIC "
'
Comment 6 Scott Rifenbark 2015-04-20 15:45:27 UTC
Paul, 

Check out the latest at http://www.yoctoproject.org/docs/1.9/ref-manual/ref-manual.html#qa-issue-textrel and let me know.  I did some rewriting on your original text. 

Scott
Comment 7 Paul Eggleton 2015-04-27 10:15:14 UTC
Looks good to me.
Comment 8 Scott Rifenbark 2015-04-27 15:38:54 UTC
Thanks Paul... I will leave this in IN PROGRESS REVIEW until I either hear from Laszlo or a reasonable time passes without further comments. 

Scott
Comment 9 Laszlo Papp 2015-04-27 15:44:12 UTC
Looks good, thank you for your help!

I would personally suggest a minor improvement to the text, but it is not strictly necessary:

"Typically, the way to solve this performance issue is to add "-fPIC" *or "-fpic"* to the compiler command-line option"

-fpic might be preferred on embedded systems with minimal requirements, so it is good to be aware of, even though -fPIC is much more common.
Comment 10 Scott Rifenbark 2015-04-27 17:09:41 UTC
Laszlo... .thanks for the additional suggestion.  I have added that to the text.  I am marking the bug RESOLVED and setting the doc flag to "Done."

Change can be viewed at http://www.yoctoproject.org/docs/1.9/ref-manual/ref-manual.html#qa-issue-textrel

Thanks, 
Scott