Bug 26559 - Get OUTPUT_FORMAT from objdump -f to support LLD
Summary: Get OUTPUT_FORMAT from objdump -f to support LLD
Status: UNCONFIRMED
Alias: None
Product: glibc
Classification: Unclassified
Component: build (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: 26558
  Show dependency treegraph
 
Reported: 2020-08-31 23:31 UTC by Fangrui Song
Modified: 2020-08-31 23:31 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fangrui Song 2020-08-31 23:31:14 UTC
OUTPUT_FORMAT is needed as the first line of libc.so (a linker script). The string comes from either

(a) ld --verbose on /dev/null, get the output (the OUTPUT_FORMAT line and the continuation lines), feed the output to scripts/output-format.sed
(b) ld --print-output-format

Neither choice makes sense for LLD. It supports multi targets and there is not a preferred default target. Like gold, it does not have the concept of "an internal linker script". ld.lld --verbose does not print OUTPUT_FORMAT.

As an alternative, we can get the string from objdump -f

```
% objdump -f /lib/x86_64-linux-gnu/libc.so.6 

/lib/x86_64-linux-gnu/libc.so.6:     file format elf64-x86-64

# LLVM>=11.0.0 (since https://reviews.llvm.org/D76046 )
% llvm-objdump -f /lib/x86_64-linux-gnu/libc.so.6

/lib/x86_64-linux-gnu/libc.so.6:        file format elf64-x86-64

architecture: x86_64
start address: 0x0000000000026e00
```