This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH v3][AArch64] Fix symbol offset limit
On Thu, 15 Jun 2017, Wilco Dijkstra wrote:
> Richard Earnshaw wrote:
> > No it's not. The optimizer doesn't create totally random bases. If the
> > code + data is less than 1M in size, then any offsets it does create
> > will fit within the size of the relocations selected by the compiler.
>
> No that's completely false. There is no way you can guarantee that without
> my patch. My patch is precisely there to ensure we only allow offsets that
> guarantee linking succeeds if all code and data fits in 1M or 4GB.
For example, given (array + (i - INT_MAX)), it's quite possible the
compiler could create a relocation for array - INT_MAX, and the original
expression is perfectly OK if i == INT_MAX even though array - INT_MAX is
far out of range. (And array - INT_MAX as a C expression is only
undefined at runtime, not at compile time if it's in code that is never
executed.)
--
Joseph S. Myers
joseph@codesourcery.com