[PATCH] D38170: [ELF] - Drop SHF_LINK_ORDER flag from output.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 5 14:49:04 PDT 2017


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

> +static Optional<uint32_t> getLinkOrder(ArrayRef<InputSection *> V) {
> +  for (InputSection *IS : V)
> +    if (IS->LinkOrderDep)
> +      return IS->LinkOrderDep->getParent()->SectionIndex;
> +  return None;
> +}

Do you need the loop? They should all agree, so you should be able to
check just the first element, no?

> Index: ELF/InputSection.h
> ===================================================================
> --- ELF/InputSection.h
> +++ ELF/InputSection.h
> @@ -163,8 +163,6 @@
>      return getFile<ELFT>()->getObj();
>    }
>  
> -  InputSection *getLinkOrderDep() const;
> -
>    void uncompress();
>  
>    // Returns a source location string. Used to construct an error message.
> @@ -184,6 +182,8 @@
>      return llvm::makeArrayRef<T>((const T *)Data.data(), S / sizeof(T));
>    }
>  
> +  InputSection *LinkOrderDep = nullptr;
> +
>  private:
>    // A pointer that owns uncompressed data if a section is compressed by zlib.
>    // Since the feature is not used often, this is usually a nullptr.


This adds a member to drop a flag. It doesn't look like a good thing to
me.

IMHO you got it right on the first patch. Sorry for taking so long to
just in the review.

Cheers,
Rafael


More information about the llvm-commits mailing list