@@ -4577,17 +4577,50 @@ const EPILOGUE_DYNAMIC_ENTRY_WRITERS: &[DynamicEntryWriter] = &[
45774577 } ) ,
45784578 DynamicEntryWriter :: optional (
45794579 object:: elf:: DT_RELR ,
4580- |inputs| inputs. has_data_in_section ( output_section_id:: RELR_DYN ) ,
4580+ |inputs| {
4581+ inputs. has_data_in_section ( output_section_id:: RELR_DYN )
4582+ && !has_android_relr_tags ( inputs)
4583+ } ,
45814584 |inputs| inputs. vma_of_section ( output_section_id:: RELR_DYN ) ,
45824585 ) ,
45834586 DynamicEntryWriter :: optional (
45844587 object:: elf:: DT_RELRSZ ,
4585- |inputs| inputs. has_data_in_section ( output_section_id:: RELR_DYN ) ,
4588+ |inputs| {
4589+ inputs. has_data_in_section ( output_section_id:: RELR_DYN )
4590+ && !has_android_relr_tags ( inputs)
4591+ } ,
45864592 |inputs| inputs. size_of_section ( output_section_id:: RELR_DYN ) ,
45874593 ) ,
45884594 DynamicEntryWriter :: optional (
45894595 object:: elf:: DT_RELRENT ,
4590- |inputs| inputs. has_data_in_section ( output_section_id:: RELR_DYN ) ,
4596+ |inputs| {
4597+ inputs. has_data_in_section ( output_section_id:: RELR_DYN )
4598+ && !has_android_relr_tags ( inputs)
4599+ } ,
4600+ |_| elf:: RELR_ENTRY_SIZE ,
4601+ ) ,
4602+ DynamicEntryWriter :: optional (
4603+ // TODO(object): Not yet added
4604+ 0x6fff_e000 ,
4605+ |inputs| {
4606+ inputs. has_data_in_section ( output_section_id:: RELR_DYN ) && has_android_relr_tags ( inputs)
4607+ } ,
4608+ |inputs| inputs. vma_of_section ( output_section_id:: RELR_DYN ) ,
4609+ ) ,
4610+ DynamicEntryWriter :: optional (
4611+ // TODO(object): Not yet added
4612+ 0x6fff_e001 ,
4613+ |inputs| {
4614+ inputs. has_data_in_section ( output_section_id:: RELR_DYN ) && has_android_relr_tags ( inputs)
4615+ } ,
4616+ |inputs| inputs. size_of_section ( output_section_id:: RELR_DYN ) ,
4617+ ) ,
4618+ DynamicEntryWriter :: optional (
4619+ // TODO(object): Not yet added
4620+ 0x6fff_e003 ,
4621+ |inputs| {
4622+ inputs. has_data_in_section ( output_section_id:: RELR_DYN ) && has_android_relr_tags ( inputs)
4623+ } ,
45914624 |_| elf:: RELR_ENTRY_SIZE ,
45924625 ) ,
45934626 DynamicEntryWriter :: optional (
@@ -4849,7 +4882,14 @@ fn write_section_headers(out: &mut [u8], layout: &ElfLayout) -> Result {
48494882 let entry = entries. next ( ) . unwrap ( ) ;
48504883 let e = LittleEndian ;
48514884 entry. sh_name . set ( e, name_offset) ;
4852- entry. sh_type . set ( e, section_type. raw ( ) ) ;
4885+
4886+ let sh_type = if layout. args ( ) . use_android_relr_tags && section_type == sht:: RELR {
4887+ // TODO(object): Not yet added
4888+ 0x6fffff00
4889+ } else {
4890+ section_type. raw ( )
4891+ } ;
4892+ entry. sh_type . set ( e, sh_type) ;
48534893
48544894 // TODO: Sections are always uncompressed and the output compression is not supported yet.
48554895 entry. sh_flags . set (
@@ -5267,6 +5307,10 @@ fn has_rela_dyn(inputs: &DynamicEntryInputs) -> bool {
52675307 relative. mem_size > 0 || general. mem_size > 0
52685308}
52695309
5310+ fn has_android_relr_tags ( inputs : & DynamicEntryInputs ) -> bool {
5311+ inputs. args . use_android_relr_tags
5312+ }
5313+
52705314pub ( crate ) fn verify_resolution_allocation (
52715315 output_sections : & OutputSections < Elf > ,
52725316 output_order : & OutputOrder ,
0 commit comments