[all-commits] [llvm/llvm-project] fa1145: [lld][ELF] Add LOG2CEIL builtin ldscript function

Isaac Richter via All-commits all-commits at lists.llvm.org
Mon Jul 27 02:17:18 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: fa1145a8d2f1bd00a60d0ed4572901d2b1403157
      https://github.com/llvm/llvm-project/commit/fa1145a8d2f1bd00a60d0ed4572901d2b1403157
  Author: Isaac Richter <isaac at irichter.net>
  Date:   2020-07-27 (Mon, 27 Jul 2020)

  Changed paths:
    M lld/ELF/ScriptParser.cpp
    M lld/test/ELF/linkerscript/operators.test

  Log Message:
  -----------
  [lld][ELF] Add LOG2CEIL builtin ldscript function

This patch adds support for the LOG2CEIL builtin function in linker scripts: https://sourceware.org/binutils/docs/ld/Builtin-Functions.html#index-LOG2CEIL_0028exp_0029

As documented for LD, and to keep compatibility, LOG2CEIL(0) returns 0 (not -inf).

The test vectors are somewhat arbitrary. We check minimum values (0-4); middle values (2^32, and 2^32+1); and the maximum value (2^64-1).

The checks for LOG2CEIL explicitly use full 64-bit values (16 hex digits). This is needed to properly verify that -inf and other interesting results aren't returned. (For some reason, all other tests in operators.test use only 14 digits.)

Differential revision: https://reviews.llvm.org/D84054




More information about the All-commits mailing list