link_flags.h (1841B)
1 #ifndef KIT_DRIVER_LINK_FLAGS_H 2 #define KIT_DRIVER_LINK_FLAGS_H 3 4 #include <kit/link.h> 5 #include <stddef.h> 6 #include <stdint.h> 7 8 #include "driver.h" 9 10 typedef struct DriverLinkFlags { 11 DriverEnv* env; 12 const char* tool; 13 14 const char* entry; 15 const char* linker_script; 16 uint16_t pe_subsystem; /* KitPeSubsystem */ 17 const char* soname; 18 const char* interp_path; 19 const char** rpaths; 20 uint32_t nrpaths; 21 uint32_t cap_rpaths; 22 int new_dtags; /* 1=DT_RUNPATH (default), 0=DT_RPATH */ 23 int gc_sections; 24 int strip_debug; 25 26 uint8_t build_id_mode; /* KitBuildIdMode */ 27 uint8_t* build_id_bytes; 28 uint32_t build_id_len; 29 size_t build_id_size; 30 31 char** owned_strings; 32 size_t* owned_string_sizes; 33 uint32_t nowned_strings; 34 uint32_t cap_owned_strings; 35 } DriverLinkFlags; 36 37 int driver_link_flags_init(DriverLinkFlags* lf, DriverEnv* env, 38 const char* tool, uint32_t initial_cap); 39 void driver_link_flags_fini(DriverLinkFlags* lf); 40 41 int driver_link_flags_record_wl(DriverLinkFlags* lf, const char* arg); 42 int driver_link_flags_record_build_id(DriverLinkFlags* lf, const char* val); 43 int driver_link_flags_record_pe_subsystem(DriverLinkFlags* lf, 44 const char* val, size_t n); 45 46 int driver_link_flags_fill_options(const DriverLinkFlags* lf, 47 KitTargetSpec target, int explicit_pie, 48 int shared, int relocatable, 49 uint8_t output_kind, 50 const KitLinkScript* script, 51 KitLinkSessionOptions* lopts, 52 KitSlice** rpath_slices_out); 53 void driver_link_flags_free_rpath_slices(const DriverLinkFlags* lf, 54 KitSlice* rpath_slices); 55 56 #endif