'Can I change the default linker script/flags of ld?
I am using a software, which modifies some bytes in an executable. I don't know what it does exactly, but I use it for license protection of the already built binary. To not overcomplicate things, I'm giving a reduced problem that I'm working on, representing everything I know so far.
With this software, for some files I'm getting an error saying "not enough header space". I was told to "change the linker script, add a spacer section after the first load command which starts at 0, or use flags like --file-alignment
or --section-alignment
" to make more space there.
The issue is I don't have control of adding compiler/linker flags or C-Code when building the executable, but I have full control over the OS. That's where my first thoughts about changing the default linker script of ld came from, so I can add the section in every executable that is linked with ld.
Would it otherwise be possible to change the link to the binary of ld in Linux itself, so that when calling ld, the flag for adding a custom linker script is always passed to it? If so, how, and would it still work if gcc is called only, so that it calls the linker?
I'm using Ubuntu 20.04.3 LTS with gcc 9.3.0 and ld 2.34
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|