public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/55610] New: cc1 is calling munmap() on part of itself on darwin
@ 2012-12-06 15:19 howarth at nitro dot med.uc.edu
  2012-12-06 15:25 ` [Bug target/55610] " howarth at nitro dot med.uc.edu
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: howarth at nitro dot med.uc.edu @ 2012-12-06 15:19 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55610

             Bug #: 55610
           Summary: cc1 is calling munmap() on part of itself on darwin
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: howarth@nitro.med.uc.edu


The use of the dragonegg.so plugin with the LLVMPolly.so plugin exposes a flaw
where when dyld queries for free memory it is getting a block in the middle of
gcc4.7's __DATA segment. The cc1 binary has a 1GB __DATA segment which is huge,
but should work, but somehow  LLVMPolly.so is being loaded into the middle of
the cc1's DATA segment. That causes problems with lazy binding because dyld has
a data structure to map from an address to an image. That data structure
assumes mach-o images do not overlap.  So when dyld is trying to find which
image is requesting the lazy binding, it thinks it is cc1 when in fact
LLVMPolly.so is requesting the lazy binding.  This leads to the binding error.
Why does this cc1 have such a huge __DATA segment? Most of the room is in the
__bss12 section.  Is there some code that calls vm_deallocate on the interior
of the __DATA segment?

size -l /sw/lib/gcc4.7/libexec/gcc/x86_64-apple-darwin12.2.0/4.7.2/cc1
Segment __PAGEZERO: 4294967296 (vmaddr 0x0 fileoff 0)
Segment __TEXT: 11014144 (vmaddr 0x100000000 fileoff 0)
        Section __text: 8725244 (addr 0x100000c80 offset 3200)
        Section __text_startup: 5 (addr 0x100852f80 offset 8728448)
        Section __text_cold: 69721 (addr 0x100852f88 offset 8728456)
        Section __stubs: 984 (addr 0x100863fe2 offset 8798178)
        Section __stub_helper: 1656 (addr 0x1008643bc offset 8799164)
        Section __cstring: 573443 (addr 0x100864a38 offset 8800824)
        Section __const: 534272 (addr 0x1008f0a40 offset 9374272)
        Section __eh_frame: 1105584 (addr 0x100973140 offset 9908544)
        total 11010909
Segment __DATA: 1075826688 (vmaddr 0x100a81000 fileoff 11014144)
        Section __got: 816 (addr 0x100a81000 offset 11014144)
        Section __nl_symbol_ptr: 16 (addr 0x100a81330 offset 11014960)
        Section __la_symbol_ptr: 1312 (addr 0x100a81340 offset 11014976)
        Section __const: 598856 (addr 0x100a81860 offset 11016288)
        Section __data: 41152 (addr 0x100b13bc0 offset 11615168)
        Section __static_data: 136 (addr 0x100b1dc80 offset 11656320)
        Section __pu_bss5: 1202272 (addr 0x100b1dd20 offset 0)
        Section __bss4: 792 (addr 0x100c43580 offset 0)
        Section __bss2: 1640 (addr 0x100c43898 offset 0)
        Section __bss0: 26 (addr 0x100c43f00 offset 0)
        Section __pu_bss4: 112 (addr 0x100c43f20 offset 0)
        Section __pu_bss0: 5 (addr 0x100c43f90 offset 0)
        Section __common: 24 (addr 0x100c43f98 offset 0)

        Section __pu_bss2: 496 (addr 0x100c43fb0 offset 0)
        Section __bss12: 1073741824 (addr 0x100c45000 offset 0)
        Section __bss5: 221067 (addr 0x140c45000 offset 0)
        Section __bss3: 7632 (addr 0x140c7af90 offset 0)
        Section __pu_bss3: 1432 (addr 0x140c7cd60 offset 0)
        total 1075819610
Segment __LINKEDIT: 3719168 (vmaddr 0x140c7e000 fileoff 11661312)

For the FSF gcc 4.7.2/dragonegg/LLVMPolly.so combination cc1 is calling
munmap() on part of itself which is not legal.  If we skip over that munmap,
the program runs fine.


(gdb) set env DYLD_PRINT_SEGMENTS
(gdb) br munmap
(gdb) r
dyld: Main executable mapped
/sw/lib/gcc4.7/libexec/gcc/x86_64-apple-darwin12.2.0/4.7.2/cc1
        __PAGEZERO at 0x00000000->0x100000000
            __TEXT at 0x100000000->0x100A81000
            __DATA at 0x100A81000->0x140C7E000
        __LINKEDIT at 0x140C7E000->0x14100A000
...
Breakpoint 14, 0x00007fff86b94fbc in munmap ()
1: x/i $pc  0x7fff86b94fbc <munmap>:    mov    $0x2000049,%eax
$17 = 0x14122e000
$18 = 0xd2000
(gdb) c
Continuing.

Breakpoint 14, 0x00007fff86b94fbc in munmap ()
1: x/i $pc  0x7fff86b94fbc <munmap>:    mov    $0x2000049,%eax
$19 = 0x141400000
$20 = 0x2e000
(gdb) c
Continuing.

Breakpoint 14, 0x00007fff86b94fbc in munmap ()
1: x/i $pc  0x7fff86b94fbc <munmap>:    mov    $0x2000049,%eax
$21 = 0x141400000
$22 = 0x400000
(gdb) c
Continuing.


Breakpoint 14, 0x00007fff86b94fbc in munmap ()
1: x/i $pc  0x7fff86b94fbc <munmap>:    mov    $0x2000049,%eax
$23 = 0x142000000
$24 = 0x400000
(gdb) c
Continuing.

Breakpoint 14, 0x00007fff86b94fbc in munmap ()
1: x/i $pc  0x7fff86b94fbc <munmap>:    mov    $0x2000049,%eax
$26 = 0x144ba3000
$27 = 0x5d000
(gdb) c
Continuing.

Breakpoint 14, 0x00007fff86b94fbc in munmap ()
1: x/i $pc  0x7fff86b94fbc <munmap>:    mov    $0x2000049,%eax
$28 = 0x144d00000
$29 = 0xa3000
(gdb) c
Continuing.
GNU C (GCC) version 4.7.2 (x86_64-apple-darwin12.2.0)
        compiled by GNU C version 4.7.2, GMP version 5.0.5, MPFR version 3.1.1,
MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Versions of loaded plugins:
 dragonegg: 3.2svn
ignoring nonexistent directory
+"/sw/lib/gcc4.7/lib/gcc/x86_64-apple-darwin12.2.0/4.7.2/../../../../x86_64-apple-darwin12.2.0/include"
#include "..." search starts here:
#include <...> search starts here:
 /sw/lib/gcc4.7/lib/gcc/x86_64-apple-darwin12.2.0/4.7.2/include
 /usr/local/include
 /sw/lib/gcc4.7/include
 /sw/lib/gcc4.7/lib/gcc/x86_64-apple-darwin12.2.0/4.7.2/include-fixed
 /usr/include
 /System/Library/Frameworks
 /Library/Frameworks
End of search list.
GNU C (GCC) version 4.7.2 (x86_64-apple-darwin12.2.0)
        compiled by GNU C version 4.7.2, GMP version 5.0.5, MPFR version 3.1.1,
MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Versions of loaded plugins:
 dragonegg: 3.2svn
Compiler executable checksum: 5da987f9ed3a860be7067d00a0e39a8f

Breakpoint 14, 0x00007fff86b94fbc in munmap ()
1: x/i $pc  0x7fff86b94fbc <munmap>:    mov    $0x2000049,%eax
$30 = 0x100c45000
$31 = 0x40000000
(gdb) bt
#0  0x00007fff86b94fbc in munmap ()
#1  0x0000000100808efc in darwin_gt_pch_use_address (addr=Cannot access memory
at address 0xffffffff
0x0, sz=<value temporarily unavailable, due to optimizations>, fd=-1, off=0) at
+../../gcc-4.7.2/gcc/config/host-darwin.c:60
Previous frame inner to this frame (gdb could not unwind past this frame)
(gdb) info shared 0x0000000100808efc
  5 cc1                               - 0x100000000        exec Y Y
+/sw/lib/gcc4.7/libexec/gcc/x86_64-apple-darwin12.2.0/4.7.2/cc1 (offset 0x0)

Note the address range being unmapped (0x100c45000 - 0x140c45000) which is all
in the __DATA segment of cc1:
            __DATA at 0x100A81000->0x140C7E000

gdb, shows that darwin_gt_pch_use_address is being called with parameters
   darwin_gt_pch_use_address(NULL, 0, -1, 0);

maybe it was a feature in the 32-bit days to free up the space that would have
been used by pch if pch was not
+active.  But for 64-bits there is no shortage of address space.

This code also only worked in the past because cc1 did not dlopen() anything. 
Now that it is, the hole in the
+__DATA segment is causing problems.

Nick says this goes to Mike Stump to fix it to not unmap.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/55610] cc1 is calling munmap() on part of itself on darwin
  2012-12-06 15:19 [Bug target/55610] New: cc1 is calling munmap() on part of itself on darwin howarth at nitro dot med.uc.edu
@ 2012-12-06 15:25 ` howarth at nitro dot med.uc.edu
  2012-12-06 15:28 ` howarth at nitro dot med.uc.edu
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: howarth at nitro dot med.uc.edu @ 2012-12-06 15:25 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55610

--- Comment #1 from Jack Howarth <howarth at nitro dot med.uc.edu> 2012-12-06 15:25:04 UTC ---
This was originally opened as http://llvm.org/bugs/show_bug.cgi?id=14140 but
closed there now as it is determined to be a latent bug in FSF gcc's
darwin_gt_pch_use_address call. Also, Nick was able to completely back trace
this issue because gcc defaults now to -fomit-frame-pointers. We will need to
revert that change in order to get a complete backtrace out of cc1.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/55610] cc1 is calling munmap() on part of itself on darwin
  2012-12-06 15:19 [Bug target/55610] New: cc1 is calling munmap() on part of itself on darwin howarth at nitro dot med.uc.edu
  2012-12-06 15:25 ` [Bug target/55610] " howarth at nitro dot med.uc.edu
