diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index 07ef2ca5953..475e0349ff8 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -1573,6 +1573,16 @@ gld${EMULATION_NAME}_after_open (void)

    pe_output_file_set_long_section_names (link_info.output_bfd);

+  /* The RVAs of these symbols will be written into the PE header, so they
+     must not be collected.  */
+#if defined (TARGET_IS_i386pe)
+  lang_add_gc_name ("__tls_used");
+  lang_add_gc_name ("__load_config_used");
+#else
+  lang_add_gc_name ("_tls_used");
+  lang_add_gc_name ("_load_config_used");
+#endif
+
  #ifdef DLL_SUPPORT
    pe_process_import_defs (link_info.output_bfd, &link_info);

diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
index 14be8435685..1ab5c4d88f7 100644
--- a/ld/emultempl/pep.em
+++ b/ld/emultempl/pep.em
@@ -1624,6 +1624,11 @@ gld${EMULATION_NAME}_after_open (void)

    pep_output_file_set_long_section_names (link_info.output_bfd);

+  /* The RVAs of these symbols will be written into the PE header, so they
+     must not be collected.  */
+  lang_add_gc_name ("_tls_used");
+  lang_add_gc_name ("_load_config_used");
+
  #ifdef DLL_SUPPORT
    pep_process_import_defs (link_info.output_bfd, &link_info);

