xref: /dflybsd-src/contrib/binutils-2.34/bfd/elf-linker-x86.h (revision b52ef7118d1621abed722c5bbbd542210290ecef)
1*fae548d3Szrj /* x86-specific ELF linker support between ld and bfd.
2*fae548d3Szrj    Copyright (C) 2019-2020 Free Software Foundation, Inc.
3*fae548d3Szrj 
4*fae548d3Szrj    This file is part of BFD, the Binary File Descriptor library.
5*fae548d3Szrj 
6*fae548d3Szrj    This program is free software; you can redistribute it and/or modify
7*fae548d3Szrj    it under the terms of the GNU General Public License as published by
8*fae548d3Szrj    the Free Software Foundation; either version 3 of the License, or
9*fae548d3Szrj    (at your option) any later version.
10*fae548d3Szrj 
11*fae548d3Szrj    This program is distributed in the hope that it will be useful,
12*fae548d3Szrj    but WITHOUT ANY WARRANTY; without even the implied warranty of
13*fae548d3Szrj    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*fae548d3Szrj    GNU General Public License for more details.
15*fae548d3Szrj 
16*fae548d3Szrj    You should have received a copy of the GNU General Public License
17*fae548d3Szrj    along with this program; if not, write to the Free Software
18*fae548d3Szrj    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
19*fae548d3Szrj    MA 02110-1301, USA.  */
20*fae548d3Szrj 
21*fae548d3Szrj /* Missing IBT and SHSTK property report control.  */
22*fae548d3Szrj enum elf_x86_cet_report
23*fae548d3Szrj {
24*fae548d3Szrj   cet_report_none	= 0,	    /* Do nothing.  */
25*fae548d3Szrj   cet_report_warning	= 1 << 0,   /* Issue a warning.  */
26*fae548d3Szrj   cet_report_error	= 1 << 1,   /* Issue an error.  */
27*fae548d3Szrj   cet_report_ibt	= 1 << 2,   /* Report missing IBT property.  */
28*fae548d3Szrj   cet_report_shstk	= 1 << 3    /* Report missing SHSTK property.  */
29*fae548d3Szrj };
30*fae548d3Szrj 
31*fae548d3Szrj /* Used to pass x86-specific linker options from ld to bfd.  */
32*fae548d3Szrj struct elf_linker_x86_params
33*fae548d3Szrj {
34*fae548d3Szrj   /* TRUE if BND prefix in PLT entries is always generated.  */
35*fae548d3Szrj   unsigned int bndplt: 1;
36*fae548d3Szrj 
37*fae548d3Szrj   /* TRUE if IBT-enabled PLT entries should be generated.  */
38*fae548d3Szrj   unsigned int ibtplt: 1;
39*fae548d3Szrj 
40*fae548d3Szrj   /* TRUE if GNU_PROPERTY_X86_FEATURE_1_IBT should be generated.  */
41*fae548d3Szrj   unsigned int ibt: 1;
42*fae548d3Szrj 
43*fae548d3Szrj   /* TRUE if GNU_PROPERTY_X86_FEATURE_1_SHSTK should be generated.  */
44*fae548d3Szrj   unsigned int shstk: 1;
45*fae548d3Szrj 
46*fae548d3Szrj   /* TRUE if we shouldn't check relocation overflow.  */
47*fae548d3Szrj   unsigned int no_reloc_overflow_check: 1;
48*fae548d3Szrj 
49*fae548d3Szrj   /* TRUE if generate a 1-byte NOP as suffix for x86 call instruction.  */
50*fae548d3Szrj   unsigned int call_nop_as_suffix : 1;
51*fae548d3Szrj 
52*fae548d3Szrj   /* Report missing IBT and SHSTK properties.  */
53*fae548d3Szrj   enum elf_x86_cet_report cet_report;
54*fae548d3Szrj 
55*fae548d3Szrj   /* The 1-byte NOP for x86 call instruction.  */
56*fae548d3Szrj   char call_nop_byte;
57*fae548d3Szrj };
58*fae548d3Szrj 
59*fae548d3Szrj extern void _bfd_elf_linker_x86_set_options
60*fae548d3Szrj   (struct bfd_link_info *, struct elf_linker_x86_params *);
61