From a45362e582e24f7997edc25dde660297bde710f5 Mon Sep 17 00:00:00 2001 From: Arthur Cohen Date: Fri, 12 Apr 2024 13:52:18 +0200 Subject: rust: Do not link with libdl and libpthread unconditionally ChangeLog: * Makefile.tpl: Add CRAB1_LIBS variable. * Makefile.in: Regenerate. * configure: Regenerate. * configure.ac: Check if -ldl and -lpthread are needed, and if so, add them to CRAB1_LIBS. gcc/rust/ChangeLog: * Make-lang.in: Remove overazealous LIBS = -ldl -lpthread line, link crab1 against CRAB1_LIBS. --- gcc/rust/Make-lang.in | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'gcc') diff --git a/gcc/rust/Make-lang.in b/gcc/rust/Make-lang.in index dd94c9b..edcf2ee 100644 --- a/gcc/rust/Make-lang.in +++ b/gcc/rust/Make-lang.in @@ -54,8 +54,6 @@ GCCRS_D_OBJS = \ rust/rustspec.o \ $(END) -LIBS += -ldl -lpthread - gccrs$(exeext): $(GCCRS_D_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBDEPS) +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ $(GCCRS_D_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \ @@ -234,7 +232,7 @@ crab1$(exeext): $(RUST_ALL_OBJS) attribs.o $(BACKEND) $(LIBDEPS) $(LIBPROC_MACRO @$(call LINK_PROGRESS,$(INDEX.rust),start) +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ $(RUST_ALL_OBJS) attribs.o $(BACKEND) \ - $(LIBS) $(LIBPROC_MACRO_INTERNAL) $(LIBFORMAT_PARSER) $(LIBFFI_POLONIUS) \ + $(LIBS) $(CRAB1_LIBS) $(LIBPROC_MACRO_INTERNAL) $(LIBFORMAT_PARSER) $(LIBFFI_POLONIUS) \ $(BACKENDLIBS) @$(call LINK_PROGRESS,$(INDEX.rust),end) @@ -496,4 +494,4 @@ rust/libffi_polonius.a: \ rust/checks/errors/borrowck/ffi-polonius/Cargo.toml \ $(wildcard $(srcdir)/rust/checks/errors/borrowck/ffi-polonius/src/*) cargo build --manifest-path $(srcdir)/rust/checks/errors/borrowck/ffi-polonius/Cargo.toml --release --target-dir rust/ffi-polonius - cp rust/ffi-polonius/release/libffi_polonius.a rust/libffi_polonius.a \ No newline at end of file + cp rust/ffi-polonius/release/libffi_polonius.a rust/libffi_polonius.a -- cgit v1.1