@ 2012-12-06 15:28 ` howarth at nitro dot med.uc.edu
  2012-12-06 23:58 ` mrs at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: howarth at nitro dot med.uc.edu @ 2012-12-06 15:28 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55610

--- Comment #2 from Jack Howarth <howarth at nitro dot med.uc.edu> 2012-12-06 15:27:51 UTC ---
Sorry, that should have been "Nick wasn't able to completely backtrace in cc1
due to the default use of -fomit-frame-pointer in FSF gcc".


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/55610] cc1 is calling munmap() on part of itself on darwin
  2012-12-06 15:19 [Bug target/55610] New: cc1 is calling munmap() on part of itself on darwin howarth at nitro dot med.uc.edu
  2012-12-06 15:25 ` [Bug target/55610] " howarth at nitro dot med.uc.edu
  2012-12-06 15:28 ` howarth at nitro dot med.uc.edu
@ 2012-12-06 23:58 ` mrs at gcc dot gnu.org
  2012-12-07 17:35 ` howarth at nitro dot med.uc.edu
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mrs at gcc dot gnu.org @ 2012-12-06 23:58 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55610

mrs@gcc.gnu.org <mrs at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mrs at gcc dot gnu.org

--- Comment #3 from mrs at gcc dot gnu.org <mrs at gcc dot gnu.org> 2012-12-06 23:58:07 UTC ---
We don't need to do that.  We need to not run the unmap call in host-darwin.c
when we dlopen things in the compiler; for example, dragonegg.  Then, we need
to test this and see if the bug is fixed.  You can do that by adding in a #if 0
#end around the unmap call.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/55610] cc1 is calling munmap() on part of itself on darwin
  2012-12-06 15:19 [Bug target/55610] New: cc1 is calling munmap() on part of itself on darwin howarth at nitro dot med.uc.edu
                   ` (2 preceding siblings ...)
  2012-12-06 23:58 ` mrs at gcc dot gnu.org
@ 2012-12-07 17:35 ` howarth at nitro dot med.uc.edu
  2012-12-07 18:03 ` howarth at nitro dot med.uc.edu
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: howarth at nitro dot med.uc.edu @ 2012-12-07 17:35 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55610

--- Comment #4 from Jack Howarth <howarth at nitro dot med.uc.edu> 2012-12-07 17:35:00 UTC ---
--- gcc-4.7.2/gcc/config/host-darwin.c.orig     2012-12-07 11:30:48.000000000
-0500
+++ gcc-4.7.2/gcc/config/host-darwin.c  2012-12-07 11:39:21.000000000 -0500
@@ -57,8 +57,8 @@
   /* Round the size to a whole page size.  Normally this is a no-op.  */
   sz = (sz + pagesize - 1) / pagesize * pagesize;

-  if (munmap (pch_address_space + sz, sizeof (pch_address_space) - sz) != 0)
-    fatal_error ("couldn%'t unmap pch_address_space: %m");
+  /* if (munmap (pch_address_space + sz, sizeof (pch_address_space) - sz) !=
0)
+    fatal_error ("couldn%'t unmap pch_address_space: %m"); */

   if (ret)
     {

eliminates the dyld: lazy symbol binding failure with...

/sw/lib/gcc4.7/bin/gcc-4 -fplugin=/sw/lib/gcc4.7/lib/dragonegg.so -O3
-fplugin-arg-dragonegg-llvm-option=-load:/sw/opt/llvm-3.2/lib/LLVMPolly.so
-fplugin-arg-dragonegg-llvm-option=-polly himenoBMTxpa.c

under llvm/polly/dragonegg 3.2 branch. Will run full regression testing on the
gcc 4.7.2 build to hunt for regressions from this change to
darwin_gt_pch_use_address on x86_64-apple-darwin12.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/55610] cc1 is calling munmap() on part of itself on darwin
  2012-12-06 15:19 [Bug target/55610] New: cc1 is calling munmap() on part of itself on darwin howarth at nitro dot med.uc.edu
                   ` (3 preceding siblings ...)
  2012-12-07 17:35 ` howarth at nitro dot med.uc.edu
