Skip to content

Commit

Permalink
app-emulation/dosemu: unbreak misaligned .sys files, bug #631190
Browse files Browse the repository at this point in the history
In bug #618366 I've added -no-pie LDFLAGS propagation to 16-bit targets
but did not notice dosemu has different varying base addresses for
different .com files (and I've overlooked 0-based .sys rules).

Specifying wrong base address caused incorrect jump offsets
into the final binary. That caused crash and hangup of cdrom.sys
driver.

This change restores original base addresses.

Reported-by: Tom
Reported-by: Robert Gill
Bug: https://bugs.gentoo.org/631190
Package-Manager: Portage-2.3.13, Repoman-2.3.4
RepoMan-Options: --force
  • Loading branch information
Sergei Trofimovich committed Nov 4, 2017
1 parent 96f70b0 commit 26a7cae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ diff --git a/Makefile.conf.in b/Makefile.conf.in
index cd4b34d..cc29931 100644
--- a/Makefile.conf.in
+++ b/Makefile.conf.in
@@ -55,2 +55,4 @@ ALL_LDFLAGS:=@DOSEMU_LDFLAGS@ ${LDFLAGS}
@@ -55,2 +55,3 @@ ALL_LDFLAGS:=@DOSEMU_LDFLAGS@ ${LDFLAGS}
DOSBIN_LDFLAGS:=@DOSBIN_LDFLAGS@
+# flags to "link" 16-bit .com files
+IA16_LDFLAGS:=-Wl,-Ttext,0x100,-e,_start16,--oformat,binary -nostdlib -s @IA16_LDFLAGS_EXTRA@
+IA16_LDFLAGS_EXTRA:=@IA16_LDFLAGS_EXTRA@
LIBS:=@LIBS@
diff --git a/configure.ac b/configure.ac
index 0f06f57..a86208e 100644
Expand All @@ -27,12 +26,12 @@ index 3139b85..c5c4607 100644
@@ -56,3 +56,3 @@ dosbin: $(COM1) $(COM2) $(SYS)
$(D)/%.sys: %.o
- $(LD) $(ALL_LDFLAGS) -Wl,-Ttext,0,-e,_start16,--oformat,binary -nostdlib -s -o $@ $<
+ $(LD) $(ALL_LDFLAGS) $(IA16_LDFLAGS) -o $@ $<
+ $(LD) $(ALL_LDFLAGS) -Wl,-Ttext,0,-e,_start16,--oformat,binary -nostdlib -s $(IA16_LDFLAGS_EXTRA) -o $@ $<
chmod -x $@
@@ -60,3 +60,3 @@ $(D)/%.sys: %.o
$(D)/%.com: %.o
- $(LD) $(ALL_LDFLAGS) -Wl,-Ttext,100,-e,_start16,--oformat,binary -nostdlib -s -o $@ $<
+ $(LD) $(ALL_LDFLAGS) $(IA16_LDFLAGS) -o $@ $<
+ $(LD) $(ALL_LDFLAGS) -Wl,-Ttext,100,-e,_start16,--oformat,binary -nostdlib -s $(IA16_LDFLAGS_EXTRA) -o $@ $<
chmod -x $@
diff --git a/src/plugin/commands/Makefile b/src/plugin/commands/Makefile
index 48f49d5..d3a5667 100644
Expand All @@ -41,5 +40,5 @@ index 48f49d5..d3a5667 100644
@@ -57,3 +57,3 @@ $(STUBFULL): $(D)/generic.com ./mkcomstub
$(D)/%.com: %.o
- $(LD) $(ALL_LDFLAGS) -Wl,-Ttext,0x100,-e,_start16,--oformat,binary -nostdlib -s -o $@ $<
+ $(LD) $(ALL_LDFLAGS) $(IA16_LDFLAGS) -o $@ $<
+ $(LD) $(ALL_LDFLAGS) -Wl,-Ttext,0x100,-e,_start16,--oformat,binary -nostdlib -s $(IA16_LDFLAGS_EXTRA) -o $@ $<
chmod -x $@

0 comments on commit 26a7cae

Please sign in to comment.