Bug 268901 - lang/gcc*: not WITH_PIE safe
Summary: lang/gcc*: not WITH_PIE safe
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Lorenzo Salvadore
URL:
Keywords:
Depends on:
Blocks: 272898
  Show dependency treegraph
 
Reported: 2023-01-12 08:20 UTC by Alexander Leidinger
Modified: 2023-08-02 19:21 UTC (History)
1 user (show)

See Also:
salvadore: maintainer-feedback+


Attachments
Poudriere build log, default gcc options plus WITH_PIE (35.95 KB, text/plain)
2023-01-12 17:59 UTC, Alexander Leidinger
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Leidinger freebsd_committer freebsd_triage 2023-01-12 08:20:52 UTC
Hi,

building the port with WITH_PIE makes it fail (configure error). Until this is fixed, the port should get PIE_UNSAFE=yes in the Makefile (this fixes the build for me).

Bye,
Alexander.
Comment 1 Lorenzo Salvadore freebsd_committer freebsd_triage 2023-01-12 10:20:17 UTC
I have started investigating the issue, but I am unable to reproduce it for now (I am still trying). Could you please share more information about your settings? Are you using poudriere? Which FreeBSD version and which architecture are you using? Which options have you enabled?

Is it possible that the issue is with some dependency of gcc12 rather than with gcc12 itself?

GCC has many configure scripts: are you able to tell which one is failing? May I ask you to share your config.log file with the failure?

