aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2023-05-04 14:24:16 +0100
committerNick Clifton <nickc@redhat.com>2023-05-04 14:24:16 +0100
commit3539414584be0094b0a4fe56dfd64ea79d802edc (patch)
tree2f8c8d214e781494a013f58836c77251e284fc7b /ld/emultempl
parent35130e73da95371af99734cda3ef8915a6eb5e7a (diff)
downloadgdb-3539414584be0094b0a4fe56dfd64ea79d802edc.zip
gdb-3539414584be0094b0a4fe56dfd64ea79d802edc.tar.gz
gdb-3539414584be0094b0a4fe56dfd64ea79d802edc.tar.bz2
Stop the linker from loosing the entry point for COFF/PE code when compiling with LTO enabled.
PR 30300 * emultempl/pep.em (set_entry_point): Add an undefined reference to the entry point if it has been constructed heuristically. * emultempl/pe.em (set_entry_point): Likewise.
Diffstat (limited to 'ld/emultempl')
-rw-r--r--ld/emultempl/pe.em3
-rw-r--r--ld/emultempl/pep.em3
2 files changed, 6 insertions, 0 deletions
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index 55412d6..1f2a5f3 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -659,6 +659,9 @@ set_entry_point (void)
}
lang_default_entry (entry);
+
+ if (bfd_link_executable (&link_info) && ! entry_from_cmdline)
+ ldlang_add_undef (entry, false);
}
static void
diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
index 2a3fd0e..ca4acae 100644
--- a/ld/emultempl/pep.em
+++ b/ld/emultempl/pep.em
@@ -631,6 +631,9 @@ set_entry_point (void)
}
lang_default_entry (entry);
+
+ if (bfd_link_executable (&link_info) && ! entry_from_cmdline)
+ ldlang_add_undef (entry, false);
}
static void