@ 2012-12-07 18:03 ` howarth at nitro dot med.uc.edu
  2021-11-11 15:49 ` egallager at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: howarth at nitro dot med.uc.edu @ 2012-12-07 18:03 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55610

--- Comment #5 from Jack Howarth <howarth at nitro dot med.uc.edu> 2012-12-07 18:03:05 UTC ---
It appears that the change in Comment 4 only works if dragonegg is built with
clang. Using the patch from
http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056882.html to allow
dragonegg 3.2 to be built against FSF gcc 4.7.2 exposes a new runtime bug from
this change...

% gdb /sw/lib/gcc4.7/libexec/gcc/x86_64-apple-darwin12.2.0/4.7.2/cc1
GNU gdb 6.3.50-20050815 (Apple version gdb-1822) (Sun Aug  5 03:00:42 UTC 2012)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared
libraries ..
...... done
(gdb) break malloc_error_break
Function "malloc_error_break" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (malloc_error_break) pending.
(gdb) r -quiet -v
-iplugindir=/sw/lib/gcc4.7/lib/gcc/x86_64-apple-darwin12.2.0/4.7.2/plugin
-D__DYNAMIC__ himenoBMTxpa.c
-iplugindir=/sw/lib/gcc4.7/lib/gcc/x86_64-apple-darwin12.2.0/4.7.2/plugin -fPIC
-quiet -dumpbase himenoBMTxpa.c -mmacosx-version-min=10.8.2 -mtune=core2
-auxbase himenoBMTxpa -O3 -version -fplugin=/sw/lib/gcc4.7/lib/dragonegg.so
-fplugin-arg-dragonegg-llvm-option=-load:/sw/opt/llvm-3.2/lib/LLVMPolly.so
-fplugin-arg-dragonegg-llvm-option=-polly -o
/var/folders/1l/n78sywl52lz6kkys6nv7mnph0000gp/T//cclH687b.s
Starting program:
/sw/lib/gcc4.7/libexec/gcc/x86_64-apple-darwin12.2.0/4.7.2/cc1 -quiet -v
-iplugindir=/sw/lib/gcc4.7/lib/gcc/x86_64-apple-darwin12.2.0/4.7.2/plugin
-D__DYNAMIC__ himenoBMTxpa.c
-iplugindir=/sw/lib/gcc4.7/lib/gcc/x86_64-apple-darwin12.2.0/4.7.2/plugin -fPIC
-quiet -dumpbase himenoBMTxpa.c -mmacosx-version-min=10.8.2 -mtune=core2
-auxbase himenoBMTxpa -O3 -version -fplugin=/sw/lib/gcc4.7/lib/dragonegg.so
-fplugin-arg-dragonegg-llvm-option=-load:/sw/opt/llvm-3.2/lib/LLVMPolly.so
-fplugin-arg-dragonegg-llvm-option=-polly -o
/var/folders/1l/n78sywl52lz6kkys6nv7mnph0000gp/T//cclH687b.s
Reading symbols for shared libraries +++++++.................................
done
Breakpoint 1 at 0x7fff94c3a558
Pending breakpoint 1 - "malloc_error_break" resolved
Reading symbols for shared libraries ... done
GNU C (GCC) version 4.7.2 (x86_64-apple-darwin12.2.0)
    compiled by GNU C version 4.7.2, GMP version 5.0.5, MPFR version 3.1.1, MPC
