gcc-4.9.1/gcc/config/rs6000/freebsd64.h vs. FreeBSD's powerpc (non-64) L"..." and wchar_t (other gcc ports too?)

Mark Millard markmi at dsl-only.net
Sat Apr 18 21:00:54 UTC 2015


[Looks like I'll soon be suspending my FreeBSD explorations for a time again. So this completes my notes for the subject and related material.]

Reminder of the "long int" issue in gcc-4.9.1/gcc/config/rs6000/freebsd64.h that gets the wrong type for L" . . . " notation for FreeBSD:

> /* rs6000.h gets this wrong for FreeBSD.  We use the GCC defaults instead.  */
> #undef WCHAR_TYPE
> #define WCHAR_TYPE      (TARGET_64BIT ? "int" : "long int")
> #undef  WCHAR_TYPE_SIZE
> #define WCHAR_TYPE_SIZE 32

I did try changing my /usr/obj/portswork/usr/ports/devel/powerpc64-gcc/work/gcc-4.9.1/gcc/config/rs6000/freebsd64.h so that WCHAR_TYPE would always use "int" and rebuilding powerpc64-gcc. With that I was able to compile lib32, no longer having a bad type for the L prefix notation on string literals.

So I expect that requesting a fix upstream and/or patching such files in gcc ports that have such a "long int" for powerpc FreeBSD targets is appropriate.


Side note likely specific to my context in some way . . .

Unfortunately that lib32 built did not mean that using it worked. A -g -m32 compile/link of

> int main()
> {
>     return 0;
> }

produces something for which ./a.out segmentation faults in a way that neither the system nor the port gdb can report on where.

For now it looks like I'm not going to have the time to work on figuring out any of the issues involved.



===
Mark Millard
markmi at dsl-only.net



More information about the freebsd-ports mailing list