Hi Marek, > On 19 May 2023, at 00:32, Marek Polacek via Gcc-patches wrote: > > On Tue, May 16, 2023 at 09:11:27PM +0100, Iain Sandoe wrote: >> Hi Marek, >> >>> On 16 May 2023, at 16:29, Marek Polacek via Gcc-patches wrote: >>> >>> Ping. >> >> I’m trying this on Darwin (since I have a local patch to do this for modern [darwin20+] >> versions, which do not allow non-PIE) > > Thanks, this patch is unfortunately more complicated than I expected, > so any testing is very much appreciated. Yeah, one reason my local patches have not been posted, it’s time-consuming work. Unfortunately, we are not quite there yet... On Darwin [Mach-o] PIC and PIE have different semantics from ELF. - PIE is applicable to linking executables - To link PIE, the input objects must be built PIC. - “-pie” is not applicable to linking other DSOs (dylibs, bundles, modules[notc++20 ones!]) so … I’m attaching a patch addition that deals with making host_pie imply host_shared for Darwin, which means a top-level configure change to recognise —enable-host-pie there. However - that does not fix a second issue that I am now getting diagnostics about “-pie being passed to link lines for non-exec outputs (but maybe I can “fix” that in Darwin’s specs). It remains to be seen if other non-binutils linkers have similar issues. Might I suggest that you also try to do a build of GCC with GMP and friends as sources symlinked in-tree (I would expect that a similar situation would exist where they need to be built PIC or PIE (if that is sufficient)). Trying Solaris and AIX on the cfarm might also be a worthwhile diversion. >> I think you are missing a hunk to deal with Ada. > > You're right (and I missed Modula2 too). I've fixed that problem in > the ada/ and m2/ hunks. CCing Eric and Gaius thus. I've tested this > patch with all languages, with/without --enable-host-pie, non/bootstrap, > and all combinations on both Debian and Fedora. Does this seem OK for > trunk? > > Thanks again for spotting the Ada problem; it would have been unpleasant > to deal with it after pushing the patch. I will re-combine and re-test. Iain