You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ELF] Don't emit capreloc for non-preemptible undef weak symbols
Currently we rely on cheri_init_globals or equivalent treating a base of
0 as NULL. Historically when caprelocs encoded the absolute base this
was relatively ok, if inefficient, but with caprelocs being implicitly
relative this is ambiguous, as it could instead be a relocation
referring to the start of the object, which we can no longer express. We
could paper over that by checking the length is 0 too (breaking only if
wanting to refer to a 0-byte region at the start of the object), but
it's still inefficient and unnecessary. It also failed to account for
the addend, always giving NULL, not NULL + addend. Since we have a true
static link time constant, we should just write out the bits for a
NULL-derived capability, just as the assembler does for .chericap const.
This is also important downstream for Morello, and will be important
here too, as when PCC bounds are correctly set in the relocations the
base could legitimately be zero for a non-preemptible symbol that isn't
itself zero. Morello therefore does not treat a base of 0 as special,
and so is more broken for non-preemptible undef weak symbols, deriving
real (if representable) capabilities, with an address that isn't even 0
in the case of dynamically-linked binaries.
0 commit comments