version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Versions of loaded plugins:
 dragonegg: 3.2svn
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory
"/sw/lib/gcc4.7/lib/gcc/x86_64-apple-darwin12.2.0/4.7.2/../../../../x86_64-apple-darwin12.2.0/include"
#include "..." search starts here:
#include <...> search starts here:
 /sw/lib/gcc4.7/lib/gcc/x86_64-apple-darwin12.2.0/4.7.2/include
 /sw/lib/gcc4.7/include
 /sw/lib/gcc4.7/lib/gcc/x86_64-apple-darwin12.2.0/4.7.2/include-fixed
 /usr/include
 /System/Library/Frameworks
 /Library/Frameworks
End of search list.
GNU C (GCC) version 4.7.2 (x86_64-apple-darwin12.2.0)
    compiled by GNU C version 4.7.2, GMP version 5.0.5, MPFR version 3.1.1, MPC
version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Versions of loaded plugins:
 dragonegg: 3.2svn
Compiler executable checksum: d6e497ca0091e30b5d839f153b884a35
himenoBMTxpa.c: In function ‘main’:
himenoBMTxpa.c:79:5: warning: incompatible implicit declaration of built-in
function ‘strcpy’ [enabled by default]
himenoBMTxpa.c: In function ‘set_param’:
himenoBMTxpa.c:226:5: warning: incompatible implicit declaration of built-in
function ‘exit’ [enabled by default]
himenoBMTxpa.c: In function ‘newMat’:
himenoBMTxpa.c:239:5: warning: incompatible implicit declaration of built-in
function ‘malloc’ [enabled by default]
himenoBMTxpa.c: In function ‘clearMat’:
himenoBMTxpa.c:248:5: warning: incompatible implicit declaration of built-in
function ‘free’ [enabled by default]
Reading symbols for shared libraries ... done
cc1(81254) malloc: *** error for object 0x7fff79fb8570: pointer being freed was
not allocated
*** set a breakpoint in malloc_error_break to debug

