summaryrefslogtreecommitdiff
path: root/java/openjdk8
diff options
context:
space:
mode:
authorPiotr Kubaj <pkubaj@FreeBSD.org>2023-02-20 14:43:24 +0100
committerPiotr Kubaj <pkubaj@FreeBSD.org>2023-02-20 14:44:06 +0100
commit27753529c1e5df3acbe6a4058b90295a2bb7d15d (patch)
treeb317615a840a00fa405519a7e72f38a6c68408d9 /java/openjdk8
parentdevel/valgrind-devel: update to 3.21.0.g20230218 (diff)
java/openjdk8: commit forgotten patch
Reported by: mikael
Diffstat (limited to 'java/openjdk8')
-rw-r--r--java/openjdk8/files/patch-hotspot_agent_src_os_bsd_symtab.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/java/openjdk8/files/patch-hotspot_agent_src_os_bsd_symtab.c b/java/openjdk8/files/patch-hotspot_agent_src_os_bsd_symtab.c
new file mode 100644
index 000000000000..31e6ef89f82b
--- /dev/null
+++ b/java/openjdk8/files/patch-hotspot_agent_src_os_bsd_symtab.c
@@ -0,0 +1,50 @@
+--- hotspot/agent/src/os/bsd/symtab.c.orig 2023-02-18 20:21:09 UTC
++++ hotspot/agent/src/os/bsd/symtab.c
+@@ -204,6 +204,38 @@ struct elf_section {
+ void *c_data;
+ };
+
++/* Find an ELF section. */
++static struct elf_section *find_section_by_name(char *name,
++ int fd,
++ ELF_EHDR *ehdr,
++ ELF_SHDR *shbuf,
++ struct elf_section *scn_cache)
++{
++ ELF_SHDR* cursct = NULL;
++ char *strtab;
++ int cnt;
++
++ if (scn_cache[ehdr->e_shstrndx].c_data == NULL) {
++ if ((scn_cache[ehdr->e_shstrndx].c_data
++ = read_section_data(fd, ehdr, cursct)) == NULL) {
++ return NULL;
++ }
++ }
++
++ strtab = scn_cache[ehdr->e_shstrndx].c_data;
++
++ for (cursct = shbuf, cnt = 0;
++ cnt < ehdr->e_shnum;
++ cnt++, cursct++) {
++ if (strcmp(cursct->sh_name + strtab, name) == 0) {
++ scn_cache[cnt].c_data = read_section_data(fd, ehdr, cursct);
++ return &scn_cache[cnt];
++ }
++ }
++
++ return NULL;
++}
++
+ // read symbol table from given fd.
+ struct symtab* build_symtab(int fd) {
+ ELF_EHDR ehdr;
+@@ -263,7 +295,7 @@ struct symtab* build_symtab(int fd) {
+ }
+
+ #if defined(ppc64)
+- opd_sect = find_section_by_name(".opd", fd, &ehdr, scn_cache);
++ opd_sect = find_section_by_name(".opd", fd, &ehdr, cursct, scn_cache);
+ if (opd_sect != NULL && opd_sect->c_data != NULL && opd_sect->c_shdr != NULL) {
+ // plausibility check
+ opd = opd_sect->c_shdr;