Bug creation and email sending has been disabled, file new bugs at gcc.gnu.org/bugzilla
Bug 296 - Compile Error on FreeBSD PowerPC64
Summary: Compile Error on FreeBSD PowerPC64
Status: ASSIGNED
Alias: None
Product: GDC
Classification: Unclassified
Component: gdc (show other bugs)
Version: 7.x
Hardware: PPC FreeBSD
: --- normal
Assignee: Iain Buclaw
URL:
Depends on:
Blocks:
 
Reported: 2018-07-05 15:34 CEST by Curtis
Modified: 2018-08-29 01:54 CEST (History)
0 users

See Also:


Attachments
Partial build log (50.66 KB, text/x-log)
2018-07-05 15:34 CEST, Curtis
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Curtis 2018-07-05 15:34:35 CEST
Created attachment 94 [details]
Partial build log

While trying to build for GCC7 on FreeBSD PowerPC64, I get a linker error:

default-d.o:(.data.rel+0x0): undefined reference to `rs6000_d_target_versions()'

This function is in 'rs6000-d.c' and is not being compiled and linked. 

I've been successful in building GDC with earlier patches for GCC5, however, the more recent patches seem to have issues on powerpc64.
Comment 1 Iain Buclaw 2018-07-05 16:54:01 CEST
Hmm, looks like the v7 patches are missing a piece.

This is what's in master:
https://github.com/D-Programming-GDC/GDC/blob/869276b573228f13c15e467a858d37a72c40618d/gcc/d/patches/patch-targetdm-9.patch#L311-L329


However in the version 7 branch:
https://github.com/D-Programming-GDC/GDC/blob/9328415ccf6656d91b00f3e77a5a7d2244567f25/gcc/d/patches/patch-targetdm-7.patch#L310-L320


Can you apply the missing patch and see if that works for you?
Comment 2 Curtis 2018-07-06 15:28:24 CEST
I'm sure you know that the patches above are against different gcc code bases.  It is difficult to determine if anything is missing, because the code is so different.  At any rate I applied the patch in master with code rejects for "powerpcspe" which are not in the gcc 7 code base. I got the error:

".. fatal error: tm_d.h: No such file or directory"

I also took a look at the v7 patches and there's a patch "patch-targetdm-untested-7.patch", that I gave a try, which presented different errors.

Regards
Comment 3 Iain Buclaw 2018-07-06 18:32:30 CEST
(In reply to Curtis from comment #2)
> I'm sure you know that the patches above are against different gcc code
> bases.  It is difficult to determine if anything is missing, because the
> code is so different.  At any rate I applied the patch in master with code
> rejects for "powerpcspe" which are not in the gcc 7 code base. I got the
> error:
> 
> ".. fatal error: tm_d.h: No such file or directory"
> 

Indeed, I just spotted that there is nothing in the v7 patch that looks like this:

    d_target_objs="rs6000-d.o"

If I recall right, that's because the powerpc configure path adds rs6000-d.o using this assignment:

    d_target_objs="${d_target_objs} ${cpu_type}-d.o"

Which is too absent from the v7 patches.  So ig you look at that particular hunk, what you are searching for in the config.gcc file is the following line:

    cxx_target_objs="${cxx_target_objs} ${cpu_type}-c.o"

You want to add the d_target_objs assignment *after* that.


> I also took a look at the v7 patches and there's a patch
> "patch-targetdm-untested-7.patch", that I gave a try, which presented
> different errors.
> 

The untested patch series just adds architectures not covered by CI, there's nothing powerpc related there.  We already have powerpc64le builds tested, so I know that everything more or less is fine on master.  The problem is that that specific the change did not make it to other branches it seems.
Comment 4 Curtis 2018-07-08 14:48:13 CEST
Thanks for the tip.  I made the below changes to the patch to get things to work.

@@ -3089,6 +3089,7 @@
 if [ "$target_has_targetcm" = "no" ]; then
   c_target_objs="$c_target_objs default-c.o"
   cxx_target_objs="$cxx_target_objs default-c.o"
+  d_target_objs="$d_target_objs default-d.o"
 fi
 
 if [ "$common_out_file" = "" ]; then
@@ -4586,6 +4587,7 @@
 		out_file=rs6000/rs6000.c
 		c_target_objs="${c_target_objs} rs6000-c.o"
 		cxx_target_objs="${cxx_target_objs} rs6000-c.o"
+		d_target_objs="${d_target_objs} rs6000-d.o"
 		tmake_file="rs6000/t-rs6000 ${tmake_file}"
 		;;
 

However, the library sources no longer compile like they did under GCC/GDC 5. Correct me if I'm wrong. But it seems these sources are based on DMD2, as the earlier code was LDC based.
Comment 5 Iain Buclaw 2018-08-29 01:50:16 CEST
(In reply to Curtis from comment #4)
> Thanks for the tip.  I made the below changes to the patch to get things to
> work.
> 
> @@ -3089,6 +3089,7 @@
>  if [ "$target_has_targetcm" = "no" ]; then
>    c_target_objs="$c_target_objs default-c.o"
>    cxx_target_objs="$cxx_target_objs default-c.o"
> +  d_target_objs="$d_target_objs default-d.o"
>  fi
>  
>  if [ "$common_out_file" = "" ]; then
> @@ -4586,6 +4587,7 @@
>  		out_file=rs6000/rs6000.c
>  		c_target_objs="${c_target_objs} rs6000-c.o"
>  		cxx_target_objs="${cxx_target_objs} rs6000-c.o"
> +		d_target_objs="${d_target_objs} rs6000-d.o"
>  		tmake_file="rs6000/t-rs6000 ${tmake_file}"
>  		;;
>  
> 
> However, the library sources no longer compile like they did under GCC/GDC
> 5. Correct me if I'm wrong. But it seems these sources are based on DMD2, as
> the earlier code was LDC based.

They've only ever been merged from dlang/druntime.

Someone else got in touch, and I think what you are referring to is the lack of any defined platform versions, this is expected, as FreeBSD is an untested port.

There needs to be a new target source created, and fill in the appropriate target hooks.
Comment 6 Iain Buclaw 2018-08-29 01:54:52 CEST
First part is dealt with here.

https://github.com/D-Programming-GDC/GDC/pull/726