[PATCH] D27613: [ELF] - Change how -Ttext/-Tdata/-Tbss works.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 12 10:47:03 PST 2016


George Rimar via Phabricator <reviews at reviews.llvm.org> writes:

> +  // When user gives -Ttext/-Tdata/-Tbss GNU linkers either set addresses
> +  // of corresponding sections or addressed for PT_LOADs. That means we want
> +  // to have "text segment" to work with. It includes RO sections as well.
> +  if (!Config->SectionStartMap.empty())
> +    Config->SingleRoRx = true;

Not sure I understand the comment. Maybe just say that some programs
using -TText expect to also see the ro section in the selected address?

>  // Parses -image-base option.
>  static uint64_t getImageBase(opt::InputArgList &Args) {
> +  // When -T<section> option is specified, lowest VA value
> +  // becomes the image base address.
> +  if (!Config->SectionStartMap.empty()) {
> +    uint64_t VA = (uint64_t)-1;
> +    for (auto I = Config->SectionStartMap.begin();
> +         I != Config->SectionStartMap.end(); ++I) {
> +      if (VA > I->second)
> +        VA = I->second;
> +    }
> +    return VA;
> +  }

If that is higher than the default base we probably want to use the
default, no?

Cheers,
Rafael


More information about the llvm-commits mailing list