Commit Graph

2 Commits

Author SHA1 Message Date
Peter Wang
f5b4f67d1a Check for gcc generating PIC by default.
In configure, we try detect the non-working combination of gcc 5+,
targeting x86, PIC, and non-local gotos. We assumed that PIC is only
generated when creating shared libraries, but gcc may have been
configured to generate PIC by default. This is very common on more
recent Linux distributions.

configure.ac:
    Extend the test mentioned above: if shared libraries are disabled,
    check whether gcc generates PIC anyway.

    Clean up the code a little.

m4/mercury.m4:
    Add helper macros MERCURY_CC_TARGETS_X86 and
    MERCURY_CC_GENERATES_PIC.

README.x86:
    Update this document.
2022-02-25 13:43:15 +11:00
Peter Wang
6a18491e03 Further prevent use of non-local gotos with PIC on x86 with GCC 5+.
configure.ac:
    Run the C compiler to check if it actually targets x86-64.
    Previously we assumed if $host is x86_64 then the C compiler will be
    targeting x86-64, but that is not true if gcc -m32 or gcc -mx32 is
    used.

    Then, as before, if the C compiler targets x86 and dynamic linking
    is enabled (except on Windows) and GCC is version 5+ then disable
    selection of any grades that use gcc labels.

runtime/mercury_goto.h:
    Report an error if the user tries to use non-local gotos with PIC
    on x86 with GCC 5+.

README.x86:
    Document the issue.

README.md:
    Add reference to README.x86.
2021-05-10 15:21:04 +10:00