[all-commits] [llvm/llvm-project] 54ab95: [BOLT] Reject symbols pointing to section end

Job Noorman via All-commits all-commits at lists.llvm.org
Tue Mar 21 03:00:38 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 54ab9541492d808ae4cf9130dd052d602b78ee32
      https://github.com/llvm/llvm-project/commit/54ab9541492d808ae4cf9130dd052d602b78ee32
  Author: Job Noorman <jnoorman at igalia.com>
  Date:   2023-03-21 (Tue, 21 Mar 2023)

  Changed paths:
    M bolt/lib/Rewrite/RewriteInstance.cpp
    A bolt/test/X86/section-end-sym.s

  Log Message:
  -----------
  [BOLT] Reject symbols pointing to section end

Sometimes, symbols are present that point to the end of a section (i.e.,
one-past the highest valid address). Currently, BOLT either rejects
those symbols when they don't point to another existing section, or errs
when they do and the other section is not executable. I suppose BOLT
would accept the symbol when it points to an executable section.

In any case, these symbols should not be considered while discovering
functions and should not result in an error. This patch implements that.

Note that this patch checks explicitly for symbols whose value equals
the end of their section. It might make more sense to verify that the
symbol's value is within [section start, section end). However, I'm not
sure if this could every happen *and* its value does not equal the end.

Another way to implement this is to verify that the BinarySection we
find at the symbol's address actually corresponds to the symbol's
section. I'm not sure what the best approach is so feedback is welcome.

Reviewed By: yota9, rafauler

Differential Revision: https://reviews.llvm.org/D146215




More information about the All-commits mailing list