[PATCH] D22961: [ELF] - Linkerscript: restrict moving location counter backwards.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 8 05:04:13 PDT 2016


grimar reclaimed this revision.
grimar added a comment.

I found that it is important one.

For example FreeBSD scriopt ends with few debug sections which has 0 VA:
(https://svnweb.freebsd.org/base/head/sys/conf/ldscript.amd64?revision=284870&view=markup#l189)

  .debug          0 : { *(.debug) }
  .line           0 : { *(.line) }
  ...

Problem here that BSD script is not full, there are orphan sections. gold and ld use heuristic to place orphan sections
somewhere in the middle. LLD does not do that and we produce broken output here:

  (sample)
  [21] .debug_info       PROGBITS         0000000000000000  0125aada
         000000000229bf19  0000000000000000           0     0     1
    [22] .debug_abbrev     PROGBITS         0000000000000000  034f69f3
         000000000010e86f  0000000000000000           0     0     1
    [23] .debug_line       PROGBITS         0000000000000000  03605262
         0000000000320ce2  0000000000000000           0     0     1
    [24] .debug_frame      PROGBITS         0000000000000000  03925f48
         000000000010d2c0  0000000000000000           0     0     8
    [25] .debug_str        PROGBITS         0000000000000000  03a33208
         0000000000271f6f  0000000000000001  MS       0     0     1
    [26] .debug_loc        PROGBITS         0000000000000000  03ca5177
         0000000000e4b2a6  0000000000000000           0     0     1
    [27] .debug_macinfo    PROGBITS         0000000000000000  04af041d
         0000000000000000  0000000000000000           0     0     1
    [28] .debug_pubtypes   PROGBITS         0000000000000000  04af041d
         00000000003f4f2f  0000000000000000           0     0     1
    [29] .debug_ranges     PROGBITS         0000000000000000  04ee534c
         0000000000337490  0000000000000000           0     0     1
    [30] set_sysctl_set    PROGBITS         0000000000000000  0521d000
         0000000000003d40  0000000000000000   A       0     0     8
    [31] set_sysinit_set   PROGBITS         0000000000003d40  05220d40
         0000000000003448  0000000000000000   A       0     0     8
    [32] set_sysuninit_set PROGBITS         0000000000007188  05224188
         0000000000000f90  0000000000000000   A       0     0     8
    [33] set_modmetadata_s PROGBITS         0000000000008118  05225118
         0000000000002ee8  0000000000000000   A       0     0     8
    [34] set_ah_chips      PROGBITS         000000000000b000  05228000
         0000000000000048  0000000000000000   A       0     0     8
    [35] set_ah_rfs        PROGBITS         000000000000b048  05228048
         0000000000000050  0000000000000000   A       0     0     8
    [36] set_kbddriver_set PROGBITS         000000000000b098  05228098
         0000000000000018  0000000000000000   A       0     0     8
    [37] set_cons_set      PROGBITS         000000000000b0b0  052280b0
         0000000000000020  0000000000000000   A       0     0     8
    [38] usb_host_id       PROGBITS         000000000000b0e0  052280e0
         0000000000000040  0000000000000000   A       0     0     32
    [39] set_vt_drv_set    PROGBITS         000000000000b120  05228120
         0000000000000018  0000000000000000   A       0     0     8
    [40] set_sdt_providers PROGBITS         000000000000b138  05228138
         0000000000000080  0000000000000000   A       0     0     8
    [41] set_sdt_probes_se PROGBITS         000000000000b1b8  052281b8
         0000000000000f48  0000000000000000   A       0     0     8
  ...

So if we do not want to implement heursistics for orphans, I think we at least should implement
this check to prevent such situations and/or force users to provide full script in such cases.


https://reviews.llvm.org/D22961





More information about the llvm-commits mailing list