From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nikam.ms.mff.cuni.cz (nikam.ms.mff.cuni.cz [195.113.20.16]) by sourceware.org (Postfix) with ESMTPS id 0F2BD3858CDB for ; Wed, 18 Oct 2023 15:30:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0F2BD3858CDB Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=ucw.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kam.mff.cuni.cz ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0F2BD3858CDB Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.113.20.16 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697643032; cv=none; b=Q2tazsf3uN4s9cv8vC9cdtfT5Vb+r2GNoGbBEM455TOV/z8aGsKsAjRwH5QZI3GhdybCuraYUDiK7kyV8t699k3KroE33m+Re++xnzpKnU35AQb6DJJoJeoU+zu1QDGuq1WGx27G6JZziIX2J0qtKppplPrGL+07W/s0ibXMpns= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697643032; c=relaxed/simple; bh=muILhsc0NjlKwMj5KgFGWu78W6ULk9YRbSEaOkDos2I=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=YBYel8R15KN4NlOFdsXM2dekPkgoH1FINGRTwA8Q2mJ3hWyllyqry/cTY6IU88DYFz1e2tI7GzLf7QMcA77HnLRmUrDd5QrOvYTrPOWs28+sUCquP+1Rrs7TOWC8s0cKz1+OghTHMeV2/zc+X5cZZ+3CbfOT4eIUb/0Y+jhEorM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 7ECBE285C94; Wed, 18 Oct 2023 17:30:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ucw.cz; s=gen1; t=1697643029; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Z7V/Bg/AbL9F3QzCg53yj5eoovBPnbX6g4LerRYmRqo=; b=hnocn8ASj/GizOtw6/UOd2U8AseHboDW1M93xD8Ks2+MfH/e2VQHPpbLdNDieshSF8yMU1 TwcUyXeUWb2MvfDzQjVy/1FYFX6Id5qqATWI6AzghI+PNvXWTzFJt2+gEcRsUJgZwYg+E2 3wOMXJ/fQ7Au/YBZJUghIQGJMyKv3K4= Date: Wed, 18 Oct 2023 17:30:29 +0200 From: Jan Hubicka To: Rishi Raj Cc: Martin Jambor , gcc@gcc.gnu.org Subject: Re: Help needed in output relocations Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,JMQ_SPF_NEUTRAL,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > Hello, Hi, > I have almost completed the output of relocation entries. The only thing > that remains is to output the corresponding symbols in .symtab. In my > current design, I store the info about relocation entry and the symbol > name. However, the problem I am facing with this approach is that many > relocation entries will have the same name, so we will need a hash table > with the key as symbol name and value as symbol index in symtab. It would > be really helpful if you could point out the relevant docs or help me > figure out how to use the hash table in GCC. > Another approach is, as we have only 4-5 unique relocation symbol names. We > can output just those and store their .symtab index somewhere. I am not 100% sure what precisely you need, but if you need just hashtable translating strings to integers, you can probably just follow section_name_hash in symtab.cc which is doing pretty much the same. In case you can already rely on the fact that the strings are unified (which is the case for GCC's identifiers) you can also simply use hash_map which has bit easier to set up. Honza > > -- > Rishi