[PATCH] D76410: [ELF] Don't combine SHF_LINK_ORDER sections linking different output sections

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 19 09:11:13 PDT 2020


MaskRay added inline comments.


================
Comment at: lld/test/ELF/partition-move-to-main-startstop.s:18
 
+// CHECK: part1
 // CHECK: no_startstop
----------------
grimar wrote:
> I think this kind of breaks the logic of this test?
> 
> See the output before this patch:
> 
> ```
>   [ 4] .dynstr           STRTAB           00000000002002b0  000002b0
>        0000000000000039  0000000000000000   A       0     0     1 
>   [ 5] has_startstop     PROGBITS         00000000002002e9  000002e9
>        0000000000000010  0000000000000000  AL       8     0     1
>   [ 6] no_startstop      PROGBITS         00000000002002f9  000002f9
>        0000000000000008  0000000000000000  AL       8     0     1
> ...
>   [10] part1             LOOS+0xfff4c06   0000000000203000  00001000
>        0000000000000040  0000000000000000   A       0     0     1
> 
> Symbol table '.symtab' contains 6 entries:
>    Num:    Value          Size Type    Bind   Vis      Ndx Name
> ...
>      2: 00000000002002e9     0 NOTYPE  GLOBAL PROTECTED    5 __start_has_startstop
>      3: 00000000002002f9     0 NOTYPE  GLOBAL PROTECTED    5 __stop_has_startstop
> ```
> 
> And after:
> 
> 
> ```
>  [ 5] has_startstop     PROGBITS         00000000002002e9  000002e9
>        0000000000000008  0000000000000000  AL       9     0     1
>   [ 6] has_startstop     PROGBITS         00000000002002f1  000002f1
>        0000000000000008  0000000000000000  AL      18     0     1
>   [ 7] no_startstop      PROGBITS         00000000002002f9  000002f9
>        0000000000000008  0000000000000000  AL       9     0     1
>   [ 8] .rodata           PROGBITS         0000000000200304  00000304
>        000000000000000c  0000000000000000   A       0     0     4
> ...
>   [11] part1             LOOS+0xfff4c06   0000000000203000  00001000
>        0000000000000040  0000000000000000   A       0     0     1
> 
> Symbol table '.symtab' contains 6 entries:
>    Num:    Value          Size Type    Bind   Vis      Ndx Name
> ...
>      2: 00000000002002e9     0 NOTYPE  GLOBAL PROTECTED    5 __start_has_startstop
>      3: 00000000002002f1     0 NOTYPE  GLOBAL PROTECTED    5 __stop_has_startstop
> ```
> 
> `__stop_has_startstop` points to the begining of the second `has_startstop` section now.
This demonstrates that `__start_`/`__stop_` symbols should not be used with SHF_LINK_ORDER sections.
Added a comment.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76410/new/

https://reviews.llvm.org/D76410





More information about the llvm-commits mailing list