On Monday, May 5th, 2025 at 07:13, Mark Millard <mark...@yahoo.com> wrote:

> 
> 
> On May 4, 2025, at 03:13, Mark Millard mark...@yahoo.com wrote:
> 
> > On May 4, 2025, at 01:18, Lorenzo Salvadore develo...@lorenzosalvadore.it 
> > wrote:
> > 
> > > On Sunday, May 4th, 2025 at 05:07, Mark Millard mark...@yahoo.com wrote:
> > > 
> > > > FYI:
> > > > 
> > > > /wrkdirs/usr/ports/lang/gcc15/work/gcc-15.1.0/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/work/gcc-15.1.0/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)
> > > > | ^~~~
> > > 
> > > Hi Mark,
> > > 
> > > Could you please test the patch below?
> > 
> > FYI . . .
> > 
> > I've been using:
> > 
> > # git -C /usr/ports/ status lang/gcc15-devel/
> > On branch main
> > Your branch is up to date with 'freebsd/main'.
> > 
> > Untracked files:
> > (use "git add <file>..." to include in what will be committed)
> > lang/gcc15-devel/files/patch-libgcc_unwind-dw2-fde-dip.c
> > 
> > nothing added to commit but untracked files present (use "git add" to track)
> > 
> > # cat /usr/ports/lang/gcc15-devel/files/patch-libgcc_unwind-dw2-fde-dip.c
> > --- 
> > /wrkdirs/usr/ports/lang/gcc15-devel/work/gcc-15-20250209/libgcc/unwind-dw2-fde-dip.c.orig
> >  2025-02-27 22:35:01.497828000 -0800
> > +++ 
> > /wrkdirs/usr/ports/lang/gcc15-devel/work/gcc-15-20250209/libgcc/unwind-dw2-fde-dip.c
> >  2025-02-27 22:37:07.418603000 -0800
> > @@ -66,7 +66,6 @@
> > #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
> > && defined(TARGET_DL_ITERATE_PHDR) \
> > && (defined(DragonFly) || defined(FreeBSD))
> > -# define ElfW __ElfN
> > # define USE_PT_GNU_EH_FRAME
> > #endif
> > 
> > for my rare builds of lang/gcc15-devel/ prior to lang/gcc15
> > existing. I've used the patch on amd64 as well, even though
> > it does not get the error.
> > 
> > For lang/gcc15/ I'm now using:
> > 
> > # cat /usr/ports/lang/gcc15/files/patch-libgcc_unwind-dw2-fde-dip.c
> > --- 
> > /wrkdirs/usr/ports/lang/gcc15/work/gcc-15.1.0/libgcc/unwind-dw2-fde-dip.c.orig
> >  2025-04-25 01:18:04.000000000 -0700
> > +++ 
> > /wrkdirs/usr/ports/lang/gcc15/work/gcc-15.1.0/libgcc/unwind-dw2-fde-dip.c 
> > 2025-05-03 22:11:41.826654000 -0700
> > @@ -66,7 +66,6 @@
> > #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
> > && defined(TARGET_DL_ITERATE_PHDR) \
> > && (defined(DragonFly) || defined(FreeBSD))
> > -# define ElfW __ElfN
> > # define USE_PT_GNU_EH_FRAME
> > #endif
> > 
> > FreeBSD defines ElfW(x) to translate Linux's convention
> > to FreeBSD's convention. gcc15 defines ElfW to convert
> > its convention to FreeBSD's convention. The above take
> > the point of view that just one of the 2 conversions
> > should be in use and that leaving the FreeBSD code alone
> > should be preferred.
> > 
> > I'll note that the range of things built via lang/gcc15*/
> > in my context is small so my use is not all that general
> > of a test.

Thanks for the detailed explanation. I prefer your patch to the
one I had proposed (but thanks for testing it!). In this
week GCC 15 snapshot I am going to commit a slightly different
version of it, that I believe is more upstream friendly.

--- libgcc/unwind-dw2-fde-dip.c.orig    2025-05-16 15:47:38 UTC
+++ libgcc/unwind-dw2-fde-dip.c
@@ -59,13 +59,13 @@
 
 #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
     && defined(TARGET_DL_ITERATE_PHDR) \
-    && defined(__linux__)
+    && (defined(__linux__) || defined(__FreeBSD__))
 # define USE_PT_GNU_EH_FRAME
 #endif
 
 #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
     && defined(TARGET_DL_ITERATE_PHDR) \
-    && (defined(__DragonFly__) || defined(__FreeBSD__))
+    && defined(__DragonFly__)
 # define ElfW __ElfN
 # define USE_PT_GNU_EH_FRAME
 #endif

Once the patch is successfully tested for a while in our
ports tree, I will attempt to upstream it.

Thanks a lot,

Lorenzo Salvadore

Reply via email to