Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jan van Brügge
GHC
Commits
16dd532e
Commit
16dd532e
authored
7 years ago
by
Ben Gamari
Browse files
Options
Downloads
Patches
Plain Diff
CLabel: Refactor pprDynamicLinkerAsmLabel
parent
048a9138
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
compiler/cmm/CLabel.hs
+59
-49
59 additions, 49 deletions
compiler/cmm/CLabel.hs
with
59 additions
and
49 deletions
compiler/cmm/CLabel.hs
+
59
−
49
View file @
16dd532e
...
...
@@ -1285,53 +1285,63 @@ asmTempLabelPrefix platform = case platformOS platform of
_
->
sLit
".L"
pprDynamicLinkerAsmLabel
::
Platform
->
DynamicLinkerLabelInfo
->
CLabel
->
SDoc
pprDynamicLinkerAsmLabel
platform
dllInfo
lbl
=
if
platformOS
platform
==
OSDarwin
then
if
platformArch
platform
==
ArchX86_64
then
case
dllInfo
of
CodeStub
->
char
'L'
<>
ppr
lbl
<>
text
"$stub"
SymbolPtr
->
char
'L'
<>
ppr
lbl
<>
text
"$non_lazy_ptr"
GotSymbolPtr
->
ppr
lbl
<>
text
"@GOTPCREL"
GotSymbolOffset
->
ppr
lbl
else
case
dllInfo
of
CodeStub
->
char
'L'
<>
ppr
lbl
<>
text
"$stub"
SymbolPtr
->
char
'L'
<>
ppr
lbl
<>
text
"$non_lazy_ptr"
_
->
panic
"pprDynamicLinkerAsmLabel"
else
if
platformOS
platform
==
OSAIX
then
case
dllInfo
of
SymbolPtr
->
text
"LC.."
<>
ppr
lbl
-- GCC's naming convention
_
->
panic
"pprDynamicLinkerAsmLabel"
else
if
osElfTarget
(
platformOS
platform
)
then
if
platformArch
platform
==
ArchPPC
then
case
dllInfo
of
CodeStub
->
-- See Note [.LCTOC1 in PPC PIC code]
ppr
lbl
<>
text
"+32768@plt"
SymbolPtr
->
text
".LC_"
<>
ppr
lbl
_
->
panic
"pprDynamicLinkerAsmLabel"
else
if
platformArch
platform
==
ArchX86_64
then
case
dllInfo
of
CodeStub
->
ppr
lbl
<>
text
"@plt"
GotSymbolPtr
->
ppr
lbl
<>
text
"@gotpcrel"
GotSymbolOffset
->
ppr
lbl
SymbolPtr
->
text
".LC_"
<>
ppr
lbl
else
if
platformArch
platform
==
ArchPPC_64
ELF_V1
||
platformArch
platform
==
ArchPPC_64
ELF_V2
then
case
dllInfo
of
GotSymbolPtr
->
text
".LC_"
<>
ppr
lbl
<>
text
"@toc"
GotSymbolOffset
->
ppr
lbl
SymbolPtr
->
text
".LC_"
<>
ppr
lbl
_
->
panic
"pprDynamicLinkerAsmLabel"
else
case
dllInfo
of
CodeStub
->
ppr
lbl
<>
text
"@plt"
SymbolPtr
->
text
".LC_"
<>
ppr
lbl
GotSymbolPtr
->
ppr
lbl
<>
text
"@got"
GotSymbolOffset
->
ppr
lbl
<>
text
"@gotoff"
else
if
platformOS
platform
==
OSMinGW32
then
case
dllInfo
of
SymbolPtr
->
text
"__imp_"
<>
ppr
lbl
_
->
panic
"pprDynamicLinkerAsmLabel"
else
panic
"pprDynamicLinkerAsmLabel"
pprDynamicLinkerAsmLabel
platform
dllInfo
lbl
=
case
platformOS
platform
of
OSDarwin
|
platformArch
platform
==
ArchX86_64
->
case
dllInfo
of
CodeStub
->
char
'L'
<>
ppr
lbl
<>
text
"$stub"
SymbolPtr
->
char
'L'
<>
ppr
lbl
<>
text
"$non_lazy_ptr"
GotSymbolPtr
->
ppr
lbl
<>
text
"@GOTPCREL"
GotSymbolOffset
->
ppr
lbl
|
otherwise
->
case
dllInfo
of
CodeStub
->
char
'L'
<>
ppr
lbl
<>
text
"$stub"
SymbolPtr
->
char
'L'
<>
ppr
lbl
<>
text
"$non_lazy_ptr"
_
->
panic
"pprDynamicLinkerAsmLabel"
OSAIX
->
case
dllInfo
of
SymbolPtr
->
text
"LC.."
<>
ppr
lbl
-- GCC's naming convention
_
->
panic
"pprDynamicLinkerAsmLabel"
_
|
osElfTarget
(
platformOS
platform
)
->
elfLabel
OSMinGW32
->
case
dllInfo
of
SymbolPtr
->
text
"__imp_"
<>
ppr
lbl
_
->
panic
"pprDynamicLinkerAsmLabel"
_
->
panic
"pprDynamicLinkerAsmLabel"
where
elfLabel
|
platformArch
platform
==
ArchPPC
=
case
dllInfo
of
CodeStub
->
-- See Note [.LCTOC1 in PPC PIC code]
ppr
lbl
<>
text
"+32768@plt"
SymbolPtr
->
text
".LC_"
<>
ppr
lbl
_
->
panic
"pprDynamicLinkerAsmLabel"
|
platformArch
platform
==
ArchX86_64
=
case
dllInfo
of
CodeStub
->
ppr
lbl
<>
text
"@plt"
GotSymbolPtr
->
ppr
lbl
<>
text
"@gotpcrel"
GotSymbolOffset
->
ppr
lbl
SymbolPtr
->
text
".LC_"
<>
ppr
lbl
|
platformArch
platform
==
ArchPPC_64
ELF_V1
||
platformArch
platform
==
ArchPPC_64
ELF_V2
=
case
dllInfo
of
GotSymbolPtr
->
text
".LC_"
<>
ppr
lbl
<>
text
"@toc"
GotSymbolOffset
->
ppr
lbl
SymbolPtr
->
text
".LC_"
<>
ppr
lbl
_
->
panic
"pprDynamicLinkerAsmLabel"
|
otherwise
=
case
dllInfo
of
CodeStub
->
ppr
lbl
<>
text
"@plt"
SymbolPtr
->
text
".LC_"
<>
ppr
lbl
GotSymbolPtr
->
ppr
lbl
<>
text
"@got"
GotSymbolOffset
->
ppr
lbl
<>
text
"@gotoff"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment