[PATCH] D59645: [llvm-objcopy]Add support for *-freebsd output formats
Jordan Rupprecht via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 21 10:00:19 PDT 2019
rupprecht accepted this revision.
rupprecht added a comment.
This revision is now accepted and ready to land.
The objcopy on my machine doesn't seem to be built w/ the freebsd bfd targets enabled, so I can't repro, but this seems fine. Two interesting things I found while comparing against the source:
1. For older FreeBSDs (<= 4.0), objcopy actually copies the string "FreeBSD" into e_ident [1]. This seems to work because there's enough padding bytes. (I suggest we don't do this, but I found it to be interesting trivia).
2. In the method that actually sets the OSABI member [2], if the OSABI field is still ELFOSABI_NONE, it will change it to ELFOSABI_GNU if the object contains GNU symbols. Does this seem useful to do?
12065 /* To make things simpler for the loader on Linux systems we set the
12066 osabi field to ELFOSABI_GNU if the binary contains symbols of
12067 the STT_GNU_IFUNC type or STB_GNU_UNIQUE binding. */
12068 if (i_ehdrp->e_ident[EI_OSABI] == ELFOSABI_NONE
12069 && elf_tdata (abfd)->has_gnu_symbols)
12070 i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_GNU;
[1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=bfd/elf32-i386.c;h=79cd8c65bc150781b9783cfc591b08fc36785890;hb=HEAD#l4414
[2] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=bfd/elf.c;h=73fb86971f3dcc0461ba17d5d24d3cf7add41761;hb=HEAD#l12055
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59645/new/
https://reviews.llvm.org/D59645
More information about the llvm-commits
mailing list