How to dump objcopy output to stdout on macOS?

Peng Yu pengyu.ut@gmail.com
Wed Apr 28 01:30:05 GMT 2021


Interestingly, the following command works on both macOS and Linux.

$ objcopy --dump-section .text=/dev/stdout 1.o

It seems there is a bug in `objcopy -O binary --only-section=.text 1.o
/dev/stdout` on macOS?

On 4/27/21, Peng Yu <pengyu.ut@gmail.com> wrote:
> The following command does not work on macOS.
>
> $ /usr/local/opt/binutils/bin/objcopy -O binary --only-section=.text
> 1.o /dev/stdout
> /usr/local/opt/binutils/bin/objcopy: /dev/stdout: Bad file descriptor
> $ /usr/local/opt/binutils/bin/objcopy --version
> GNU objcopy (GNU Binutils) 2.36.1
> Copyright (C) 2021 Free Software Foundation, Inc.
> This program is free software; you may redistribute it under the terms of
> the GNU General Public License version 3 or (at your option) any later
> version.
> This program has absolutely no warranty.
>
> But the same command works on Linux. How to dump the output to stdout on
> macOS?
>
> $ objcopy --version
> GNU objcopy (GNU Binutils for Debian) 2.35.2
> Copyright (C) 2020 Free Software Foundation, Inc.
> This program is free software; you may redistribute it under the terms of
> the GNU General Public License version 3 or (at your option) any later
> version.
> This program has absolutely no warranty.
> $ objcopy -O binary --only-section=.text 1.o /dev/stdout
> 00000000: 90
>
> --
> Regards,
> Peng
>


-- 
Regards,
Peng


More information about the Binutils mailing list