[PATCH] D25627: [ELF] Allow linker script to use .got and .got.plt sections as inputs

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 18 12:00:29 PDT 2016

ruiu added a comment.

Honestly I think I wouldn't want to support this unless it is absolutely necessary or there's a better way to support it than the "virtual input section".

First, the SECTIONS command seems odd. The SECTIONS command is to gather input sections to put them into an output section, but there are no .got nor .got.plt sections are in any input file. Therefore, even though

  SECTIONS .got { *(.got) }

looks similar to

  SECTIONS .text { *(.text) },

they are very different in semantics. The latter aggregates all .text sections from input files to put them into a .text section, but the former instructs the linker to put a linker-created .got section to .got. The former pattern seems semantically wrong and beyond the limit what we could do with the SECTIONS command.

Second, wrapping an output section with a "virtual" input section seems pretty odd, too. That's a direct consequence of the oddity of the feature, but output sections are not input sections, so it's really confusing.



More information about the llvm-commits mailing list