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 */
30 #pragma ident "%Z%%M% %I% %E% SMI"
38 elf_flagdata(Elf_Data
* data
, Elf_Cmd cmd
, unsigned flags
)
53 if (cmd
== ELF_C_SET
) {
54 rc
= d
->db_uflags
|= flags
;
55 } else if (cmd
== ELF_C_CLR
) {
56 rc
= d
->db_uflags
&= ~flags
;
58 _elf_seterr(EREQ_FLAG
, 0);
65 elf_flagehdr(Elf
* elf
, Elf_Cmd cmd
, unsigned flags
)
70 if (cmd
== ELF_C_SET
) {
72 rc
= elf
->ed_ehflags
|= flags
;
76 if (cmd
== ELF_C_CLR
) {
78 rc
= elf
->ed_ehflags
&= ~flags
;
82 _elf_seterr(EREQ_FLAG
, 0);
88 elf_flagelf(Elf
* elf
, Elf_Cmd cmd
, unsigned flags
)
93 if (cmd
== ELF_C_SET
) {
95 rc
= elf
->ed_uflags
|= flags
;
99 if (cmd
== ELF_C_CLR
) {
101 rc
= elf
->ed_uflags
&= ~flags
;
105 _elf_seterr(EREQ_FLAG
, 0);
111 elf_flagphdr(Elf
* elf
, Elf_Cmd cmd
, unsigned flags
)
116 if (cmd
== ELF_C_SET
) {
118 rc
= elf
->ed_phflags
|= flags
;
122 if (cmd
== ELF_C_CLR
) {
124 rc
= elf
->ed_phflags
&= ~flags
;
128 _elf_seterr(EREQ_FLAG
, 0);
134 elf_flagscn(Elf_Scn
* scn
, Elf_Cmd cmd
, unsigned flags
)
143 if (cmd
== ELF_C_SET
) {
145 rc
= scn
->s_uflags
|= flags
;
146 READUNLOCKS(elf
, scn
)
149 if (cmd
== ELF_C_CLR
) {
151 rc
= scn
->s_uflags
&= ~flags
;
152 READUNLOCKS(elf
, scn
)
155 _elf_seterr(EREQ_FLAG
, 0);
161 elf_flagshdr(Elf_Scn
* scn
, Elf_Cmd cmd
, unsigned flags
)
169 if (cmd
== ELF_C_SET
) {
171 rc
= scn
->s_shflags
|= flags
;
172 READUNLOCKS(elf
, scn
)
175 if (cmd
== ELF_C_CLR
) {
177 rc
= scn
->s_shflags
&= ~flags
;
178 READUNLOCKS(elf
, scn
)
181 _elf_seterr(EREQ_FLAG
, 0);