helpGNU Libtool - Support: sr #108559, libtool binary wrappers fall prey...

 
 

sr #108559: libtool binary wrappers fall prey to aggressive optimizations

Submitted by:  LRN <lrn>
Submitted on:  Fri 02 May 2014 05:16:44 AM UTC  
 
Category: NonePriority: 5 - Normal
Severity: 3 - NormalStatus: Done
Privacy: PublicAssigned to: None
Open/Closed: OpenOperating System: None

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 02 May 2014 01:01:00 PM UTC, comment #3:

I have now pushed this change, thanks for testing!

Cheers,
Peter

Peter Rosin <pekberg>
Project Member
Fri 02 May 2014 12:23:37 PM UTC, comment #2:

Yeah, that worked

LRN <lrn>
Fri 02 May 2014 09:09:34 AM UTC, comment #1:

Isn't this a more direct approach, not affected by new and even
more aggressive optimizations?

-volatile const char * MAGIC_EXE = "$magic_exe";
+#if _GNUC_ < 4 || (_GNUC_ == 4 && _GNUC_MINOR_ < 5)
+# define externally_visible volatile
+#else
+# define externally_visible _attribute_((externally_visible)) volatile
+#endif
+externally_visible const char * MAGIC_EXE = "$magic_exe";

Does the above work for you?

Cheers,
Peter

Peter Rosin <pekberg>
Project Member
Fri 02 May 2014 05:16:44 AM UTC, original submission:

When building binary wrappers (say, for W32), libtool puts a MAGIC constant string into them. Later on libtool greps the program for this string to see whether this is a wrapper or a real program.

However, MAGIC string is not used in the program in any way, and gcc may remove it. This does happen when building with -flto.

My proposal would be to make use of the string somehow to fool gcc into leaving it alone. For example, this call:

lt_fatal (_FILE_, _LINE_,
"unrecognized %s option: '%s'",
ltwrapper_option_prefix, argv[i]);

can be changed like this:

lt_fatal (_FILE_, _LINE_,
"unrecognized %s option: '%s'\0%s",
ltwrapper_option_prefix, argv[i], MAGIC_EXE);

LRN <lrn>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by pekberg (Posted a comment)
  • -unavailable- added by lrn (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 02 May 2014 01:01:00 PM UTCpekbergStatusNone=>Done

    Back to the top


    Powered by Savane 3.1-cleanup