summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2019-07-28 17:49:47 -0700
committerH. Peter Anvin <hpa@zytor.com>2019-07-28 17:49:47 -0700
commit6a0211683700b59d6f9ceca37a86e8beb5b655d2 (patch)
tree2673c7f87c7bf37fd0c34c9ace4127cc4a94d396
parenteff611afbe2ce155914351f2895fd2e23948453c (diff)
downloadsamples-6a0211683700b59d6f9ceca37a86e8beb5b655d2.tar.gz
samples-6a0211683700b59d6f9ceca37a86e8beb5b655d2.tar.xz
samples-6a0211683700b59d6f9ceca37a86e8beb5b655d2.zip
exe.ld: don't pick up relocation sections prematurely
?*_TEXT etc would pick up .rel_TEXT etc. Have these patterns not match a leading dot. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--exe.ld20
1 files changed, 8 insertions, 12 deletions
diff --git a/exe.ld b/exe.ld
index 810d39a..9957c11 100644
--- a/exe.ld
+++ b/exe.ld
@@ -4,28 +4,24 @@ ENTRY(___start)
SECTIONS
{
/*
- * The PSP is really at offset -256, but that drives the
- * current version of ld crazy. Doing it this way is OK *if
- * and only if* we don't care about 32-bit (R_386_32)
- * relocations producing correct results. Pure MZ EXE files
- * don't support 32-bit relocations anyway, so this is OK for
- * now.
+ * DOS relocations for EXE are based at the start of the
+ * loaded program, not the start of the PSP; therefore the
+ * PSP is functionally at a negative offset.
*/
- _PSP 0xfff00 (NOLOAD) : {
+ _PSP -256 (NOLOAD) : {
PROVIDE(__psp! = .);
PROVIDE(__psp = .);
- /* May have additional symbols provided by the runtime */
+ /* The runtime may provide a better definition of the PSP */
KEEP(*(_PSP));
- . = __psp + 256;
}
. = 0;
far_TEXT : {
- *(SORT_BY_NAME(SORT_BY_ALIGNMENT(?*_TEXT*)))
+ *(SORT_BY_NAME(SORT_BY_ALIGNMENT([^.]*_TEXT*)))
}
far_DATA : {
- *(SORT_BY_NAME(SORT_BY_ALIGNMENT(?*_*DATA*)))
+ *(SORT_BY_NAME(SORT_BY_ALIGNMENT([^.]*_*DATA*)))
}
_TEXT ALIGN(16) : {
@@ -82,7 +78,7 @@ SECTIONS
far_BSS ALIGN(16) : {
PROVIDE(___farbss_start = .);
- *(SORT_BY_NAME(SORT_BY_ALIGNMENT(?*_BSS*)))
+ *(SORT_BY_NAME(SORT_BY_ALIGNMENT([^,]*_BSS*)))
PROVIDE(___farbss_end = .);
}