Skip to content

Commit

Permalink
Fix RWX warning on ld 2.39+
Browse files Browse the repository at this point in the history
  • Loading branch information
clubby789 committed Nov 28, 2022
1 parent 67d49a6 commit 7025319
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,15 @@ The table below shows which release corresponds to each branch, and what date th
- [#1981][1981] Fix `cyclic_find()` to make it work with large int values
- [#2123][2123] Fix ROP without a writeable cache directory
- [#2124][2124] Fix `tube.recvpred()` timout argument
- [#2141][2141] Fix `make_elf` on systems with GNU ld 2.39+

[1922]: https://github.com/Gallopsled/pwntools/pull/1922
[1828]: https://github.com/Gallopsled/pwntools/pull/1828
[1939]: https://github.com/Gallopsled/pwntools/pull/1939
[1981]: https://github.com/Gallopsled/pwntools/pull/1981
[2123]: https://github.com/Gallopsled/pwntools/pull/2123
[2124]: https://github.com/Gallopsled/pwntools/pull/2124
[2141]: https://github.com/Gallopsled/pwntools/pull/2141

## 4.7.1

Expand Down
10 changes: 10 additions & 0 deletions pwnlib/asm.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,16 @@ def _linker():
'i386': ['-m', 'elf_i386'],
}.get(context.arch, [])

try:
# Test if this argument is recognised
# If so, we should add it to the commandline so we don't throw spurious errors later on
# https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob_plain;f=ld/NEWS;hb=refs/heads/binutils-2_39-branch
proc = subprocess.run(ld + ["--no-warn-rwx-segments", "--help"], capture_output=True)
if proc.returncode == 0:
arguments.append("--no-warn-rwx-segments")
except Exception as e:
pass

return ld + bfd + [E] + arguments

def _objcopy():
Expand Down

0 comments on commit 7025319

Please sign in to comment.