llvm / llvm/llvm-project

[LLD] lld does not add the entry size for the `.plt` and `.plt.sec` sections.

Open
#168,720 2 comments 0 reactions 0 assignees View on GitHub
lld platform:linux
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

```c
// main.c
#include

int main() {
puts("hello\n");
printf("hello\n");
return 0;
}
```

lld output of the .plt section

from `llvm-readobj --sections main`
lld output compiled with `clang main.c -fuse-ld=lld -o main`
```sh
Section {
Index: 17
Name: .plt (161)
Type: SHT_PROGBITS (0x1)
Flags [ (0x6)
SHF_ALLOC (0x2)
SHF_EXECINSTR (0x4)
]
Address: 0x17E0
Offset: 0x7E0
Size: 64
Link: 0
Info: 0
AddressAlignment: 16
EntrySize: 0
}
```

bfd output compiled with `clang main.c -fuse-ld=bfd -o main`

```sh
Section {
Index: 10
Name: .plt (104)
Type: SHT_PROGBITS (0x1)
Flags [ (0x6)
SHF_ALLOC (0x2)
SHF_EXECINSTR (0x4)
]
Address: 0x1020
Offset: 0x1020
Size: 48
Link: 0
Info: 0
AddressAlignment: 16
EntrySize: 16
}
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the report with the shown main.c example using clang -fuse-ld=lld, then inspect the .plt and .plt.sec section headers with llvm-readobj. Compare the reported EntrySize and section layout with the bfd output. Done means lld reports the appropriate entry size for these sections, with coverage for the observed behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.