[PATCH] MC: Support larger COFF string tables

Jay Foad jay.foad at gmail.com
Wed Jul 24 01:00:50 PDT 2013


On 23 July 2013 19:49, Richard <legalize at xmission.com> wrote:
> ================
> Comment at: lib/MC/WinCOFFObjectWriter.cpp:501-503
> @@ +500,5 @@
> +
> +    if (StringTableEntry <= 999999) {
> +      std::sprintf(S.Header.Name, "/%d", unsigned(StringTableEntry));
> +    } else if (StringTableEntry <= 9999999) {
> +      // With seven digits, we have to skip the terminating null. Because
> ----------------
> These two constants are so nearly identical I had to read this really carefully to see that you didn't have the same condition in both if statements.
>
> How about:

    if (StringTableEntry < 1e6) {
      ...
    } else if (StringTableEntry < 1e7) {

?

Jay.



More information about the llvm-commits mailing list