Breakpoint 1, 0x00007fff94c3a558 in malloc_error_break ()
(gdb) bt
#0  0x00007fff94c3a558 in malloc_error_break ()
#1  0x00007fff94c3b912 in free ()
#2  0x0000000144c4fcb9 in std::string::assign (this=0x1451fe560, __str=<value
temporarily unavailable, due to optimizations>) at basic_string.h:226
#3  0x0000000142f5ad84 in llvm::cl::opt<std::string, false,
llvm::cl::parser<std::string> >::setInitialValue (this=0x1451fe528,
V=@0x7fff5fbfdf78) at CommandLine.h:1162
#4  0x000000014512ee6d in llvm::cl::initializer<char
[4]>::apply<llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> > >
(this=0x7fff5fbfe068, O=@0x1451fe528) at CommandLine.h:290
#5  0x000000014512ee0d in llvm::cl::applicator<llvm::cl::initializer<char [4]>
>::opt<llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> > >
(M=@0x7fff5fbfe068, O=@0x1451fe528) at CommandLine.h:976
#6  0x000000014512eddd in llvm::cl::apply<llvm::cl::initializer<char [4]>,
llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> > >
(M=@0x7fff5fbfe068, O=0x1451fe528) at CommandLine.h:1014
#7  0x000000014512fbe0 in llvm::cl::opt<std::string, false,
llvm::cl::parser<std::string> >::opt<char [24], llvm::cl::desc,
llvm::cl::OptionHidden, llvm::cl::initializer<char [4]> > (this=0x1451fe528,
M0=@0x1451ad7ca, M1=@0x7fff5fbfe078, M2=@0x7fff5fbfe074, M3=@0x7fff5fbfe068) at
CommandLine.h:1197
#8  0x000000014512ea75 in llvm::cl::opt<std::string, false,
llvm::cl::parser<std::string> >::opt<char [24], llvm::cl::desc,
llvm::cl::OptionHidden, llvm::cl::initializer<char [4]> > (this=0x1451fe528,
M0=@0x1451ad7ca, M1=@0x7fff5fbfe078, M2=@0x7fff5fbfe074, M3=@0x7fff5fbfe068) at
CommandLine.h:1199
#9  0x000000014512e6ae in __cxx_global_var_init4 () at PassSupport.h:183
#10 0x000000014512e978 in global constructors keyed to a () at
PassSupport.h:183
#11 0x00007fff5fc13378 in
__dyld__ZN16ImageLoaderMachO18doModInitFunctionsERKN11ImageLoader11LinkContextE
()
#12 0x00007fff5fc13762 in
__dyld__ZN16ImageLoaderMachO16doInitializationERKN11ImageLoader11LinkContextE
()
#13 0x00007fff5fc1006e in
__dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListE
()
#14 0x00007fff5fc0feba in
__dyld__ZN11ImageLoader15runInitializersERKNS_11LinkContextERNS_21InitializerTimingListE
()
#15 0x00007fff5fc04e38 in __dyld__ZN4dyld15runInitializersEP11ImageLoader ()
#16 0x00007fff5fc0a87c in __dyld_dlopen ()
#17 0x00007fff8bd81dd8 in dlopen ()
#18 0x0000000142f8f33f in llvm::sys::DynamicLibrary::getPermanentLibrary
(filename=0x141328d58 "/sw/opt/llvm-3.2/lib/LLVMPolly.so",
errMsg=0x7fff5fbfe7d0) at
/sw/src/fink.build/llvm32-3.2-0/llvm-3.2/lib/Support/DynamicLibrary.cpp:77
#19 0x0000000142f706bd in llvm::sys::DynamicLibrary::LoadLibraryPermanently
(Filename=0x141328d58 "/sw/opt/llvm-3.2/lib/LLVMPolly.so",
ErrMsg=0x7fff5fbfe7d0) at DynamicLibrary.h:77
#20 0x0000000142f70489 in llvm::PluginLoader::operator= (this=0x1434a5c78,
Filename=@0x7fff5fbfe870) at
/sw/src/fink.build/llvm32-3.2-0/llvm-3.2/lib/Support/PluginLoader.cpp:29
#21 0x0000000142211328 in llvm::cl::opt_storage<llvm::PluginLoader, false,
true>::setValue<std::string> (this=0x1434a5c78, V=@0x7fff5fbfe870,
initial=<value temporarily unavailable, due to optimizations>) at
CommandLine.h:1072
#22 0x0000000142211066 in llvm::cl::opt<llvm::PluginLoader, false,
llvm::cl::parser<std::string> >::handleOccurrence (this=0x1434a5c40, pos=2,
ArgName={static npos = 18446744073709551615, Data = 0x141325ea1
"load=/sw/opt/llvm-3.2/lib/LLVMPolly.so", Length = 4}, Arg={static npos =
18446744073709551615, Data = 0x141325ea6 "/sw/opt/llvm-3.2/lib/LLVMPolly.so",
Length = 33}) at CommandLine.h:1131
#23 0x0000000142f54fb1 in llvm::cl::Option::addOccurrence (this=0x1434a5c40,
pos=2, ArgName={Data = 0x141325ea1 "load=/sw/opt/llvm-3.2/lib/LLVMPolly.so",
Length = 4, static npos = 18446744073709551615}, Value={Data = 0x141325ea6
"/sw/opt/llvm-3.2/lib/LLVMPolly.so", Length = 33, static npos =
18446744073709551615}, MultiArg=false) at
/sw/src/fink.build/llvm32-3.2-0/llvm-3.2/lib/Support/CommandLine.cpp:883
#24 0x0000000142f59e2b in CommaSeparateAndAddOccurence (Handler=0x1434a5c40,
pos=2, ArgName={Data = 0x141325ea1 "load=/sw/opt/llvm-3.2/lib/LLVMPolly.so",
Length = 4, static npos = 18446744073709551615}, Value={Data = 0x141325ea6
"/sw/opt/llvm-3.2/lib/LLVMPolly.so", Length = 33, static npos =
18446744073709551615}, MultiArg=false) at
/sw/src/fink.build/llvm32-3.2-0/llvm-3.2/lib/Support/CommandLine.cpp:259
#25 0x0000000142f552b1 in ProvideOption (Handler=0x1434a5c40, ArgName={Data =
0x141325ea1 "load=/sw/opt/llvm-3.2/lib/LLVMPolly.so", Length = 4, static npos =
18446744073709551615}, Value={Data = 0x141325ea6
"/sw/opt/llvm-3.2/lib/LLVMPolly.so", Length = 33, static npos =
18446744073709551615}, argc=4, argv=0x141325ed0, i=@0x7fff5fbff080) at
/sw/src/fink.build/llvm32-3.2-0/llvm-3.2/lib/Support/CommandLine.cpp:299
#26 0x0000000142f53054 in llvm::cl::ParseCommandLineOptions (argc=4,
argv=0x141325ed0, Overview=0x0) at
/sw/src/fink.build/llvm32-3.2-0/llvm-3.2/lib/Support/CommandLine.cpp:724
#27 0x0000000142203c02 in ConfigureLLVM () at
/sw/src/fink.build/dragonegg-gcc47-3.2-0/dragonegg-3.2/src/Backend.cpp:372
#28 0x0000000142204b38 in InitializeBackend () at
/sw/src/fink.build/dragonegg-gcc47-3.2-0/dragonegg-3.2/src/Backend.cpp:583
#29 0x000000014220843b in llvm_emit_globals () at
/sw/src/fink.build/dragonegg-gcc47-3.2-0/dragonegg-3.2/src/Backend.cpp:1741


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/55610] cc1 is calling munmap() on part of itself on darwin
  2012-12-06 15:19 [Bug target/55610] New: cc1 is calling munmap() on part of itself on darwin howarth at nitro dot med.uc.edu
                   ` (4 preceding siblings ...)
  2012-12-07 18:03 ` howarth at nitro dot med.uc.edu
@ 2021-11-11 15:49 ` egallager at gcc dot gnu.org
  2021-11-11 15:55 ` iains at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: egallager at gcc dot gnu.org @ 2021-11-11 15:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55610

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |egallager at gcc dot gnu.org,
                   |                            |zhaixiang at loongson dot cn

--- Comment #9 from Eric Gallager <egallager at gcc dot gnu.org> ---
Is this still an issue now that dragonegg isn't really a thing anymore? Last
update to it was years ago...

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/55610] cc1 is calling munmap() on part of itself on darwin
  2012-12-06 15:19 [Bug target/55610] New: cc1 is calling munmap() on part of itself on darwin howarth at nitro dot med.uc.edu
                   ` (5 preceding siblings ...)
  2021-11-11 15:49 ` egallager at gcc dot gnu.org
@ 2021-11-11 15:55 ` iains at gcc dot gnu.org
  2021-12-02 19:45 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: iains at gcc dot gnu.org @ 2021-11-11 15:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55610

--- Comment #10 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Eric Gallager from comment #9)
> Is this still an issue now that dragonegg isn't really a thing anymore? Last
> update to it was years ago...

oddly, the changes to support PIE might well squash this too 
- I agree dragonegg is not a thing, but other compiler plugins exist.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/55610] cc1 is calling munmap() on part of itself on darwin
  2012-12-06 15:19 [Bug target/55610] New: cc1 is calling munmap() on part of itself on darwin howarth at nitro dot med.uc.edu
                   ` (6 preceding siblings ...)
  2021-11-11 15:55 ` iains at gcc dot gnu.org
@ 2021-12-02 19:45 ` cvs-commit at gcc dot gnu.org
  2021-12-20  4:05 ` egallager at gcc dot gnu.org
  2023-05-16 19:18 ` iains at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-02 19:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55610

--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>:

https://gcc.gnu.org/g:22a982409323feb203401d345488a5a9c18e6733

commit r12-5759-g22a982409323feb203401d345488a5a9c18e6733
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Sat Nov 13 12:39:09 2021 +0000

    Darwin: Rewrite host PCH support [PR 55610].

    We need to revise the PCH memory allocation scheme to enable
    support for PIE on aarch64.  The rewrite uses a similar scheme
    to the one used on Linux.

    We attempt to identify VM segments for each arch/OS version that
    are always available to the compiler (note this is not general,
    it only needs to work for the cc1* exes).

    If we cannot find the preferred segment we fall back to allowing
    the kernel to supply one - this is more likely to fail when the
    PCH read-in occurs (but that is trapped).

    In doing this we obviate the need to unmap any part of the
    compiler __DATA segment - thus fixing PR 55610.

    Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

    gcc/ChangeLog:

            PR target/55610
            * config/host-darwin.c (TRY_EMPTY_VM_SPACE,
            SAFE_ALLOC_SIZE): New.
            (darwin_gt_pch_get_address): Rewrite to use nominated
            memory segments rather than part of the compiler __DATA
            segment.
            (darwin_gt_pch_use_address): Likewise.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/55610] cc1 is calling munmap() on part of itself on darwin
  2012-12-06 15:19 [Bug target/55610] New: cc1 is calling munmap() on part of itself on darwin howarth at nitro dot med.uc.edu
                   ` (7 preceding siblings ...)
  2021-12-02 19:45 ` cvs-commit at gcc dot gnu.org
@ 2021-12-20  4:05 ` egallager at gcc dot gnu.org
  2023-05-16 19:18 ` iains at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: egallager at gcc dot gnu.org @ 2021-12-20  4:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55610

--- Comment #12 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to CVS Commits from comment #11)
> The master branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>:
> 
> https://gcc.gnu.org/g:22a982409323feb203401d345488a5a9c18e6733
> 
> commit r12-5759-g22a982409323feb203401d345488a5a9c18e6733
> Author: Iain Sandoe <iain@sandoe.co.uk>
> Date:   Sat Nov 13 12:39:09 2021 +0000
> 
>     Darwin: Rewrite host PCH support [PR 55610].
>     
>     We need to revise the PCH memory allocation scheme to enable
>     support for PIE on aarch64.  The rewrite uses a similar scheme
>     to the one used on Linux.
>     
>     We attempt to identify VM segments for each arch/OS version that
>     are always available to the compiler (note this is not general,
>     it only needs to work for the cc1* exes).
>     
>     If we cannot find the preferred segment we fall back to allowing
>     the kernel to supply one - this is more likely to fail when the
>     PCH read-in occurs (but that is trapped).
>     
>     In doing this we obviate the need to unmap any part of the
>     compiler __DATA segment - thus fixing PR 55610.
>     
>     Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
>     
>     gcc/ChangeLog:
>     
>             PR target/55610
>             * config/host-darwin.c (TRY_EMPTY_VM_SPACE,
>             SAFE_ALLOC_SIZE): New.
>             (darwin_gt_pch_get_address): Rewrite to use nominated
>             memory segments rather than part of the compiler __DATA
>             segment.
>             (darwin_gt_pch_use_address): Likewise.

So, ok to close this as FIXED now?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/55610] cc1 is calling munmap() on part of itself on darwin
  2012-12-06 15:19 [Bug target/55610] New: cc1 is calling munmap() on part of itself on darwin howarth at nitro dot med.uc.edu
                   ` (8 preceding siblings ...)
  2021-12-20  4:05 ` egallager at gcc dot gnu.org
@ 2023-05-16 19:18 ` iains at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: iains at gcc dot gnu.org @ 2023-05-16 19:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55610

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
              Build|x86_64-apple-darwin12       |*-*-darwin*
               Host|x86_64-apple-darwin12       |*-*-darwin*
             Target|x86_64-apple-darwin12       |*-*-darwin*

--- Comment #13 from Iain Sandoe <iains at gcc dot gnu.org> ---
this is fixed in gcc-12+ .. it is probably not a viable back port to earlier
upstream branches, but can be maintained on Darwin-specific ones.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-05-16 19:18 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-06 15:19 [Bug target/55610] New: cc1 is calling munmap() on part of itself on darwin howarth at nitro dot med.uc.edu
2012-12-06 15:25 ` [Bug target/55610] " howarth at nitro dot med.uc.edu
2012-12-06 15:28 ` howarth at nitro dot med.uc.edu
2012-12-06 23:58 ` mrs at gcc dot gnu.org
2012-12-07 17:35 ` howarth at nitro dot med.uc.edu
2012-12-07 18:03 ` howarth at nitro dot med.uc.edu
2021-11-11 15:49 ` egallager at gcc dot gnu.org
2021-11-11 15:55 ` iains at gcc dot gnu.org
2021-12-02 19:45 ` cvs-commit at gcc dot gnu.org
2021-12-20  4:05 ` egallager at gcc dot gnu.org
2023-05-16 19:18 ` iains at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).