Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 6f278fff75699c4ba60005c2037b525de63f89cd
Ticket: 4d72a5f77f268c6882d974562e53a34354273a31
[tcl] unix build of the 8.5 branch fails to build on Mac OS X with LTO (-flto)
User & Date: anonymous on 2016-09-13 14:57:19
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    I don't think I ever got around reporting this issue here:
    
    Building the generic Unix flavour of Tcl 8.5 on OS X (as done for instance by MacPorts to obtain the interpreter driving the entire build/packaging system) fails when using Link-Time Optimisation (-flto compiler/linker option).
    
    When this option is used, the Tcl build system erroneously detects the presence of the pthread_attr_get_np() function which exists only on Linux; as a result, compilation fails on #include <pthread_np.h> .
    
    This issue boils down to a failing conftest.c programme generated by the configure script (and I think specified by the tcl.m4 file). In essence, this test does
    
    main () {
        char pthread_attr_get_np();
        char (*f)() = pthread_attr_get_np;
        return f != pthread_attr_get_np;
    }
    
    Semantically, the actual value of f is moot in the boolean expression, which in fact can only evaluate to false. With LTO activated, clang recognises this fact, suppresses the reference to the actual function and as a result does not fail to link when that function isn't available.
    
    Adding a call to a function with side-effects (unknown to the linker, such as printf("%p", pthread_attr_get_np); restores the expected behaviour (i.e. the link step fails, and thus the test also).
    
  5. foundin changed to: "8.5"
  6. is_private changed to: "0"
  7. login: "anonymous"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "feaf88b9ff5360927d4e110eb8bf5ebfc61e7c2d"
  10. resolution changed to: "None"
  11. severity changed to: "Minor"
  12. status changed to: "Open"
  13. submitter changed to: "anonymous"
  14. subsystem changed to: "53. Configuration and Build Tools"
  15. title changed to:
    [tcl] unix build of the 8.5 branch fails to build on Mac OS X with LTO (-flto)
    
  16. type changed to: "Bug"