1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
|
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
include $(SRC)/Makefile.master
SUBDIRS= gen common $(MACH64)
all: TARGET= all
install: TARGET= install
clean: TARGET= clean
clobber: TARGET= clobber
lint: TARGET= lint
package: TARGET= package
.KEEP_STATE:
all: gen
install: $(SUBDIRS)
clean lint package:
clobber: gen
$(SUBDIRS): FRC
@cd $@; pwd; $(MAKE) $(TARGET)
FRC:
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
#
include $(SRC)/Makefile.master
ROOTDIR= $(ROOT)/usr/lib/ld
ROOTDIR64= $(ROOT)/usr/lib/ld/$(MACH64)
DIRS= $(ROOTDIR) $(ROOTDIR64)
FILES=
install: $(DIRS) $(FILES) map.link
$(FILES): FILEMODE=444
$(DIRS): DIRMODE=755
map.link:
$(RM) $(ROOTDIR64)/map.default \
$(ROOTDIR64)/map.above4G $(ROOTDIR64)/map.below4G
$(SYMLINK) ../map.default $(ROOTDIR64)/map.default
$(SYMLINK) ../map.above4G $(ROOTDIR64)/map.above4G
$(SYMLINK) ../map.below4G $(ROOTDIR64)/map.below4G
$(DIRS):
$(INS.dir)
$(ROOTDIR)/%: %
$(INS.file)
$(ROOTDIR64)/%: %
$(INS.file)
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
#
include $(SRC)/Makefile.master
ROOTDIR= $(ROOT)/usr/lib/ld
DIRS= $(ROOTDIR)
FILES= \
$(ROOTDIR)/map.above4G \
$(ROOTDIR)/map.below4G \
$(ROOTDIR)/map.bssalign \
$(ROOTDIR)/map.execdata \
$(ROOTDIR)/map.default \
$(ROOTDIR)/map.filter \
$(ROOTDIR)/map.noexbss \
$(ROOTDIR)/map.noexdata \
$(ROOTDIR)/map.noexstk \
$(ROOTDIR)/map.pagealign
install: $(DIRS) $(FILES)
$(FILES): FILEMODE=444
$(DIRS): DIRMODE=755
$(DIRS):
$(INS.dir)
$(ROOTDIR)/%: %
$(INS.file)
#
# Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Linker mapfile for loading 64-bit programs above 4 gigabytes.
# The linker does not use this file automatically, so one must
# use the -M option to cc or ld:
#
# cc -m64 -M /usr/lib/ld/map.above4G myprogram.c
#
$mapfile_version 2
$if !_ELF64
$error mapfile is only applicable to 64-bit objects
$endif
# sparcv9 and amd64 use the same address
$if _sparc || _x86
# On sparc (but not amd64), this is equivalent to map.default.
LOAD_SEGMENT text { VADDR = 0x100000000 };
$else
$error unknown platform
$endif
#
# Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Linker mapfile for loading 64-bit SPARC programs below 4 gigabytes
# The linker does not use this file automatically, so one must use the -M
# option to cc or ld:
#
# cc -m64 -M /usr/lib/ld/map.below4G myprogram.c
#
$mapfile_version 2
$if !_ELF64
$error mapfile is only applicable to 64-bit objects
$endif
# sparcv9 and amd64 use the same address
$if _sparc
LOAD_SEGMENT text { VADDR = 0x80000000 };
$elif _x86
# This is equivalent to map.default.
LOAD_SEGMENT text { VADDR = 0x400000 };
$else
$error unknown platform
$endif
#
# Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Link-editor mapfile that enables the creation of a bss segment, and aligns
# the segment at 4Mb. This effectively provides an appropriate alignment for
# large page mapping of the heap, and thus can be useful when building dynamic
# executables. See ppgsz(1). Users are cautioned that an alignment
# specification may be machine-specific, and may lose its benefit on different
# hardware platforms. A more flexible means of requesting the most optimal
# underlying page size may evolve in future releases.
#
# The link-editor does not use this file automatically, so one must use the
# -M option to cc or ld:
#
# cc -M /usr/lib/ld/map.bssalign myprogram.c
#
$mapfile_version 2
LOAD_SEGMENT bss {
ALIGN = 0x400000;
};
#
# Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Linker mapfile that shows how programs are loaded by default.
# The linker does not use this file automatically, so one must use the -M
# option to cc or ld:
#
# cc -M /usr/lib/ld/map.default myprogram.c
#
$mapfile_version 2
$if _sparc
$if _ELF32
LOAD_SEGMENT text { VADDR = 0x10000 };
$elif _ELF64
# This is equivalent to map.above4G.
LOAD_SEGMENT text { VADDR = 0x100000000 };
$else
$error unknown sparc ELFCLASS
$endif
$else _x86
$if _ELF32
LOAD_SEGMENT text { VADDR = 0x08048000 };
$elif _ELF64
# This is equivalent to map.below4G.
LOAD_SEGMENT text { VADDR = 0x400000 };
$else
$error unknown x86 ELFCLASS
$endif
$else
$error unknown platform
$endif
#
# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Link-editor mapfile to create an executable data segment definition within
# an executable for applications which rely on this. This is the default
# for 32 bit x86 executable and all SPARC executables; this mapfile is
# provided to facilitate an executable data segment for AMD64 executables.
#
# The link-editor does not use this file automatically, so one must use the
# -M option to cc or ld:
#
# cc -M /usr/lib/ld/map.execdata myprogram.c
#
$mapfile_version 2
LOAD_SEGMENT data {
FLAGS = READ WRITE EXECUTE;
};
#
# Executables can also create a separate executable bss segment. Adding
# the following line creates a bss segment.
#
# LOAD_SEGMENT bss { FLAGS = READ WRITE EXECUTE };
#
# See also /usr/lib/ld/map.noexdata.
#
# Copyright (c) 1993, 2010, Oracle and/or its affiliates. All rights reserved.
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# A default mapfile for optimizing the creation of a filter shared object.
# Creates a single, read-only, executable text segment to catch all loadable
# sections.
#
# Filters that consist solely of a symbol table can be built directly from
# ld(1) so that no .init/.fini sections are created. Although the filter can
# be constructed as a single read-only segment, the execute attribute of the
# segment is maintained to allow for simple .init processing (i.e., .init
# processing that requires no relocations), and to accommodate older versions
# of dbx that produce warning messages if they find objects without traditional
# text segments.
#
# If a filter is required to execute .init code that references global data
# then the filter will require relocation (i.e., it will have to be written to
# by ld.so.1). Filters of this sort should *not* use this mapfile.
#
# This compaction of a filter into a single segment allows ld.so.1 to optimize
# its processing of a filter. If the filter is small enough this segment may
# be handled in a single page mapping (for example libdl.so.1).
#
# The assignment of all allocatable sections to this segment insures that the
# .dynamic, and any .data or .bss sections, become part of the text. Note that
# the compiler has a habit of generating empty .data and .bss sections.
#
# Override the default alignment so that this single paged object can be mapped
# more flexibly.
$mapfile_version 2
LOAD_SEGMENT filter {
FLAGS = READ EXECUTE;
ALIGN = 0x1000;
ASSIGN_SECTION {
FLAGS = ALLOC;
};
};
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
#
$mapfile_version 2
# lex generates a lex.yy.c for use in building applications. A number of
# interfaces within this file are intended for libl.so to bind to, and thus
# should remain exported from any application using lex.yy.c.
SYMBOL_SCOPE {
global:
yyback;
yyextra;
yyfnd;
yyinput;
yyleng;
yylex;
yylsp;
yylstate;
yyolsp;
yyout;
yyprevious;
yytext;
yyunput;
};
# Some applications use the -e option of lex, which generates additional lex
# interfaces that are not defined in the generic $(MAPFILE.LEX). Export the
# following interfaces to satisfy -e use.
#SYMBOL_SCOPE {
# global:
# yywinput;
# yywleng;
# yywtext;
# yywunput;
#};
#
# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Link-editor mapfile to create a non-executable bss segment definition
# within an executable. This mapfile is similar to map.noexdata that
# can be used on x86 architectures to create a non-executable data
# segment. On SPARC, the data segment contains a Procedure Linkage
# Table (PLT) that must remain executable.
#
# As the bss segment is extended by sbrk(2) to enlarge the heap, a
# non-executable bss segment also results in a non-exutable heap.
#
# The link-editor does not use this file automatically, so one must
# use the -M option to cc or ld:
#
# cc -M /usr/lib/ld/map.noexbss myprogram.c
#
$mapfile_version 2
LOAD_SEGMENT bss {
FLAGS = READ WRITE;
};
# See also /usr/lib/ld/map.noexdata.
#
# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Link-editor mapfile to create a non-executable data segment definition
# within an executable. Note that this only functions properly on the
# x86 architecture. On SPARC, the data segment contains a Procedure Linkage
# Table (PLT) that must remain executable.
#
# As the data segment is extended by sbrk(2) to enlarge the heap, a
# non-executable data segment also results in a non-exutable heap.
#
# The link-editor does not use this file automatically, so one must use the
# -M option to cc or ld:
#
# cc -M /usr/lib/ld/map.noexdata myprogram.c
#
#
# Executables can also create a separate non-executable bss segment.
# This segment may use additional memory, but also results in a
# non-executable heap. See /usr/lib/ld/map.noexbss.
#
# See also /usr/lib/ld/map.execdata.
$mapfile_version 2
$if _sparc
$error SPARC Procedure Linkage Table (PLT) must remain executable
$elif _x86
LOAD_SEGMENT data { FLAGS = READ WRITE };
$else
$error unknown platform
$endif
#
# Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Linker mapfile to create a non-executable stack definition within an
# executable.
# The linker does not use this file automatically, so one must use the -M
# option to cc or ld:
#
# cc -M /usr/lib/ld/map.noexstk myprogram.c
#
$mapfile_version 2
STACK {
FLAGS = READ WRITE;
};
#
# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Linker mapfile to create page-aligned data within an executable.
# The linker does not use this file automatically, so one must use the -M
# option to cc or ld:
#
# cc -M /usr/lib/ld/map.pagealign myprogram.c
#
$mapfile_version 2
$if _sparc
LOAD_SEGMENT data { ROUND = 0x2000 };
$elif _x86
LOAD_SEGMENT data { ROUND = 0x1000 };
$else
$error unknown platform
$endif
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
# Copyright 2015 Igor Kozhukhov <ikozhukhov@gmail.com>
#
include $(SRC)/Makefile.master
# Hammerhead: Mapfile generation needs native build settings (no -nodefaultlibs)
# to properly link test executables against libc
include $(SRC)/Makefile.native
include $(SRC)/Makefile.master.64
# Hammerhead: amd64-only - skip 32-bit mapfiles, build only 64-bit
FILES= $(MACH64)_gcc_map.noexeglobs
NATIVE_LIBS += libc.so
LDFLAGS += $(BDIRECT)
# Hammerhead: Simple GCC link command for mapfile test executables
# - Uses GCC_NATIVE_FLAGS (no -nodefaultlibs) to link against libc
# - Uses only -m64 for amd64 target
# - Uses LD_ALTEXEC to route through gnu-ld-wrapper for mapfile conversion
MAPFILE_LINK64= LD_ALTEXEC=$(BUILD_LD) $(GCC) $(GCC_NATIVE_FLAGS) -m64
SYMS1= syms.1
SYMS2= syms.2
MAIN1= main.1
MAIN2= main.2
TEMPLATE1= map.noexeglobs.1.template
TEMPLATE2= map.noexeglobs.2.template
all install: $(FILES)
clean:
$(RM) $(SYMS1) $(SYMS2) $(MAIN1) $(MAIN2)
clobber: clean
$(RM) $(FILES)
# A number of dynamic executables have their own definitions of interfaces that
# exist in system libraries. To prevent name-space pollution it is desirable
# to demote the interfaces within these executable to locals. However, various
# symbols defined by the compiler drivers crt/values files need to remain
# global in any dynamic object that includes these files. These symbols
# interpose on symbols in libc, or provide call backs for other system
# libraries. The various compiler drivers (cc and gcc), and the crt/values
# files that these drivers are configured to include, differ between the
# various compilations environments (platform, 32/64-bit). Therefore, the
# only means of creating a mapfile to demote symbols is to dynamically generate
# the mapfile for a specific compilation environment.
#
# Here, template mapfiles are used to generate a number of compilation specific
# mapfiles. These mapfiles are referenced by components of the build through
# the MAPFILE.NGB macro defined in Makefile.master. These dynamically created
# mapfiles are not delivered into the $ROOT area, and therefore are not
# delivered as packaged components of the OSNet.
# Hammerhead: Use MAPFILE_LINK64 for proper native linking (amd64-only)
$(MACH64)_gcc_map.noexeglobs : LINK = $(MAPFILE_LINK64)
# This generic target creates two dynamic executables from an empty "main"
# program. These objects are not executed, but are analyzed to determine the
# global symbols each provides.
#
# The first executable demotes a family of known interfaces to local and allows
# all other symbol definitions to remain global. This executables provides the
# base for discovering all symbol definitions provided by the various
# compilation environments. The second executable demotes all symbols to
# locals. Within both executables, some symbols remain globals (_end, _etext,
# etc.) as the link-editor has special knowledge of these symbols and their
# expected visibility requirements. By inspecting the deferences between the
# global symbols within the two executables, a mapfile can be generated to
# ensure the symbols defined by the compilation environments files remain
# global.
%map.noexeglobs: main.c $(TEMPLATE1) $(TEMPLATE2)
$(LINK) -o $(MAIN1) -Wl,-M$(TEMPLATE1) main.c
$(ELFDUMP) -s -N.dynsym $(MAIN1) | $(EGREP) "WEAK|GLOB" | \
$(GREP) -v UNDEF | $(AWK) '{print $$9 }' | $(SORT) > $(SYMS1)
$(LINK) -o $(MAIN2) -Wl,-M$(TEMPLATE2) main.c
$(ELFDUMP) -s -N.dynsym $(MAIN2) | $(EGREP) "WEAK|GLOB" | \
$(GREP) -v UNDEF | $(AWK) '{print $$9 }' | $(SORT) > $(SYMS2)
$(ECHO) "# GENERATED FILE - DO NOT EDIT" > $@
$(GREP) MAP-HEAD $(TEMPLATE2) | \
$(SED) -e "s/ *# MAP-HEAD//" >> $@
$(DIFF) $(SYMS1) $(SYMS2) | $(GREP) "^<" | \
$(SED) -e "s/^< \(.*\)/ \1;/" >> $@
$(GREP) MAP-TAIL $(TEMPLATE2) | \
$(SED) -e "s/ *# MAP-TAIL//" >> $@
$(RM) $(SYMS1) $(SYMS2) $(MAIN1) $(MAIN2)
/*
* Minimal main for mapfile generation.
* This file is used to build test executables that are analyzed
* to determine which symbols the compiler's crt/values files provide.
*/
int
main(void)
{
return (0);
}
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
#
# Template mapfile for generating a final mapfile to demote all user global
# symbols to local within a dynamic executable.
#
$mapfile_version 2
SYMBOL_SCOPE {
local:
_fini;
_init;
_start;
main;
};
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
#
# Template mapfile for generating a final mapfile to demote all user global
# symbols to local within a dynamic executable. This mapfile also provides
# the "MAP-" commented entries to select lines for the final mapfile.
#
$mapfile_version 2 # MAP-HEAD
# MAP-HEAD
SYMBOL_SCOPE { # MAP-HEAD
global: # MAP-HEAD
_lib_version; # MAP-HEAD
local: # MAP-TAIL
*; # MAP-TAIL
}; # MAP-TAIL
|