[m-rev.] for review: Further prevent use of non-local gotos with PIC on x86 with GCC 5+.

Julien Fischer jfischer at opturion.com
Mon May 10 15:12:57 AEST 2021


Hi Peter,

On Mon, 10 May 2021, Peter Wang wrote:

> 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.
>

...

> diff --git a/README.x86 b/README.x86
> new file mode 100644
> index 000000000..d35f17a34
> --- /dev/null
> +++ b/README.x86
> @@ -0,0 +1,24 @@
> +Due to improvements in GCC, the following combination is not supported:
> +
> +  - GCC version 5 and above
> +  - x86
> +  - PIC (position-independent code), i.e. dynamic linking
> +  - low-level C grades using non-local gotos, i.e. asm_fast.*
> +
> +The configure script will not select asm_fast grades when that combination is

s/that/the above/

> +detected. If you try to use that combination by selecting an asm_fast grade
> +manually, you will encounter compile time errors.

s/compile time/compilation/

> +We recommend using high-level C grades (hlc.*) on x86. If you require a
> +low-level C grade, e.g. for debugging, then you can use a reg.* grade.
> +
> +If you must use an asm_fast grade, you will need to tell the C compiler not to
> +generate position-independent code, and disable building of shared libraries.
> +Alternatively, you could downgrade to gcc 4.9.
> +
> +Note that Windows is unaffected by this issue as Windows does not use PIC,
> +and we do not yet support shared libraries (DLLs) on Windows anyway.
> +
> +Also note x86-64 is not affected by this issue, only x86.

That's fine otherwise.

Julien.


More information about the reviews mailing list