4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
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.
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]
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1988 AT&T */
28 /* All Rights Reserved */
36 elf_newdata(Elf_Scn
* s
)
47 if (s
->s_index
== SHN_UNDEF
) {
48 _elf_seterr(EREQ_SCNNULL
, 0);
53 if ((s
->s_myflags
& SF_READY
) == 0) {
56 * re-confirm that another 'thread' hasn't come along
57 * and cooked this section while the locks were
60 if ((s
->s_myflags
& SF_READY
) == 0)
61 (void) _elf_cookscn(s
);
62 DOWNGRADELOCKS(elf
, s
)
66 * If this is the first new node, use the one allocated
67 * in the scn itself. Update data buffer in both cases.
69 ELFACCESSDATA(work
, _elf_work
)
70 if (s
->s_hdnode
== 0) {
71 s
->s_dnode
.db_uflags
|= ELF_F_DIRTY
;
72 s
->s_dnode
.db_myflags
|= DBF_READY
;
73 s
->s_hdnode
= &s
->s_dnode
;
74 s
->s_tlnode
= &s
->s_dnode
;
75 s
->s_dnode
.db_scn
= s
;
76 s
->s_dnode
.db_data
.d_version
= work
;
77 rc
= &s
->s_dnode
.db_data
;
81 if ((d
= _elf_dnode()) == 0) {
85 d
->db_data
.d_version
= work
;
87 d
->db_uflags
|= ELF_F_DIRTY
;
88 d
->db_myflags
|= DBF_READY
;
89 s
->s_tlnode
->db_next
= d
;