Closed Bug 1486905 Opened 2 years ago Closed 2 years ago

add a way to differentiate between host linker and target linker on Windows

Categories

(Firefox Build System :: General, enhancement)

ARM64
Windows
enhancement
Not set

Tracking

(firefox63 fixed)

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: froydnj, Assigned: froydnj)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

For host and target binaries, we used a single LINKER variable.  At the very least, we should have an explicit HOST_LINKER that defaults to whatever LINKER is, thereby offering the opportunity for somebody to override that value.
I wonder if this would simplify the `WIN64_LINK` code?
This setup seems to work well enough to enable me to link
HOST_SIMPLE_PROGRAMS with an AArch64-cross setup.  Necessary library
paths are passed to the linker via -LIBPATH and HOST_LDFLAGS rather than
letting MSVC fish them out of the environment.  The change to
HOST_SIMPLE_PROGRAMS to pass HOST_LDFLAGS was necessary for this to
work, in addition to the HOST_LINKER changes.

Untested on our actual Windows builds, though, pushing to try now...
Attachment #9004701 - Flags: review?(core-build-config-reviews)
Comment on attachment 9004701 [details] [diff] [review]
add a HOST_LINKER variable for cross windows builds

Never mind, apparently this breaks linting in interesting ways:

https://treeherder.mozilla.org/#/jobs?repo=try&revision=1d8cbc64703bd1c4ee55771d8122cf7d471b85ce

Maybe the correct path forward is not to use the target linker as the default?
Attachment #9004701 - Flags: review?(core-build-config-reviews)
OK, so for some reason, trying to use the target linker as input for the host
didn't work out so well, so this patch just does redetection.
Attachment #9005211 - Flags: review?(core-build-config-reviews)
Attachment #9004701 - Attachment is obsolete: true
Comment on attachment 9005211 [details] [diff] [review]
add a HOST_LINKER variable for cross windows builds

Review of attachment 9005211 [details] [diff] [review]:
-----------------------------------------------------------------

::: config/rules.mk
@@ +689,5 @@
>  $(HOST_SHARED_LIBRARY): $(HOST_OBJS) Makefile
>  	$(REPORT_BUILD)
>  	$(RM) $@
>  ifdef _MSC_VER
>  	# /!\ We assume host and target are using the same compiler

Is this comment still relevant after this patch?
Attachment #9005211 - Flags: review?(core-build-config-reviews) → review+
Pushed by nfroyd@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/345269b39c6c
add a HOST_LINKER variable for cross windows builds; r=dmajor
(In reply to David Major [:dmajor] from comment #5)
> ::: config/rules.mk
> @@ +689,5 @@
> >  $(HOST_SHARED_LIBRARY): $(HOST_OBJS) Makefile
> >  	$(REPORT_BUILD)
> >  	$(RM) $@
> >  ifdef _MSC_VER
> >  	# /!\ We assume host and target are using the same compiler
> 
> Is this comment still relevant after this patch?

No!  Removed it in the committed version, thanks for catching that.
Assignee: nobody → nfroyd
(In reply to David Major [:dmajor] from comment #1)
> I wonder if this would simplify the `WIN64_LINK` code?

It could, if someone wanted to do the work to make our win32 builds actual cross-compiles. Right now they default to 32-bit for both:
13:30:40     INFO -  checking for host system type... i686-pc-mingw32
13:30:40     INFO -  checking for target system type... i686-pc-mingw32
https://hg.mozilla.org/mozilla-central/rev/345269b39c6c
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in before you can comment on or make changes to this bug.