This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add Prefer_MAP_32BIT_EXEC for Silvermont

On Mon, Dec 14, 2015 at 6:56 AM, Zack Weinberg <> wrote:
> On Sat, Dec 12, 2015 at 12:36 PM, H.J. Lu <> wrote:
>> Here is the updated patch to make it opt-in.  OK for master?
> Thank you for being willing to make that change.
> I have no more principled objections; however, the code could be much
> simpler. Now that it's opt-in, there's no reason to entangle it with
> the x86 tuning code; it should be wholly controlled by the environment

How about

@@ -161,6 +195,14 @@ init_cpu_features (struct cpu_features *cpu_features)
     cpu_features->feature[index_I686] |= bit_I686;

+  /* For 64-bit applications, branch prediction performance may be
+     negatively impacted when the target of a branch is more than 4GB
+     away from the branch.  Set the Prefer_MAP_32BIT_EXEC bit so that
+     mmap will try to map executable pages with MAP_32BIT first.
+     NB: MAP_32BIT will map to lower 2GB, not lower 4GB, address.  */
+  cpu_features->feature[index_Prefer_MAP_32BIT_EXEC]
+    |= get_prefer_map_32bit_exec ();

> variable.  Also, why are you open-coding a loop over the contents of
> __environ?  Isn't this what __secure_getenv is for?

It is bcause get_prefer_map_32bit_exec is called very early in when
__secure_getenv/getenv aren't available yet.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]