[PATCH] D23769: [ELF] - Implemented --oformat binary option.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 23 09:07:05 PDT 2016


grimar added a comment.

In https://reviews.llvm.org/D23769#522445, @emaste wrote:

> For reference https://reviews.freebsd.org/D7409 is the proposed FreeBSD change to switch to a linker script for the boot components (and make use of --oformat binary).


As I mentioned earlier in llvm-mails, gold implementation is differs with ld for --oformat binary.

I am looking on sys/boot/i386/boot.ldscript at the page you posted and see the next lines:

  SECTIONS {
    . = 0x08048000 + SIZEOF_HEADERS;

That means that gold will produce output > 128mb while gnu ld will do the same layout as this patch do and output will depend only on size of sections.

I just re-checked this using stub files:
test.s:

  .text
  .globl _start
  _start:

test.script:

  SECTIONS { 
   . = 0x08048000 + SIZEOF_HEADERS;
   .text  : { *(.text*) }
  }

llvm-mc -filetype=obj -triple=x86_64-pc-linux test.s -o test.o
gold --script test.script --oformat binary test.o -o outgold
Size of outgold is 134.5 MB for me, size of GNU ld output is 408 bytes.

So I think that means this patch do what is expected.


https://reviews.llvm.org/D23769





More information about the llvm-commits mailing list