Bug 282797 - lang/gcc15-devel: stage2 fails to compile enable-execute-stack.c
Summary: lang/gcc15-devel: stage2 fails to compile enable-execute-stack.c
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Lorenzo Salvadore
URL: https://pkg-status.freebsd.org/ampere...
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-16 13:56 UTC by John F. Carr
Modified: 2024-11-28 17:24 UTC (History)
0 users

See Also:
salvadore: maintainer-feedback+


Attachments
avoid compiler error in libgcc (563 bytes, patch)
2024-11-17 17:03 UTC, John F. Carr
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John F. Carr 2024-11-16 13:56:43 UTC
On aarch64, FreeBSD 14.2-PRERELEASE, lang/gcc15-devel fails when built with poudriere:

enable-execute-stack.c:33:13: error: 'check_enabling' declared 'static' but never defined [-Werror=unused-function]
   33 | static void check_enabling (void) __attribute__ ((unused));
      |             ^~~~~~~~~~~~~~

The error comes from /wrkdirs/usr/ports/lang/gcc15-devel/work/.build/./gcc/xgcc.

The file with the error is named enable-execute-stack-mprotect.c in the source and has not changed in the past decade.  There is also a file named enable-execute-stack-empty.c.  Possibly gcc is stricter than it used to be.  Possibly FreeBSD started using the mprotect flavor instead of the empty flavor.
Comment 1 Lorenzo Salvadore freebsd_committer freebsd_triage 2024-11-17 13:40:03 UTC
Bug reproduced on CURRENT too:
https://pkg-status.freebsd.org/ampere2/data/main-arm64-default/pdfee61567d9e_s36887e04947/logs/gcc15-devel-15.0.0.s20241110.log

I will look into it as soon as possible. However, as usual, there are many GCC issues open and it might need a bit of time.
Patches are welcome.
Comment 2 John F. Carr 2024-11-17 17:03:13 UTC
Created attachment 255240 [details]
avoid compiler error in libgcc
Comment 3 commit-hook freebsd_committer freebsd_triage 2024-11-28 10:34:50 UTC
A commit in branch main references this bug:

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

commit 2c87bf1deb36339194333ca8720483c0c8aa0ec4
Author:     John F. Carr <jfc@mit.edu>
AuthorDate: 2024-11-23 12:41:34 +0000
Commit:     Lorenzo Salvadore <salvadore@FreeBSD.org>
CommitDate: 2024-11-28 10:32:29 +0000

    lang/gcc15-devel: Fix stage2 fail on aarch64

    PR:             282797

 .../patch-libgcc_enable-execute-stack-mprotect.c (new)    | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
Comment 4 Lorenzo Salvadore freebsd_committer freebsd_triage 2024-11-28 10:40:58 UTC
Please confirm that the issue is fixed. I had only little time so I have been a bit sloppier than usual on testing (it is a -devel port, so it should not be a big deal)...
Comment 5 John F. Carr 2024-11-28 17:24:38 UTC
With the fix for the execute-stack bug I get a different error later:

/wrkdirs/usr/ports/lang/gcc15-devel/work/gcc-15-20241124/libgcc/unwind-dw2-fde-dip.c:69:10: error: 'ElfW' redefined [-Werror]
   69 | # define ElfW __ElfN
      |          ^~~~
In file included from /usr/include/machine/elf.h:45,
                 from /usr/include/elf.h:37,
                 from /wrkdirs/usr/ports/lang/gcc15-devel/work/gcc-15-20241124/libgcc/unwind-dw2-fde-dip.c:36:
/usr/include/sys/elf_generic.h:59:9: note: this is the location of the previous definition
   59 | #define ElfW(x)         __ElfN(x)
      |         ^~~~