7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 1988 AT&T
24 * All Rights Reserved
25 *
26 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
27 */
28
29 /*
30 * Processing of relocatable objects and shared objects.
31 */
32
33 /*
34 * ld -- link/editor main program
35 */
36 #include <sys/types.h>
37 #include <sys/time.h>
38 #include <sys/mman.h>
39 #include <string.h>
40 #include <stdio.h>
41 #include <locale.h>
42 #include <stdarg.h>
43 #include <debug.h>
44 #include "msg.h"
45 #include "_libld.h"
46
463 /*
464 * We're done, so make sure the updates are flushed to the output file.
465 */
466 if ((ofl->ofl_size = elf_update(ofl->ofl_welf, ELF_C_WRITE)) == 0) {
467 ld_eprintf(ofl, ERR_ELF, MSG_INTL(MSG_ELF_UPDATE),
468 ofl->ofl_name);
469 return (ld_exit(ofl));
470 }
471
472 ld_sup_atexit(ofl, 0);
473
474 DBG_CALL(Dbg_statistics_ld(ofl));
475 DBG_CALL(Dbg_basic_finish(ofl->ofl_lml));
476
477 /*
478 * Wrap up debug output file if one is open
479 */
480 dbg_cleanup();
481
482 /* If any ERR_GUIDANCE messages were issued, add a summary */
483 if (ofl->ofl_guideflags & FLG_OFG_ISSUED)
484 ld_eprintf(ofl, ERR_GUIDANCE, MSG_INTL(MSG_GUIDE_SUMMARY));
485
486 /*
487 * For performance reasons we don't actually free up the memory we've
488 * allocated, it will be freed when we exit.
489 *
490 * But the below line can be uncommented if/when we want to measure how
491 * our memory consumption and freeing are doing. We should be able to
492 * free all the memory that has been allocated as part of the link-edit
493 * process.
494 */
495 /* ld_ofl_cleanup(ofl); */
496 return (0);
497 }
498
499 /*
500 * Cleanup an Ifl_desc.
501 */
502 static void
503 ifl_list_cleanup(APlist *apl)
504 {
505 Aliste idx;
506 Ifl_desc *ifl;
|
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 1988 AT&T
24 * All Rights Reserved
25 *
26 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
27 *
28 * Copyright 2020 Joyent, Inc.
29 */
30
31 /*
32 * Processing of relocatable objects and shared objects.
33 */
34
35 /*
36 * ld -- link/editor main program
37 */
38 #include <sys/types.h>
39 #include <sys/time.h>
40 #include <sys/mman.h>
41 #include <string.h>
42 #include <stdio.h>
43 #include <locale.h>
44 #include <stdarg.h>
45 #include <debug.h>
46 #include "msg.h"
47 #include "_libld.h"
48
465 /*
466 * We're done, so make sure the updates are flushed to the output file.
467 */
468 if ((ofl->ofl_size = elf_update(ofl->ofl_welf, ELF_C_WRITE)) == 0) {
469 ld_eprintf(ofl, ERR_ELF, MSG_INTL(MSG_ELF_UPDATE),
470 ofl->ofl_name);
471 return (ld_exit(ofl));
472 }
473
474 ld_sup_atexit(ofl, 0);
475
476 DBG_CALL(Dbg_statistics_ld(ofl));
477 DBG_CALL(Dbg_basic_finish(ofl->ofl_lml));
478
479 /*
480 * Wrap up debug output file if one is open
481 */
482 dbg_cleanup();
483
484 /* If any ERR_GUIDANCE messages were issued, add a summary */
485 if (ofl->ofl_guideflags & FLG_OFG_ISSUED) {
486 ld_eprintf(ofl, ERR_GUIDANCE, MSG_INTL(MSG_GUIDE_SUMMARY));
487 ofl->ofl_guideflags &= ~FLG_OFG_ISSUED;
488 }
489
490 /*
491 * One final check for any new warnings we found that should fail the
492 * link edit.
493 */
494 if ((ofl->ofl_flags & (FLG_OF_WARN | FLG_OF_FATWARN)) ==
495 (FLG_OF_WARN | FLG_OF_FATWARN))
496 return (ld_exit(ofl));
497
498 /*
499 * For performance reasons we don't actually free up the memory we've
500 * allocated, it will be freed when we exit.
501 *
502 * But the below line can be uncommented if/when we want to measure how
503 * our memory consumption and freeing are doing. We should be able to
504 * free all the memory that has been allocated as part of the link-edit
505 * process.
506 */
507 /* ld_ofl_cleanup(ofl); */
508 return (0);
509 }
510
511 /*
512 * Cleanup an Ifl_desc.
513 */
514 static void
515 ifl_list_cleanup(APlist *apl)
516 {
517 Aliste idx;
518 Ifl_desc *ifl;
|