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

 
 

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

Submitter:  -*- <_74148>
Submitted:  Fri 02 May 2014 05:16:44 AM UTC
   
 
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Done
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Operating System:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 15 Mar 2015 04:28:01 PM UTC, comment #4: 

Care to close this bug?

-*- <_74148>
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>
Group Member
Fri 02 May 2014 12:23:37 PM UTC, comment #2: 

Yeah, that worked

-*- <_74148>
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>
Group 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);

-*- <_74148>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by vapier (Updated the item)
  • -email is unavailable- added by pekberg (Posted a comment)
  • -email is unavailable- added by _74148 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-01-17 vapier Open/ClosedOpen Closed
    2014-05-02 pekberg StatusNone Done

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code