Skip to content

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

@da-viper

Description

@da-viper
// main.c
#include <stdio.h>

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

  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

  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
  }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions