[patch] Fix ld to match .data.rel.ro sections more carefully

Cary Coutant ccoutant@google.com
Wed May 23 22:44:00 GMT 2012


> The variable "rome" is placed in a data section named
> ".data.rel.rome", and that matches the pattern that ld uses to place
> input sections into .data.rel.ro, which then gets placed in the RELRO
> segment, and the program segfaults when trying to assign to "rome".
>
> The attached patch fixes this by matching ".data.rel.ro" and
> ".data.rel.ro.*" separately (a pattern used for most other similar
> cases, but not for the relro sections), and likewise for the
> corresponding relocation sections.

Unfortunately, this still doesn't handle the case where we have a
variable named simply "ro" that happens to have a relocation. That
will get placed into a ".data.rel.ro" section that is
indistinguishable from a real ".data.rel.ro" section generated without
-fdata-sections. Does anyone have any suggestions for how to handle
this?

-cary



More information about the Binutils mailing list