Thanks.
Comment 2 Alexander Leidinger freebsd_committer freebsd_triage 2023-01-12 10:36:29 UTC
(In reply to Lorenzo Salvadore from comment #1)

-current
poudriere
stock options for gcc

make.conf has:
WITH_PIE=yes
WITH_RELRO=yes
WITH_BIND_NOW=yes
OPTIONS_SET=ICONV MMX OPTIMIZED_CFLAGS SEM SIMD OPENMP
CFLAGS=-O2 -pipe
DEFAULT_VERSIONS=python=3.11 python3=3.11

Would the poudriere log be helpful? I could provide that in some hours.

What I see (transcribed from a remote-ssh on my phone):
checking for library containing strerror... configure: error: Link tests not allowed after GCC_NO_EXECUTABLES.
this is in "... [Makefile:12231: configure-stage1-libiberty] Error 1"
This test itself get's a "yes" after the error message.
Comment 3 Alexander Leidinger freebsd_committer freebsd_triage 2023-01-12 10:56:50 UTC
And another one for the lto plugin, the check for a cross-compile can't run the executable result.
Comment 4 Lorenzo Salvadore freebsd_committer freebsd_triage 2023-01-12 12:39:11 UTC
Yes, thanks: the poudriere log would be helpful.

May I ask you to check if you can reproduce the issue with LTO_BOOTSTRAP option disabled? If the bug is specific to LTO_BOOTSTRAP enabled I will not be able to reproduce it: my machine does not have enough resources to build the port in an acceptable time with that option enabled. In that case I would just trust your report and add PIE_UNSAFE=yes as you suggest, but only when LTO_BOOTSTRAP is on.
Comment 5 Alexander Leidinger freebsd_committer freebsd_triage 2023-01-12 14:08:18 UTC
(In reply to Lorenzo Salvadore from comment #4)

I tried without LTE_BOOTSTRAP and without PIE_UNSAFE: builds ok.

Do you still want the log of the failure case?
Comment 6 Alexander Leidinger freebsd_committer freebsd_triage 2023-01-12 17:59:24 UTC
Created attachment 239422 [details]
Poudriere build log, default gcc options plus WITH_PIE
Comment 7 Lorenzo Salvadore freebsd_committer freebsd_triage 2023-01-12 21:18:38 UTC
Thanks Alexander.

Since the error happens at the beginning of the process, I am able to reproduce it even on my machine once I enable LTO_BOOTSTRAP. I am going to study how to fix the issue. If I cannot find a fix in a few days, I will introduce PIE_UNSAFE as you suggested as a workaround.
Comment 8 Lorenzo Salvadore freebsd_committer freebsd_triage 2023-01-12 23:06:55 UTC
The issue is also present with STANDARD_BOOTSTRAP enabled.
Comment 9 Lorenzo Salvadore freebsd_committer freebsd_triage 2023-01-21 21:11:55 UTC
I cannot find the time to investigate the issue properly, so I am going to introduce the workaround for now. I am going to mark PIE_UNSAFE the -devel ports first, when updating them to their latest weekly snapshot; then I will modify lang/gcc11 and lang/gcc12 too.

I will not close the bug report once the workaround is introduced as I believe it should be possible to do better.
Comment 10 commit-hook freebsd_committer freebsd_triage 2023-01-22 09:10:52 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d10424ba993b72ecfb07b1199b8015a4991a2a86

commit d10424ba993b72ecfb07b1199b8015a4991a2a86
Author:     Lorenzo Salvadore <salvadore@FreeBSD.org>
AuthorDate: 2023-01-21 21:00:41 +0000
Commit:     Lorenzo Salvadore <salvadore@FreeBSD.org>
CommitDate: 2023-01-22 09:09:57 +0000

    lang/gcc11-devel: Mark PIE_UNSAFE if a BOOTSTRAP option is enabled

    Building the port with WITH_PIE fails if STANDARD_BOOTSTRAP or
    LTO_BOOTSTRAP option is enabled.

    Mark PIE_UNSAFE when such an option is enabled until a better solution
    is found.

    PR:             268901
    Reported by:    netchild

 lang/gcc11-devel/Makefile | 3 +++
 1 file changed, 3 insertions(+)
Comment 11 commit-hook freebsd_committer freebsd_triage 2023-01-23 00:16:48 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=80494beb223980f77d45bc8797253d284da8acbb

commit 80494beb223980f77d45bc8797253d284da8acbb
Author:     Lorenzo Salvadore <salvadore@FreeBSD.org>
AuthorDate: 2023-01-22 19:43:10 +0000
Commit:     Lorenzo Salvadore <salvadore@FreeBSD.org>
CommitDate: 2023-01-23 00:15:46 +0000

    lang/gcc12-devel: Mark PIE_UNSAFE if a BOOTSTRAP option is enabled

    Building the port with WITH_PIE fails if STANDARD_BOOTSTRAP or
    LTO_BOOTSTRAP option is enabled.

    Mark PIE_UNSAFE when such an option is enabled until a better solution
    is found.

    PR:             268901
    Reported by:    netchild

 lang/gcc12-devel/Makefile | 3 +++
 1 file changed, 3 insertions(+)
Comment 12 commit-hook freebsd_committer freebsd_triage 2023-01-24 00:38:51 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=08587f681899354917a2a8c7b6719bf0b8863b28

commit 08587f681899354917a2a8c7b6719bf0b8863b28
Author:     Lorenzo Salvadore <salvadore@FreeBSD.org>
AuthorDate: 2023-01-23 23:58:10 +0000
Commit:     Lorenzo Salvadore <salvadore@FreeBSD.org>
CommitDate: 2023-01-24 00:37:44 +0000

    lang/gcc13-devel: Mark PIE_UNSAFE if a BOOTSTRAP option is enabled

    Building the port with WITH_PIE fails if STANDARD_BOOTSTRAP or
    LTO_BOOTSTRAP option is enabled.

    Mark PIE_UNSAFE when such an option is enabled until a better solution
    is found.

    PR:             268901
    Reported by:    netchild

 lang/gcc13-devel/Makefile | 3 +++
 1 file changed, 3 insertions(+)
Comment 13 commit-hook freebsd_committer freebsd_triage 2023-02-03 13:02:38 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0b8cadc9870038fe668eae4604b1de4a55c2e6a1

commit 0b8cadc9870038fe668eae4604b1de4a55c2e6a1
Author:     Lorenzo Salvadore <salvadore@FreeBSD.org>
AuthorDate: 2023-02-03 10:28:25 +0000
Commit:     Lorenzo Salvadore <salvadore@FreeBSD.org>
CommitDate: 2023-02-03 13:01:37 +0000

    lang/gcc11: Mark PIE_UNSAFE

    Building the port with WITH_PIE fails if STANDARD_BOOTSTRAP or
    LTO_BOOTSTRAP option is enabled.

    Mark PIE_UNSAFE when such an option is enabled until a better solution
    is found.

    PR:             268901
    Reported by:    netchild

 lang/gcc11/Makefile | 2 ++
 1 file changed, 2 insertions(+)
Comment 14 commit-hook freebsd_committer freebsd_triage 2023-02-03 15:12:05 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=444f183cebf8b5e304b143a900e2f70f1e30bde4

commit 444f183cebf8b5e304b143a900e2f70f1e30bde4
Author:     Lorenzo Salvadore <salvadore@FreeBSD.org>
AuthorDate: 2023-02-03 13:03:28 +0000
Commit:     Lorenzo Salvadore <salvadore@FreeBSD.org>
CommitDate: 2023-02-03 15:11:03 +0000

    lang/gcc12: Mark PIE_UNSAFE

    Building the port with WITH_PIE fails if STANDARD_BOOTSTRAP or
    LTO_BOOTSTRAP option is enabled.

    Mark PIE_UNSAFE when such an option is enabled until a better solution
    is found.

    PR:             268901
    Reported by:    netchild

 lang/gcc12/Makefile | 2 ++
 1 file changed, 2 insertions(+)
Comment 15 commit-hook freebsd_committer freebsd_triage 2023-02-04 09:11:41 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=b6a5871a0cf40dfc194217704e2dc03e2e91fb62

commit b6a5871a0cf40dfc194217704e2dc03e2e91fb62
Author:     Lorenzo Salvadore <salvadore@FreeBSD.org>
AuthorDate: 2023-02-03 19:12:49 +0000
Commit:     Lorenzo Salvadore <salvadore@FreeBSD.org>
CommitDate: 2023-02-04 09:10:55 +0000

    lang/gcc10: Mark PIE_UNSAFE

    Building the port with WITH_PIE fails if the BOOTSTRAP option is
    enabled. Mark PIE_UNSAFE when this option is enabled until a better
    solution is found.

    PR:             268901
    Reported by:    netchild

 lang/gcc10/Makefile | 1 +
 1 file changed, 1 insertion(+)