[PATCH v2] Enable -mrop-protect through configure command

Florian Weimer fw@deneb.enyo.de
Wed Apr 30 11:47:57 GMT 2025


* Peter Bergner:

> On 4/30/25 12:29 AM, Florian Weimer wrote:
>>> -CFLAGS-strncase-power7.c += -mcpu=power7 -funroll-loops
>>> -CFLAGS-strncase_l-power7.c += -mcpu=power7 -funroll-loops
>>> +CFLAGS-strncase-power7.c += -mcpu=power7 -funroll-loops $(no-rop-protection)
>>> +CFLAGS-strncase_l-power7.c += -mcpu=power7 -funroll-loops $(no-rop-protection)
>> 
>> This isn't necessary because the code will not run on POWER7 anyway if
>> the reset of glibc is built with ROP protection.
>
> This patch hunk _is_ necessary, but not for the reason you mention
> (ie, stopping us from executing a ROP instruction on a Power7 system).
> It is required to stop a compiler error during the build.  The above
> -mcpu=power7 overrides the -mcpu= we've set either through --with-cpu=
> or CFLAGS or CC and gcc will flag an error if you use -mpcu=power7
> and -mrop-protect together.  The $(no-rop-protection) is just used to
> place a -mno-rop-protect on the command line after the -mrop-protect
> disabling it, so we skirt around that build error.

Ohhh.  In this case, wouldn't it make sense to drop building those
files at all if the baseline is POWER8 or higher?


More information about the Libc-alpha mailing list