Bug 58379 - default mmap based implementation (mmap_gt_pch_get_address/mmap_gt_pch_use_address) is useless
Summary: default mmap based implementation (mmap_gt_pch_get_address/mmap_gt_pch_use_ad...
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: preprocessor (show other bugs)
Version: 4.8.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: 58370
  Show dependency treegraph
 
Reported: 2013-09-10 10:19 UTC by Martin Husemann
Modified: 2013-09-10 13:13 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Husemann 2013-09-10 10:19:20 UTC
I may be misunderstanding the interface - but it looks to me like it lets the kernel chose an arbitrary mapping address for different compiler invocations but relies on the assumption that the returned address will be the same. If not, the compiler fails with a fatal_error when trying to read a precompiled header file ("had to relocate PCH").

I can not imagine a host system where this would work reliably (or even typically twice in a row).

Please tell me I misunderstood, or consider disabling PCH support for host platforms without host_hooks overriding this function.
Comment 1 Richard Biener 2013-09-10 11:32:15 UTC
Well, it doesn't _rely_ on it - it basically makes systems where that is the
case work out of the box (every system pre address-space-randomization area).

If you have a system that randomizes then you have to re-define the hook.
Comment 2 Martin Husemann 2013-09-10 13:13:48 UTC
(In reply to Richard Biener from comment #1)
> If you have a system that randomizes then you have to re-define the hook.

Besides ASLR there are various things out of control of the compiler that do result in varying mapping adresses (like malloc using mmap instead of brk), so chances are low in any modern system.

I'm not opposed to create a hook for NetBSD, but I have a hard time seeing a possible sensible implementation. Look at the #ifdef cascade in config/host-openbsd.c for a disgusting example of code that should not be in a compiler (IMHO).

How hard is making the externalized format address neutral?