Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ RUN cat $PREFIX/src/gcc-*.patch | patch -d/dl/gcc -p1 \
--disable-libstdcxx-verbose \
--disable-dependency-tracking \
--disable-nls \
--disable-lto \
--enable-lto \
--disable-multilib \
CFLAGS_FOR_TARGET="-O2" \
CXXFLAGS_FOR_TARGET="-O2" \
Expand Down Expand Up @@ -359,6 +359,12 @@ RUN /dl/mpc/configure \
&& make -j$(nproc) \
&& make install

COPY --from=dl-zstd /dl/zstd/ /dl/zstd/
WORKDIR /dl/zstd/lib
RUN make -j$(nproc) CC=$ARCH-gcc AR=$ARCH-ar CFLAGS="-O2" libzstd.a \
&& cp libzstd.a /deps/lib/ \
&& cp zstd.h zstd_errors.h zdict.h /deps/include/

WORKDIR /mingw-headers
RUN /dl/mingw/mingw-w64-headers/configure \
--prefix=$PREFIX \
Expand Down Expand Up @@ -411,13 +417,14 @@ RUN echo 'BEGIN {print "pecoff"}' \
--with-gmp=/deps \
--with-mpc=/deps \
--with-mpfr=/deps \
--with-zstd=/deps \
--enable-languages=c,c++,fortran \
--enable-libgomp \
--enable-threads=posix \
--enable-version-specific-runtime-libs \
--disable-libstdcxx-verbose \
--disable-dependency-tracking \
--disable-lto \
--enable-lto \
--disable-multilib \
--disable-nls \
--disable-win32-registry \
Expand Down Expand Up @@ -645,13 +652,6 @@ RUN cat $PREFIX/src/ctags-*.patch | patch -p1 \
&& cp ctags.exe /out/bin/

FROM cross AS build-zstd
COPY --from=dl-zstd /dl/ /dl/

WORKDIR /dl/zstd/lib
RUN make -j$(nproc) CC=$ARCH-gcc AR=$ARCH-ar CFLAGS="-O2" libzstd.a \
&& cp libzstd.a /deps/lib/ \
&& cp zstd.h zstd_errors.h zdict.h /deps/include/

WORKDIR /dl/zstd
RUN make -j$(nproc) -C programs zstd \
CC=$ARCH-gcc CFLAGS="-O2" LDFLAGS="-s" EXT=.exe \
Expand Down
66 changes: 66 additions & 0 deletions src/binutils-pei386-runtime-reloacator-undefinedreference.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -1248,6 +1248,18 @@ make_runtime_ref (void)
}
}

+static bool
+have_plugin_claimed_input (void)
+{
+ lang_input_statement_type *f;
+
+ for (f = (void *) file_chain.head; f != NULL; f = f->next)
+ if (f->flags.claimed)
+ return true;
+
+ return false;
+}
+
static bool
pr_sym (struct bfd_hash_entry *h, void *inf ATTRIBUTE_UNUSED)
{
@@ -1457,7 +1469,9 @@ gld${EMULATION_NAME}_before_plugin_all_symbols_read (void)
{
#ifdef DLL_SUPPORT
if (link_info.lto_plugin_active
- && link_info.pei386_auto_import)
+ && link_info.pei386_auto_import
+ && link_info.pei386_runtime_pseudo_reloc != 0
+ && have_plugin_claimed_input ())
make_runtime_ref ();
#endif
}
diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
index 280949b6e51..a72caf97de9 100644
--- a/ld/emultempl/pep.em
+++ b/ld/emultempl/pep.em
@@ -1254,6 +1254,18 @@ make_runtime_ref (void)
}
}

+static bool
+have_plugin_claimed_input (void)
+{
+ lang_input_statement_type *f;
+
+ for (f = (void *) file_chain.head; f != NULL; f = f->next)
+ if (f->flags.claimed)
+ return true;
+
+ return false;
+}
+
static bool
pr_sym (struct bfd_hash_entry *h, void *inf ATTRIBUTE_UNUSED)
{
@@ -1464,7 +1476,9 @@ gld${EMULATION_NAME}_before_plugin_all_symbols_read (void)
{
#ifdef DLL_SUPPORT
if (link_info.lto_plugin_active
- && link_info.pei386_auto_import) /* -1=warn or 1=enable */
+ && link_info.pei386_auto_import /* -1=warn or 1=enable */
+ && link_info.pei386_runtime_pseudo_reloc != 0
+ && have_plugin_claimed_input ())
make_runtime_ref ();
#endif
}
Loading