Giter Site home page Giter Site logo

support stubs >2K about djgpp-cvs HOT 14 CLOSED

jwt27 avatar jwt27 commented on August 23, 2024
support stubs >2K

from djgpp-cvs.

Comments (14)

jwt27 avatar jwt27 commented on August 23, 2024

As you said this is a binutils issue and not with djgpp itself. But this brings up an interesting point: I don't know where djgpp patches for binutils (or other packages) are developed. As far as I can tell this isn't checked in to source control anywhere. All we get is the zip file from delorie.com with djgpp specific patches already applied.

from djgpp-cvs.

stsp avatar stsp commented on August 23, 2024

I can see them in djgpp/* directory.

from djgpp-cvs.

jwt27 avatar jwt27 commented on August 23, 2024

Yes those are the patch files. But they're not being developed in any cvs/svn/git repository as far as I can tell. And I don't understand why those patches aren't being merged with binutils upstream. You can build the official binutils release with --target=i*86-pc-msdosdjgpp but then you'll end up with subtly broken things like non-functional ldscripts.

from djgpp-cvs.

stsp avatar stsp commented on August 23, 2024

Maybe you can setup the source tree,
review and upstream all the patches. :)

from djgpp-cvs.

jwt27 avatar jwt27 commented on August 23, 2024

Someday, maybe. I have enough other stuff to deal with for now.

from djgpp-cvs.

jwt27 avatar jwt27 commented on August 23, 2024

The number you'll want to change is #define GO32_STUBSIZE 2048 at binutils-2.33.1/include/coff/internal.h line 61.

It looks like binutils always regards the first 2k bytes to be part of the stub, so changing this number will break compatibility with any executables that have a 2k stub. You'd have to find space for a version byte in the stub somewhere and make binutils determine the stub size based on that.

from djgpp-cvs.

jwt27 avatar jwt27 commented on August 23, 2024

Also there's probably a lot of other code out there that expects a fixed stub size, eg. upx and other exe packers.

from djgpp-cvs.

stsp avatar stsp commented on August 23, 2024

MZ header should itself contain the
exe size (stub size) and overlay size
(prog itself), so I hope things like upx
etc do not have this all hard-coded.
But I didn't check.

from djgpp-cvs.

jwt27 avatar jwt27 commented on August 23, 2024

https://github.com/upx/upx/blob/d7ba31cab8ce8d95d2c10e88d2ec787ac52005ef/src/p_djgpp2.cpp#L198-L205
You're right, upx reads the stub size from the header.

On the binutils side it seems everything is nailed down with #defines.

from djgpp-cvs.

stsp avatar stsp commented on August 23, 2024

So at worst case we can lose
compatibility with older binutils.
But this doesn't look like the real
problem.

from djgpp-cvs.

jwt27 avatar jwt27 commented on August 23, 2024

I did some hacking last night... haven't tried it yet.
jwt27/binutils-gdb@djgpp-patches...go32stub
If this works then we can have variable length stubs without losing backward compatibility.

from djgpp-cvs.

stsp avatar stsp commented on August 23, 2024

What do you need to test that? :)
Well, you can just enlarge the no envseg$
msg. Its quite easy to test I think.

from djgpp-cvs.

jwt27 avatar jwt27 commented on August 23, 2024

I took a program with a 2k stub and inserted some bytes before the coff image. objdump seems to work with it. strip crashes in coff_swap_filehdr_out. I think it's because the output filehdr isn't fully allocated.

from djgpp-cvs.

jwt27 avatar jwt27 commented on August 23, 2024

Let's move this discussion to jwt27/binutils-gdb#1 where the patches are.

from djgpp-cvs.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.