binutils/binutils-ld-default-entry-of-0-for-shared.patch
2021-10-01 11:17:12 +01:00

99 lines
3.6 KiB
Diff

--- binutils.orig/ld/ldlang.c 2021-09-17 10:38:18.073366643 +0100
+++ binutils-2.37/ld/ldlang.c 2021-09-17 10:50:50.155450530 +0100
@@ -6978,7 +6978,8 @@ lang_end (void)
if (!bfd_set_start_address (link_info.output_bfd, val))
einfo (_("%F%P: can't set start address\n"));
}
- else
+ /* BZ 2004952: Only use the start of the .text section for executables. */
+ else if bfd_link_executable (&link_info)
{
asection *ts;
@@ -7004,6 +7005,13 @@ lang_end (void)
entry_symbol.name);
}
}
+ else
+ {
+ if (warn)
+ einfo (_("%P: warning: cannot find entry symbol %s;"
+ " not setting start address\n"),
+ entry_symbol.name);
+ }
}
}
diff -rup binutils.orig/ld/testsuite/ld-arm/tls-gdesc-got.d binutils-2.37/ld/testsuite/ld-arm/tls-gdesc-got.d
--- binutils.orig/ld/testsuite/ld-arm/tls-gdesc-got.d 2021-09-29 13:17:21.501277341 +0100
+++ binutils-2.37/ld/testsuite/ld-arm/tls-gdesc-got.d 2021-09-29 13:20:04.481132127 +0100
@@ -2,7 +2,7 @@
.*/tls-lib2-got.so: file format elf32-.*arm.*
architecture: arm.*, flags 0x00000150:
HAS_SYMS, DYNAMIC, D_PAGED
-start address 0x0+8(1e8|220)
+start address 0x[0-9a-f]+
Disassembly of section .got:
diff -rup binutils.orig/ld/testsuite/ld-i386/tlsnopic.rd binutils-2.37/ld/testsuite/ld-i386/tlsnopic.rd
--- binutils.orig/ld/testsuite/ld-i386/tlsnopic.rd 2021-09-29 13:17:21.588276729 +0100
+++ binutils-2.37/ld/testsuite/ld-i386/tlsnopic.rd 2021-09-29 13:20:59.456745814 +0100
@@ -26,7 +26,7 @@ Key to Flags:
#...
Elf file type is DYN \(Shared object file\)
-Entry point 0x1000
+Entry point 0x[0-9a-f]+
There are [0-9]+ program headers, starting at offset [0-9]+
Program Headers:
diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr14207.d binutils-2.37/ld/testsuite/ld-x86-64/pr14207.d
--- binutils.orig/ld/testsuite/ld-x86-64/pr14207.d 2021-09-29 13:17:21.551276989 +0100
+++ binutils-2.37/ld/testsuite/ld-x86-64/pr14207.d 2021-09-29 13:21:27.632547838 +0100
@@ -5,7 +5,7 @@
#target: x86_64-*-linux*
Elf file type is DYN \(Shared object file\)
-Entry point 0x149
+Entry point 0x[0-9a-f]+
There are 4 program headers, starting at offset 64
Program Headers:
diff -rup binutils.orig/ld/testsuite/ld-x86-64/tlsdesc.rd binutils-2.37/ld/testsuite/ld-x86-64/tlsdesc.rd
--- binutils.orig/ld/testsuite/ld-x86-64/tlsdesc.rd 2021-09-29 13:17:21.554276968 +0100
+++ binutils-2.37/ld/testsuite/ld-x86-64/tlsdesc.rd 2021-09-29 13:21:47.920405285 +0100
@@ -29,7 +29,7 @@ Key to Flags:
#...
Elf file type is DYN \(Shared object file\)
-Entry point 0x1000
+Entry point 0x[0-9a-f]+
There are [0-9]+ program headers, starting at offset [0-9]+
Program Headers:
diff -rup binutils.orig/ld/testsuite/ld-x86-64/tlspic.rd binutils-2.37/ld/testsuite/ld-x86-64/tlspic.rd
--- binutils.orig/ld/testsuite/ld-x86-64/tlspic.rd 2021-09-29 13:17:21.546277025 +0100
+++ binutils-2.37/ld/testsuite/ld-x86-64/tlspic.rd 2021-09-29 13:22:04.224290720 +0100
@@ -29,7 +29,7 @@ Key to Flags:
#...
Elf file type is DYN \(Shared object file\)
-Entry point 0x1000
+Entry point 0x[0-9a-f]+
There are [0-9]+ program headers, starting at offset [0-9]+
Program Headers:
diff -rup binutils.orig/ld/testsuite/ld-x86-64/tlspic2.rd binutils-2.37/ld/testsuite/ld-x86-64/tlspic2.rd
--- binutils.orig/ld/testsuite/ld-x86-64/tlspic2.rd 2021-09-29 13:17:21.552276982 +0100
+++ binutils-2.37/ld/testsuite/ld-x86-64/tlspic2.rd 2021-09-29 13:22:18.432190887 +0100
@@ -30,7 +30,7 @@ Key to Flags:
#...
Elf file type is DYN \(Shared object file\)
-Entry point 0x1000
+Entry point 0x[0-9a-f]+
There are [0-9]+ program headers, starting at offset [0-9]+
Program Headers: