Skip to content

Conditionally disable command line length work-around in Makefile.in #2098

@jaganmn

Description

@jaganmn

The work-around in question is here:

flint/Makefile.in

Lines 411 to 430 in 74907c3

ifneq ($(SHARED), 0)
shared: $(FLINT_DIR)/$(FLINT_LIB_FULL)
# The following is to avoid reaching the maximum length of command line
# arguments, mainly present on MinGW.
define xxx_merged_lobj_rule
$(BUILD_DIR)/$(1)_merged.lo: $($(1)_LOBJS) | $(BUILD_DIR)
@$(LD) -r $($(1)_LOBJS) -o $(BUILD_DIR)/$(1)_merged.lo
endef
$(foreach dir, $(DIRS), $(eval $(call xxx_merged_lobj_rule,$(dir))))
MERGED_LOBJS:=$(foreach dir, $(DIRS),$(BUILD_DIR)/$(dir)_merged.lo)
$(FLINT_DIR)/$(FLINT_LIB_FULL): $(MERGED_LOBJS)
@echo "Building $(FLINT_LIB_FULL)"
@$(CC) $(CFLAGS) -shared $(EXTRA_SHARED_FLAGS) $(MERGED_LOBJS) -o $(FLINT_LIB_FULL) $(LDFLAGS) $(LIBS)
@$(RM_F) $(FLINT_LIB)
@$(RM_F) $(FLINT_LIB_MAJOR)
@$(LN_S) $(FLINT_LIB_FULL) $(FLINT_LIB)
@$(LN_S) $(FLINT_LIB_FULL) $(FLINT_LIB_MAJOR)
endif

Unfortunately, not all linkers support the -r option. Notably the MinGW backend for lld, the LLVM linker, does not support it, preventing cross-compiling of FLINT under Unix for aarch64 Windows: https://github.com/llvm/llvm-project/blob/main/lld/MinGW/Options.td

Can this work-around be used only on Windows and systems where it is known to be necessary?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions