Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
4,321
Issues
4,321
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
362
Merge Requests
362
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
d8d16174
Commit
d8d16174
authored
Oct 02, 2011
by
Ian Lynagh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some CPP removal
parent
651cd996
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
32 deletions
+39
-32
compiler/cmm/CLabel.hs
compiler/cmm/CLabel.hs
+31
-24
compiler/nativeGen/PIC.hs
compiler/nativeGen/PIC.hs
+8
-8
No files found.
compiler/cmm/CLabel.hs
View file @
d8d16174
...
...
@@ -128,6 +128,7 @@ import CostCentre
import
Outputable
import
FastString
import
DynFlags
import
Platform
import
UniqSet
-- -----------------------------------------------------------------------------
...
...
@@ -773,42 +774,48 @@ idInfoLabelType info =
-- @labelDynamic@ returns @True@ if the label is located
-- in a DLL, be it a data reference or not.
labelDynamic
::
PackageId
->
CLabel
->
Bool
labelDynamic
this_pkg
lbl
=
labelDynamic
::
DynFlags
->
PackageId
->
CLabel
->
Bool
labelDynamic
dflags
this_pkg
lbl
=
case
lbl
of
-- is the RTS in a DLL or not?
RtsLabel
_
->
not
opt_Static
&&
(
this_pkg
/=
rtsPackageId
)
IdLabel
n
_
k
->
isDllName
this_pkg
n
#
if
mingw32_TARGET_OS
--
When compiling in the "dyn" way, eack package is to be linked into
its own shared library.
-- When compiling in the "dyn" way, eack package is to be linked into
-- its own shared library.
CmmLabel
pkg
_
_
->
not
opt_Static
&&
(
this_pkg
/=
pkg
)
|
os
==
OSMinGW32
->
not
opt_Static
&&
(
this_pkg
/=
pkg
)
|
otherwise
->
True
ForeignLabel
_
_
source
_
->
if
os
==
OSMinGW32
then
case
source
of
-- Foreign label is in some un-named foreign package (or DLL).
ForeignLabelInExternalPackage
->
True
-- Foreign label is linked into the same package as the
-- source file currently being compiled.
ForeignLabelInThisPackage
->
False
-- Foreign label is in some named package.
-- When compiling in the "dyn" way, each package is to be
-- linked into its own DLL.
ForeignLabelInPackage
pkgId
->
(
not
opt_Static
)
&&
(
this_pkg
/=
pkgId
)
else
-- On Mac OS X and on ELF platforms, false positives are OK,
-- so we claim that all foreign imports come from dynamic
-- libraries
True
-- Foreign label is in some un-named foreign package (or DLL)
ForeignLabel
_
_
ForeignLabelInExternalPackage
_
->
True
-- Foreign label is linked into the same package as the source file currently being compiled.
ForeignLabel
_
_
ForeignLabelInThisPackage
_
->
False
-- Foreign label is in some named package.
-- When compiling in the "dyn" way, each package is to be linked into its own DLL.
ForeignLabel
_
_
(
ForeignLabelInPackage
pkgId
)
_
->
(
not
opt_Static
)
&&
(
this_pkg
/=
pkgId
)
#
else
-- On Mac OS X and on ELF platforms, false positives are OK,
-- so we claim that all foreign imports come from dynamic libraries
ForeignLabel
_
_
_
_
->
True
CmmLabel
pkg
_
_
->
True
#
endif
PlainModuleInitLabel
m
->
not
opt_Static
&&
this_pkg
/=
(
modulePackageId
m
)
-- Note that DynamicLinkerLabels do NOT require dynamic linking themselves.
_
->
False
where
os
=
platformOS
(
targetPlatform
dflags
)
{-
OLD?: These GRAN functions are needed for spitting out GRAN_FETCH() at the
...
...
compiler/nativeGen/PIC.hs
View file @
d8d16174
...
...
@@ -225,7 +225,7 @@ howToAccessLabel dflags _ OSMinGW32 _ lbl
-- If the target symbol is in another PE we need to access it via the
-- appropriate __imp_SYMBOL pointer.
|
labelDynamic
(
thisPackage
dflags
)
lbl
|
labelDynamic
dflags
(
thisPackage
dflags
)
lbl
=
AccessViaSymbolPtr
-- Target symbol is in the same PE as the caller, so just access it directly.
...
...
@@ -243,7 +243,7 @@ howToAccessLabel dflags _ OSMinGW32 _ lbl
--
howToAccessLabel
dflags
arch
OSDarwin
DataReference
lbl
-- data access to a dynamic library goes via a symbol pointer
|
labelDynamic
(
thisPackage
dflags
)
lbl
|
labelDynamic
dflags
(
thisPackage
dflags
)
lbl
=
AccessViaSymbolPtr
-- when generating PIC code, all cross-module data references must
...
...
@@ -267,7 +267,7 @@ howToAccessLabel dflags arch OSDarwin JumpReference lbl
-- stack alignment is only right for regular calls.
-- Therefore, we have to go via a symbol pointer:
|
arch
==
ArchX86
||
arch
==
ArchX86_64
,
labelDynamic
(
thisPackage
dflags
)
lbl
,
labelDynamic
dflags
(
thisPackage
dflags
)
lbl
=
AccessViaSymbolPtr
...
...
@@ -276,7 +276,7 @@ howToAccessLabel dflags arch OSDarwin _ lbl
-- not needed on x86_64 because Apple's new linker, ld64, generates
-- them automatically.
|
arch
/=
ArchX86_64
,
labelDynamic
(
thisPackage
dflags
)
lbl
,
labelDynamic
dflags
(
thisPackage
dflags
)
lbl
=
AccessViaStub
|
otherwise
...
...
@@ -313,7 +313,7 @@ howToAccessLabel dflags arch os DataReference lbl
|
osElfTarget
os
=
case
()
of
-- A dynamic label needs to be accessed via a symbol pointer.
_
|
labelDynamic
(
thisPackage
dflags
)
lbl
_
|
labelDynamic
dflags
(
thisPackage
dflags
)
lbl
->
AccessViaSymbolPtr
-- For PowerPC32 -fPIC, we have to access even static data
...
...
@@ -341,17 +341,17 @@ howToAccessLabel dflags arch os DataReference lbl
howToAccessLabel
dflags
arch
os
CallReference
lbl
|
osElfTarget
os
,
labelDynamic
(
thisPackage
dflags
)
lbl
&&
not
opt_PIC
,
labelDynamic
dflags
(
thisPackage
dflags
)
lbl
&&
not
opt_PIC
=
AccessDirectly
|
osElfTarget
os
,
arch
/=
ArchX86
,
labelDynamic
(
thisPackage
dflags
)
lbl
&&
opt_PIC
,
labelDynamic
dflags
(
thisPackage
dflags
)
lbl
&&
opt_PIC
=
AccessViaStub
howToAccessLabel
dflags
_
os
_
lbl
|
osElfTarget
os
=
if
labelDynamic
(
thisPackage
dflags
)
lbl
=
if
labelDynamic
dflags
(
thisPackage
dflags
)
lbl
then
AccessViaSymbolPtr
else
AccessDirectly
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment